diff --git a/plugin/src/main/java/com/denizenscript/denizen/events/BukkitScriptEvent.java b/plugin/src/main/java/com/denizenscript/denizen/events/BukkitScriptEvent.java index bc4655e5c3..4f56012b7c 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/events/BukkitScriptEvent.java +++ b/plugin/src/main/java/com/denizenscript/denizen/events/BukkitScriptEvent.java @@ -724,9 +724,6 @@ else if (matcher.doesMatch(mat.identifyNoIdentifier())) { else if (matcher.doesMatch(mat.identifySimpleNoIdentifier())) { return true; } - else if (matcher.doesMatch(mat.identifyFullNoIdentifier())) { - return true; - } return false; } diff --git a/plugin/src/main/java/com/denizenscript/denizen/events/block/LeafDecaysScriptEvent.java b/plugin/src/main/java/com/denizenscript/denizen/events/block/LeafDecaysScriptEvent.java index f2dc97f9d7..896aad511b 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/events/block/LeafDecaysScriptEvent.java +++ b/plugin/src/main/java/com/denizenscript/denizen/events/block/LeafDecaysScriptEvent.java @@ -45,7 +45,7 @@ public boolean couldMatch(ScriptPath path) { if (!path.eventArgLowerAt(1).equals("decay")) { return false; } - if (!path.eventArgLowerAt(2).equals("leaves") && !couldMatchBlock(path.eventArgLowerAt(2))) { + if (!path.eventArgLowerAt(0).equals("leaves") && !couldMatchBlock(path.eventArgLowerAt(0))) { return false; } return true; diff --git a/plugin/src/main/java/com/denizenscript/denizen/events/player/PlayerChangesSignScriptEvent.java b/plugin/src/main/java/com/denizenscript/denizen/events/player/PlayerChangesSignScriptEvent.java index c0b82f9741..d36a547c5c 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/events/player/PlayerChangesSignScriptEvent.java +++ b/plugin/src/main/java/com/denizenscript/denizen/events/player/PlayerChangesSignScriptEvent.java @@ -69,7 +69,7 @@ public boolean couldMatch(ScriptPath path) { public boolean matches(ScriptPath path) { String mat = path.eventArgLowerAt(2); - if (!mat.equals("sign") && (!mat.equals(material.identifyNoIdentifier()) && !mat.equals(material.identifyFullNoIdentifier()))) { + if (!mat.equals("sign") && (!tryMaterial(material, mat))) { return false; } diff --git a/plugin/src/main/java/com/denizenscript/denizen/events/server/CommandScriptEvent.java b/plugin/src/main/java/com/denizenscript/denizen/events/server/CommandScriptEvent.java index e94c9cebd1..d374640ffc 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/events/server/CommandScriptEvent.java +++ b/plugin/src/main/java/com/denizenscript/denizen/events/server/CommandScriptEvent.java @@ -43,7 +43,7 @@ public class CommandScriptEvent extends BukkitScriptEvent implements Listener { // // @Context // returns the command name as an ElementTag. - // returns any args used as a ListTag. + // returns any args used, unmodified as plaintext. // returns a ListTag of the arguments. // returns the source of the command. Can be: PLAYER, SERVER, COMMAND_BLOCK, or COMMAND_MINECART. // returns the command block's location (if the command was run from one). diff --git a/plugin/src/main/java/com/denizenscript/denizen/objects/MaterialTag.java b/plugin/src/main/java/com/denizenscript/denizen/objects/MaterialTag.java index 80171813cb..58ef2e1671 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/objects/MaterialTag.java +++ b/plugin/src/main/java/com/denizenscript/denizen/objects/MaterialTag.java @@ -40,30 +40,6 @@ public class MaterialTag implements ObjectTag, Adjustable { // // --> - /** - * Legacy MaterialTag identities. - */ - private String forcedIdentity = null, - forcedIdentityLow = null; - - /** - * Legacy MaterialTag identities. Do not use. - */ - public MaterialTag forceIdentifyAs(String string) { - forcedIdentity = string; - forcedIdentityLow = CoreUtilities.toLowerCase(string); - return this; - } - - ////////////////// - // OBJECT FETCHER - //////////////// - - @Deprecated - public static MaterialTag valueOf(String string) { - return valueOf(string, null); - } - /** * Gets a Material Object from a string form. * @@ -141,10 +117,6 @@ public boolean matchesBlock(Block b) { return getMaterial() == b.getType(); } - /////////////// - // Constructors - ///////////// - public MaterialTag(Material material) { this.material = material; if (material.isBlock()) { @@ -167,10 +139,6 @@ public MaterialTag(ModernBlockData data) { this.material = data.getMaterial(); } - ///////////////////// - // INSTANCE FIELDS/METHODS - ///////////////// - private Material material; private ModernBlockData modernData; @@ -223,52 +191,29 @@ public String identify() { return "m@" + identifyNoIdentifier(); } - public String identifyFull() { - return "m@" + identifyFullNoIdentifier(); - } - @Override public String identifySimple() { return "m@" + identifySimpleNoIdentifier(); } public String identifyNoPropertiesNoIdentifier() { - if (forcedIdentity != null) { - return forcedIdentityLow; - } return CoreUtilities.toLowerCase(material.name()); } public String identifyNoIdentifier() { - if (forcedIdentity != null) { - return forcedIdentityLow; - } return CoreUtilities.toLowerCase(material.name()) + PropertyParser.getPropertiesString(this); } public String identifySimpleNoIdentifier() { - if (forcedIdentity != null) { - return forcedIdentityLow; - } return CoreUtilities.toLowerCase(material.name()); } - public String identifyFullNoIdentifier() { - if (forcedIdentity != null) { - return forcedIdentityLow; - } - return CoreUtilities.toLowerCase(material.name()) + PropertyParser.getPropertiesString(this); - } - @Override public String toString() { return identify(); } public String realName() { - if (forcedIdentity != null) { - return forcedIdentityLow; - } return CoreUtilities.toLowerCase(material.name()); } @@ -686,7 +631,7 @@ public static void registerTags() { // Returns the name of the material. // --> registerTag("name", (attribute, object) -> { - return new ElementTag(object.forcedIdentity != null ? object.forcedIdentityLow : CoreUtilities.toLowerCase(object.material.name())); + return new ElementTag(CoreUtilities.toLowerCase(object.material.name())); }); // <--[tag] diff --git a/plugin/src/main/java/com/denizenscript/denizen/scripts/commands/entity/WalkCommand.java b/plugin/src/main/java/com/denizenscript/denizen/scripts/commands/entity/WalkCommand.java index dfe64c4c99..43947f5894 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/scripts/commands/entity/WalkCommand.java +++ b/plugin/src/main/java/com/denizenscript/denizen/scripts/commands/entity/WalkCommand.java @@ -97,9 +97,7 @@ public WalkCommand() { @Override public void parseArgs(ScriptEntry scriptEntry) throws InvalidArgumentsException { - for (Argument arg : scriptEntry.getProcessedArgs()) { - if (!scriptEntry.hasObject("lookat") && arg.matchesPrefix("lookat") && arg.matchesArgumentType(LocationTag.class)) { @@ -135,11 +133,9 @@ else if (!scriptEntry.hasObject("entities") arg.reportUnhandled(); } } - if (!scriptEntry.hasObject("location") && !scriptEntry.hasObject("stop")) { throw new InvalidArgumentsException("Must specify a location!"); } - if (!scriptEntry.hasObject("entities")) { if (Utilities.getEntryNPC(scriptEntry) == null || !Utilities.getEntryNPC(scriptEntry).isValid() @@ -147,17 +143,14 @@ else if (!scriptEntry.hasObject("entities") throw new InvalidArgumentsException("Must have a valid spawned NPC attached."); } else { - scriptEntry.addObject("entities", - Arrays.asList(Utilities.getEntryNPC(scriptEntry).getDenizenEntity())); + scriptEntry.addObject("entities", Arrays.asList(Utilities.getEntryNPC(scriptEntry).getDenizenEntity())); } } - scriptEntry.defaultObject("stop", new ElementTag(false)); } @Override public void execute(ScriptEntry scriptEntry) { - LocationTag loc = scriptEntry.getObjectTag("location"); ElementTag speed = scriptEntry.getElement("speed"); ElementTag auto_range = scriptEntry.getElement("auto_range"); @@ -165,7 +158,6 @@ public void execute(ScriptEntry scriptEntry) { ElementTag stop = scriptEntry.getElement("stop"); List entities = (List) scriptEntry.getObject("entities"); final LocationTag lookat = scriptEntry.getObjectTag("lookat"); - if (scriptEntry.dbCallShouldDebug()) { Debug.report(scriptEntry, getName(), (loc != null ? loc.debug() : "") + (speed != null ? speed.debug() : "") @@ -175,11 +167,7 @@ public void execute(ScriptEntry scriptEntry) { + stop.debug() + (ArgumentHelper.debugObj("entities", entities))); } - - // Do the execution - boolean shouldStop = stop.asBoolean(); - List npcs = new ArrayList<>(); final List waitForEntities = new ArrayList<>(); for (final EntityTag entity : entities) { @@ -190,22 +178,17 @@ public void execute(ScriptEntry scriptEntry) { Debug.echoError(scriptEntry.getResidingQueue(), "NPC " + npc.identify() + " is not spawned!"); continue; } - if (shouldStop) { npc.getNavigator().cancelNavigation(); continue; } - - if (auto_range != null - && auto_range.asBoolean()) { + if (auto_range != null && auto_range.asBoolean()) { double distance = npc.getLocation().distance(loc); if (npc.getNavigator().getLocalParameters().range() < distance + 10) { npc.getNavigator().getLocalParameters().range((float) distance + 10); } } - npc.getNavigator().setTarget(loc); - if (lookat != null) { npc.getNavigator().getLocalParameters().lookAtFunction(new Function() { @Override @@ -214,11 +197,9 @@ public Location apply(Navigator nav) { } }); } - if (speed != null) { npc.getNavigator().getLocalParameters().speedModifier(speed.asFloat()); } - if (radius != null) { npc.getNavigator().getLocalParameters().addRunCallback(WalkCommandCitizensEvents .generateNewFlocker(npc.getCitizen(), radius.asDouble())); @@ -238,7 +219,6 @@ public void run() { }); } } - if (scriptEntry.shouldWaitFor()) { held.add(scriptEntry); if (!npcs.isEmpty()) {