diff --git a/plugin/src/main/java/com/denizenscript/denizen/scripts/commands/player/SidebarCommand.java b/plugin/src/main/java/com/denizenscript/denizen/scripts/commands/player/SidebarCommand.java index 9b2261bc70..bf3ed63946 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/scripts/commands/player/SidebarCommand.java +++ b/plugin/src/main/java/com/denizenscript/denizen/scripts/commands/player/SidebarCommand.java @@ -191,7 +191,6 @@ public void execute(ScriptEntry scriptEntry) { ListTag value = null; ElementTag increment = null; ElementTag start = null; - String debug; if (per_player) { if (elTitle != null) { perTitle = elTitle.asString(); @@ -208,11 +207,9 @@ public void execute(ScriptEntry scriptEntry) { if (elStart != null) { perStart = elStart.asString(); } - debug = scriptEntry.dbCallShouldDebug() ? ((elTitle != null ? elTitle.debug() : "") + - (elScores != null ? elScores.debug() : "") + - (elValue != null ? elValue.debug() : "") + - (elIncrement != null ? elIncrement.debug() : "") + - (elStart != null ? elStart.debug() : "")) : null; + if (scriptEntry.dbCallShouldDebug()) { + Debug.report(scriptEntry, getName(), action, elTitle, elScores, elValue, elIncrement, elStart, db("players", players)); + } } else { BukkitTagContext context = (BukkitTagContext) scriptEntry.getContext(); @@ -231,14 +228,9 @@ public void execute(ScriptEntry scriptEntry) { if (elStart != null) { start = new ElementTag(TagManager.tag(elStart.asString(), context)); } - debug = scriptEntry.dbCallShouldDebug() ? ((title != null ? title.debug() : "") + - (scores != null ? db("scores", scores) : "") + - (value != null ? db("value", value) : "") + - (increment != null ? increment.debug() : "") + - (start != null ? start.debug() : "")) : null; - } - if (scriptEntry.dbCallShouldDebug()) { - Debug.report(scriptEntry, getName(), action, debug, db("players", players)); + if (scriptEntry.dbCallShouldDebug()) { + Debug.report(scriptEntry, getName(), action, title, scores, value, increment, start, db("players", players)); + } } switch (Action.valueOf(action.asString())) { case ADD: diff --git a/plugin/src/main/java/com/denizenscript/denizen/scripts/commands/world/ChunkLoadCommand.java b/plugin/src/main/java/com/denizenscript/denizen/scripts/commands/world/ChunkLoadCommand.java index 34d9c5ee15..f354a16aa1 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/scripts/commands/world/ChunkLoadCommand.java +++ b/plugin/src/main/java/com/denizenscript/denizen/scripts/commands/world/ChunkLoadCommand.java @@ -122,10 +122,7 @@ public void execute(ScriptEntry scriptEntry) { ListTag chunklocs = scriptEntry.getObjectTag("location"); DurationTag length = scriptEntry.getObjectTag("duration"); if (scriptEntry.dbCallShouldDebug()) { - Debug.report(scriptEntry, getName(), - action.debug() - + chunklocs.debug() - + length.debug()); + Debug.report(scriptEntry, getName(), action, chunklocs, length); } for (String chunkText : chunklocs) { Chunk chunk; diff --git a/plugin/src/main/java/com/denizenscript/denizen/scripts/commands/world/CopyBlockCommand.java b/plugin/src/main/java/com/denizenscript/denizen/scripts/commands/world/CopyBlockCommand.java index 87308df16a..295612eba4 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/scripts/commands/world/CopyBlockCommand.java +++ b/plugin/src/main/java/com/denizenscript/denizen/scripts/commands/world/CopyBlockCommand.java @@ -86,8 +86,7 @@ public void execute(ScriptEntry scriptEntry) { LocationTag destination = scriptEntry.getObjectTag("destination"); ElementTag remove_original = scriptEntry.getElement("remove"); if (scriptEntry.dbCallShouldDebug()) { - Debug.report(scriptEntry, getName(), (copy_location != null ? copy_location.debug() : "") - + destination.debug() + remove_original.debug()); + Debug.report(scriptEntry, getName(), copy_location, destination, remove_original); } List locations = new ArrayList<>(); if (copy_location != null) { diff --git a/plugin/src/main/java/com/denizenscript/denizen/scripts/commands/world/ExplodeCommand.java b/plugin/src/main/java/com/denizenscript/denizen/scripts/commands/world/ExplodeCommand.java index d7af358214..900c6de27b 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/scripts/commands/world/ExplodeCommand.java +++ b/plugin/src/main/java/com/denizenscript/denizen/scripts/commands/world/ExplodeCommand.java @@ -120,12 +120,7 @@ public void execute(ScriptEntry scriptEntry) { ElementTag fire = scriptEntry.getElement("fire"); EntityTag source = scriptEntry.getObjectTag("source"); if (scriptEntry.dbCallShouldDebug()) { - Debug.report(scriptEntry, getName(), - location.debug() + - (source == null ? "" : source.debug()) + - power.debug() + - breakblocks.debug() + - fire.debug()); + Debug.report(scriptEntry, getName(), location, source, power, breakblocks, fire); } location.getWorld().createExplosion(location, power.asFloat(), fire.asBoolean(), breakblocks.asBoolean(), source == null ? null : source.getBukkitEntity()); } diff --git a/plugin/src/main/java/com/denizenscript/denizen/scripts/commands/world/GameRuleCommand.java b/plugin/src/main/java/com/denizenscript/denizen/scripts/commands/world/GameRuleCommand.java index dd3552a5e6..064f1d6e84 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/scripts/commands/world/GameRuleCommand.java +++ b/plugin/src/main/java/com/denizenscript/denizen/scripts/commands/world/GameRuleCommand.java @@ -75,7 +75,7 @@ public void execute(ScriptEntry scriptEntry) { ElementTag gamerule = scriptEntry.getElement("gamerule"); ElementTag value = scriptEntry.getElement("value"); if (scriptEntry.dbCallShouldDebug()) { - Debug.report(scriptEntry, getName(), world.debug() + gamerule.debug() + value.debug()); + Debug.report(scriptEntry, getName(), world, gamerule, value); } if (!world.getWorld().setGameRuleValue(gamerule.asString(), value.asString())) { Debug.echoError(scriptEntry.getResidingQueue(), "Invalid gamerule!"); diff --git a/plugin/src/main/java/com/denizenscript/denizen/scripts/commands/world/LightCommand.java b/plugin/src/main/java/com/denizenscript/denizen/scripts/commands/world/LightCommand.java index 78cc52356d..8f6e9df3e6 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/scripts/commands/world/LightCommand.java +++ b/plugin/src/main/java/com/denizenscript/denizen/scripts/commands/world/LightCommand.java @@ -67,9 +67,7 @@ public void addCustomTabCompletions(String arg, Consumer addOne) { @Override public void parseArgs(ScriptEntry scriptEntry) throws InvalidArgumentsException { - for (Argument arg : scriptEntry) { - if (!scriptEntry.hasObject("location") && arg.matchesArgumentType(LocationTag.class)) { scriptEntry.addObject("location", arg.asType(LocationTag.class)); @@ -87,32 +85,23 @@ else if (!scriptEntry.hasObject("duration") && arg.matchesArgumentType(DurationTag.class)) { scriptEntry.addObject("duration", arg.asType(DurationTag.class)); } - } - if (!scriptEntry.hasObject("location") || (!scriptEntry.hasObject("light") && !scriptEntry.hasObject("reset"))) { throw new InvalidArgumentsException("Must specify a valid location and light level."); } - scriptEntry.defaultObject("reset", new ElementTag(false)); } @Override public void execute(ScriptEntry scriptEntry) { - LocationTag location = scriptEntry.getObjectTag("location"); ElementTag light = scriptEntry.getElement("light"); ElementTag reset = scriptEntry.getElement("reset"); DurationTag duration = scriptEntry.getObjectTag("duration"); - if (scriptEntry.dbCallShouldDebug()) { - - Debug.report(scriptEntry, getName(), location.debug() + reset.debug() - + (light != null ? light.debug() : "") + (duration != null ? duration.debug() : "")); - + Debug.report(scriptEntry, getName(), location, reset, light, duration); } - if (!Utilities.isLocationYSafe(location)) { Debug.echoError(scriptEntry.getResidingQueue(), "Invalid light location!"); return; diff --git a/plugin/src/main/java/com/denizenscript/denizen/scripts/commands/world/ModifyBlockCommand.java b/plugin/src/main/java/com/denizenscript/denizen/scripts/commands/world/ModifyBlockCommand.java index 2b6b52909d..a3021369fa 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/scripts/commands/world/ModifyBlockCommand.java +++ b/plugin/src/main/java/com/denizenscript/denizen/scripts/commands/world/ModifyBlockCommand.java @@ -240,18 +240,8 @@ public void execute(final ScriptEntry scriptEntry) { } final List materialList = materials.filter(MaterialTag.class, scriptEntry); if (scriptEntry.dbCallShouldDebug()) { - Debug.report(scriptEntry, getName(), materials.debug() - + physics.debug() - + radiusElement.debug() - + heightElement.debug() - + depthElement.debug() - + (natural == null ? "" : natural.debug()) - + delayed.debug() - + maxDelayMs.debug() - + (script != null ? script.debug() : "") - + (percents != null ? percents.debug() : "") - + (source != null ? source.debug() : "") - + (locations == null ? location_list.debug() : db("locations", locations))); + Debug.report(scriptEntry, getName(), materials, physics, radiusElement, heightElement, depthElement, natural, + delayed, maxDelayMs, script, percents, source, (locations == null ? location_list : db("locations", locations))); } Player sourcePlayer = source == null ? null : source.getPlayerEntity(); final boolean doPhysics = physics.asBoolean(); diff --git a/plugin/src/main/java/com/denizenscript/denizen/scripts/commands/world/PlayEffectCommand.java b/plugin/src/main/java/com/denizenscript/denizen/scripts/commands/world/PlayEffectCommand.java index 22eee40185..5ea35859d9 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/scripts/commands/world/PlayEffectCommand.java +++ b/plugin/src/main/java/com/denizenscript/denizen/scripts/commands/world/PlayEffectCommand.java @@ -224,7 +224,7 @@ public void execute(ScriptEntry scriptEntry) { ElementTag special_data = scriptEntry.getElement("special_data"); LocationTag velocity = scriptEntry.getObjectTag("velocity"); if (scriptEntry.dbCallShouldDebug()) { - Debug.report(scriptEntry, getName(), (effect != null ? db("effect", effect.name()) : particleEffect != null ? db("special effect", particleEffect.getName()) : (iconcrack != null ? iconcrack.debug() : "")), + Debug.report(scriptEntry, getName(), (effect != null ? db("effect", effect.name()) : particleEffect != null ? db("special effect", particleEffect.getName()) : iconcrack), db("locations", locations), db("targets", targets), radius, data, quantity, offset, special_data, velocity, (should_offset ? db("note", "Location will be offset 1 block-height upward (see documentation)") : "")); } for (LocationTag location : locations) { diff --git a/plugin/src/main/java/com/denizenscript/denizen/scripts/commands/world/StrikeCommand.java b/plugin/src/main/java/com/denizenscript/denizen/scripts/commands/world/StrikeCommand.java index 0d1b767976..16503ad612 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/scripts/commands/world/StrikeCommand.java +++ b/plugin/src/main/java/com/denizenscript/denizen/scripts/commands/world/StrikeCommand.java @@ -78,11 +78,9 @@ else if (arg.matches("no_damage") || arg.matches("nodamage")) { @Override public void execute(ScriptEntry scriptEntry) { LocationTag location = scriptEntry.getObjectTag("location"); - Boolean damage = scriptEntry.getElement("damage").asBoolean(); + boolean damage = scriptEntry.getElement("damage").asBoolean(); if (scriptEntry.dbCallShouldDebug()) { - Debug.report(scriptEntry, getName(), - location.debug() - + db("Damageable", String.valueOf(damage))); + Debug.report(scriptEntry, getName(), location, db("damage", damage)); } if (damage) { location.getWorld().strikeLightning(location); diff --git a/plugin/src/main/java/com/denizenscript/denizen/scripts/commands/world/TimeCommand.java b/plugin/src/main/java/com/denizenscript/denizen/scripts/commands/world/TimeCommand.java index 3c9200ee2e..035f35092e 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/scripts/commands/world/TimeCommand.java +++ b/plugin/src/main/java/com/denizenscript/denizen/scripts/commands/world/TimeCommand.java @@ -134,11 +134,7 @@ public void execute(ScriptEntry scriptEntry) { ElementTag freeze = scriptEntry.getElement("freeze"); Type type = Type.valueOf(type_element.asString().toUpperCase()); if (scriptEntry.dbCallShouldDebug()) { - Debug.report(scriptEntry, getName(), type_element.debug() - + (reset != null ? reset.debug() : value.debug()) - + (freeze != null ? freeze.debug() : "") - + (resetAfter != null ? resetAfter.debug() : "") - + world.debug()); + Debug.report(scriptEntry, getName(), type_element, reset, value, freeze, resetAfter, world); } if (type.equals(Type.GLOBAL)) { world.getWorld().setTime(value.getTicks()); diff --git a/plugin/src/main/java/com/denizenscript/denizen/utilities/debugging/Debug.java b/plugin/src/main/java/com/denizenscript/denizen/utilities/debugging/Debug.java index e1c5e1ca31..ddacacd762 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/utilities/debugging/Debug.java +++ b/plugin/src/main/java/com/denizenscript/denizen/utilities/debugging/Debug.java @@ -79,10 +79,11 @@ public static void report(Debuggable caller, String name, Object... values) { continue; } if (obj instanceof ObjectTag) { - output.append(((ObjectTag) obj).debug()); + ObjectTag objTag = (ObjectTag) obj; + output.append("").append(objTag.getPrefix()).append("='").append(objTag.debuggable()).append("' "); } else { - output.append(obj.toString()); + output.append(obj); } } echo("+> Executing '" + name + "': " + trimMessage(output.toString()), caller);