Skip to content

Commit

Permalink
code general cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Jun 17, 2019
1 parent f46ea68 commit 8a33d37
Show file tree
Hide file tree
Showing 18 changed files with 23 additions and 28 deletions.
Expand Up @@ -34,7 +34,7 @@ public void init() {
public void run(ReplaceableTagEvent event) {
factionTagEvent(event);
}
}, "faction");
}, "faction");
TagManager.registerTagHandler(new TagRunnable.RootForm() {
@Override
public void run(ReplaceableTagEvent event) {
Expand Down
Expand Up @@ -39,7 +39,7 @@ public String getTargetHelp() {

@Override
public String[] getTargetPrefixes() {
return new String[] { "denizen_proc", "held_denizen_item" };
return new String[] {"denizen_proc", "held_denizen_item"};
}

@Override
Expand Down
Expand Up @@ -55,7 +55,7 @@ else if (!event.hasAlternative()) {
}
}

public void tagEvent(ReplaceableTagEvent event) {
public void tagEvent(ReplaceableTagEvent event) {
Attribute attribute = event.getAttributes().fulfill(1);

// <--[tag]
Expand Down
Expand Up @@ -100,7 +100,7 @@ else if (!scriptEntry.hasObject("targets")) {

@SuppressWarnings("unchecked")
@Override
public void execute(ScriptEntry scriptEntry) throws CommandExecutionException {
public void execute(ScriptEntry scriptEntry) {

Element file = scriptEntry.getdObject("file");
Element action = scriptEntry.getdObject("action");
Expand Down
Expand Up @@ -55,8 +55,8 @@ public static HyperPlayer getHyperPlayer(TransactionResponse transactionResponse
public void onTransaction(PlayerTransaction playerTransaction, TransactionResponse transactionResponse) {
HyperPlayer hyperPlayer = getHyperPlayer(transactionResponse);

List<String> events = new ArrayList<String>();
Map<String, dObject> context = new HashMap<String, dObject>();
List<String> events = new ArrayList<>();
Map<String, dObject> context = new HashMap<>();

HItemStack his = playerTransaction.getHyperObject().getItem();
dItem item = new dItem(new ItemStack(Material.valueOf(his.getMaterial().toUpperCase()),
Expand Down
Expand Up @@ -4,14 +4,12 @@
import net.aufdemrand.denizen.BukkitScriptEntryData;
import net.aufdemrand.denizen.events.BukkitScriptEvent;
import net.aufdemrand.denizen.objects.dPlayer;
import net.aufdemrand.denizen.utilities.DenizenAPI;
import net.aufdemrand.denizencore.objects.Element;
import net.aufdemrand.denizencore.objects.dObject;
import net.aufdemrand.denizencore.scripts.ScriptEntryData;
import net.aufdemrand.denizencore.scripts.containers.ScriptContainer;
import net.aufdemrand.denizencore.utilities.CoreUtilities;
import net.aufdemrand.denizencore.utilities.debugging.dB;
import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;

Expand Down
Expand Up @@ -4,13 +4,11 @@
import net.aufdemrand.denizen.BukkitScriptEntryData;
import net.aufdemrand.denizen.events.BukkitScriptEvent;
import net.aufdemrand.denizen.objects.dPlayer;
import net.aufdemrand.denizen.utilities.DenizenAPI;
import net.aufdemrand.denizencore.objects.Element;
import net.aufdemrand.denizencore.objects.dObject;
import net.aufdemrand.denizencore.scripts.ScriptEntryData;
import net.aufdemrand.denizencore.scripts.containers.ScriptContainer;
import net.aufdemrand.denizencore.utilities.CoreUtilities;
import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;

Expand Down
Expand Up @@ -5,13 +5,11 @@
import net.aufdemrand.denizen.events.BukkitScriptEvent;
import net.aufdemrand.denizen.objects.dEntity;
import net.aufdemrand.denizen.objects.dPlayer;
import net.aufdemrand.denizen.utilities.DenizenAPI;
import net.aufdemrand.denizencore.objects.Element;
import net.aufdemrand.denizencore.objects.dObject;
import net.aufdemrand.denizencore.scripts.ScriptEntryData;
import net.aufdemrand.denizencore.scripts.containers.ScriptContainer;
import net.aufdemrand.denizencore.utilities.CoreUtilities;
import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;

Expand Down
Expand Up @@ -74,6 +74,7 @@ else if (name.equals("username")) {
}
return super.getContext(name);
}

@EventHandler
public void onVotifierEvent(VotifierEvent event) {
Vote vote = event.getVote();
Expand Down
Expand Up @@ -70,7 +70,7 @@ public String getAttribute(Attribute attribute) {
// -->
if (attribute.startsWith("list_towns")) {
dList list = new dList();
List<String> towns = new ArrayList<String>();
List<String> towns = new ArrayList<>();
try {
for (Location location : cuboid.getBlockLocations()) {
String townName = TownyUniverse.getTownName(location);
Expand Down
Expand Up @@ -124,7 +124,7 @@ public String getAttribute(Attribute attribute) {
if (selection != null) {
return new dCuboid(BukkitAdapter.adapt(player.getWorld(), selection.getIncompleteRegion().getMinimumPoint()),
BukkitAdapter.adapt(player.getWorld(), selection.getIncompleteRegion().getMaximumPoint()))
.getAttribute(attribute.fulfill(1));
.getAttribute(attribute.fulfill(1));
}
}

Expand Down
Expand Up @@ -64,7 +64,7 @@ private boolean hasRegion() {
}

private dList getRegions(World world) {
List<String> regionList = new ArrayList<String>();
List<String> regionList = new ArrayList<>();
for (ProtectedRegion protectedRegion : getApplicableRegions()) {
regionList.add(new WorldGuardRegion(protectedRegion, world).identify());
}
Expand Down
Expand Up @@ -63,7 +63,7 @@ private boolean inRegion(String region) {
}

private dList getRegions(World world) {
List<String> regionList = new ArrayList<String>();
List<String> regionList = new ArrayList<>();
for (ProtectedRegion protectedRegion : getApplicableRegions()) {
regionList.add(new WorldGuardRegion(protectedRegion, world).identify());
}
Expand Down
Expand Up @@ -114,7 +114,7 @@ public String getAttribute(Attribute attribute) {
}
WorldGuardPlugin worldGuard = (WorldGuardPlugin) WorldGuardBridge.instance.plugin;
return new Element(query.testState(BukkitAdapter.adapt(loc), worldGuard.wrapPlayer(player), flag))
.getAttribute(attribute.fulfill(args));
.getAttribute(attribute.fulfill(args));
}

return null;
Expand Down
Expand Up @@ -141,8 +141,8 @@ public String getAttribute(Attribute attribute) {
// -->
if (attribute.startsWith("trusted")) {
dList trusted = new dList();
ArrayList<String> b = new ArrayList<String>();
claim.getPermissions(b,new ArrayList<String>(),new ArrayList<String>(),new ArrayList<String>());
ArrayList<String> b = new ArrayList<>();
claim.getPermissions(b, new ArrayList<>(), new ArrayList<>(), new ArrayList<>());
for (String trust : b) {
trusted.add(new dPlayer(UUID.fromString(trust)).identify());
}
Expand All @@ -158,8 +158,8 @@ public String getAttribute(Attribute attribute) {
// -->
if (attribute.startsWith("builders")) {
dList trusted = new dList();
ArrayList<String> b = new ArrayList<String>();
claim.getPermissions(b,new ArrayList<String>(),new ArrayList<String>(),new ArrayList<String>());
ArrayList<String> b = new ArrayList<>();
claim.getPermissions(b, new ArrayList<>(), new ArrayList<>(), new ArrayList<>());
for (String trust : b) {
trusted.add(new dPlayer(UUID.fromString(trust)).identify());
}
Expand All @@ -175,8 +175,8 @@ public String getAttribute(Attribute attribute) {
// -->
if (attribute.startsWith("containers")) {
dList trusted = new dList();
ArrayList<String> c = new ArrayList<String>();
claim.getPermissions(new ArrayList<String>(),c,new ArrayList<String>(),new ArrayList<String>());
ArrayList<String> c = new ArrayList<>();
claim.getPermissions(new ArrayList<>(), c, new ArrayList<>(), new ArrayList<>());
for (String container : c) {
trusted.add(new dPlayer(UUID.fromString(container)).identify());
}
Expand All @@ -192,8 +192,8 @@ public String getAttribute(Attribute attribute) {
// -->
if (attribute.startsWith("accessors")) {
dList trusted = new dList();
ArrayList<String> a = new ArrayList<String>();
claim.getPermissions(new ArrayList<String>(),new ArrayList<String>(),a,new ArrayList<String>());
ArrayList<String> a = new ArrayList<>();
claim.getPermissions(new ArrayList<>(), new ArrayList<>(), a, new ArrayList<>());
for (String access : a) {
trusted.add(new dPlayer(UUID.fromString(access)).identify());
}
Expand Down
Expand Up @@ -366,7 +366,7 @@ else if (attribute.startsWith("secondary_class")) {
// @Plugin Depenizen, Heroes
// -->
else if (attribute.startsWith("skills")) {
Set<String> skills = new HashSet<String>();
Set<String> skills = new HashSet<>();
skills.addAll(hero.getSkills().keySet());
skills.addAll(hero.getHeroClass().getSkillNames());
skills.addAll(hero.getSecondClass().getSkillNames());
Expand Down
Expand Up @@ -38,7 +38,7 @@ public static JobsJob valueOf(String string, TagContext context) {

Matcher m = ObjectFetcher.DESCRIBED_PATTERN.matcher(string);
if (m.matches()) {
return ObjectFetcher.getObjectFrom(JobsJob.class, string);
return ObjectFetcher.getObjectFrom(JobsJob.class, string, context);
}
return new JobsJob(Jobs.getJob(string.replace("job@", "")));
}
Expand Down
Expand Up @@ -31,7 +31,7 @@ public static PrismAction valueOf(String string, TagContext context) {

Matcher m = ObjectFetcher.DESCRIBED_PATTERN.matcher(string);
if (m.matches()) {
return ObjectFetcher.getObjectFrom(PrismAction.class, string);
return ObjectFetcher.getObjectFrom(PrismAction.class, string, context);
}

string = string.replace("prism@", "");
Expand Down

0 comments on commit 8a33d37

Please sign in to comment.