From ef2c249a69fe23cd60aeac73ca0d6fa636b8e96b Mon Sep 17 00:00:00 2001 From: mcmonkey4eva Date: Sun, 8 Sep 2013 14:35:26 -0700 Subject: [PATCH] Excessive formatting Oh my god. --- .../aufdemrand/denizen/CommandHandler.java | 46 +-- .../java/net/aufdemrand/denizen/Denizen.java | 6 +- .../java/net/aufdemrand/denizen/Settings.java | 102 +++---- .../denizen/events/ExhaustedNPCEvent.java | 6 +- .../denizen/events/ReplaceableTagEvent.java | 4 +- .../denizen/events/SavesReloadEvent.java | 6 +- .../events/ScriptEntryExecuteEvent.java | 6 +- .../denizen/events/ScriptFailEvent.java | 18 +- .../denizen/events/ScriptFinishEvent.java | 14 +- .../denizen/events/ScriptReloadEvent.java | 6 +- .../exceptions/CommandExecutionException.java | 4 +- .../exceptions/InvalidArgumentsException.java | 4 +- .../exceptions/RequirementCheckException.java | 4 +- .../ScriptEntryCreationException.java | 4 +- .../aufdemrand/denizen/flags/FlagManager.java | 20 +- .../interfaces/RegistrationableInstance.java | 12 +- .../denizen/interfaces/dExternal.java | 2 +- .../denizen/interfaces/dRegistry.java | 40 +-- .../denizen/listeners/AbstractListener.java | 4 +- .../listeners/AbstractListenerType.java | 14 +- .../listeners/core/BlockListenerInstance.java | 60 ++-- .../listeners/core/BlockListenerType.java | 2 +- .../core/ItemDropListenerInstance.java | 34 +-- .../listeners/core/ItemDropListenerType.java | 6 +- .../listeners/core/ItemListenerInstance.java | 52 ++-- .../listeners/core/ItemListenerType.java | 4 +- .../listeners/core/KillListenerInstance.java | 2 +- .../listeners/core/TravelListenerType.java | 2 +- .../denizen/npc/traits/FishingTrait.java | 74 ++--- .../denizen/npc/traits/InvisibleTrait.java | 2 +- .../denizen/npc/traits/NameplateTrait.java | 54 ++-- .../denizen/npc/traits/NicknameTrait.java | 4 +- .../denizen/npc/traits/ParticlesTrait.java | 50 +-- .../denizen/npc/traits/PushableTrait.java | 2 +- .../denizen/npc/traits/SittingTrait.java | 42 +-- .../denizen/npc/traits/SleepingTrait.java | 46 +-- .../denizen/npc/traits/SneakingTrait.java | 22 +- .../denizen/npc/traits/TriggerTrait.java | 6 +- .../aufdemrand/denizen/objects/Duration.java | 34 +-- .../aufdemrand/denizen/objects/Element.java | 114 +++---- .../aufdemrand/denizen/objects/dColor.java | 30 +- .../aufdemrand/denizen/objects/dEntity.java | 42 +-- .../denizen/objects/dInventory.java | 284 +++++++++--------- .../net/aufdemrand/denizen/objects/dItem.java | 32 +- .../net/aufdemrand/denizen/objects/dList.java | 34 +-- .../aufdemrand/denizen/objects/dLocation.java | 56 ++-- .../aufdemrand/denizen/objects/dMaterial.java | 78 ++--- .../net/aufdemrand/denizen/objects/dNPC.java | 8 +- .../aufdemrand/denizen/objects/dPlayer.java | 10 +- .../aufdemrand/denizen/objects/dWorld.java | 80 ++--- .../denizen/scripts/ScriptBuilder.java | 4 +- .../denizen/scripts/ScriptHelper.java | 2 +- .../scripts/commands/AbstractCommand.java | 62 ++-- .../scripts/commands/BracedCommand.java | 30 +- .../scripts/commands/CommandExecuter.java | 6 +- .../scripts/commands/CommandRegistry.java | 190 ++++++------ .../scripts/commands/core/FinishCommand.java | 6 +- .../scripts/commands/core/LogCommand.java | 42 +-- .../scripts/commands/entity/FeedCommand.java | 22 +- .../scripts/commands/entity/HealCommand.java | 8 +- .../scripts/commands/entity/HurtCommand.java | 2 +- .../scripts/commands/entity/LeashCommand.java | 26 +- .../scripts/commands/entity/LookCommand.java | 24 +- .../commands/entity/NameplateCommand.java | 8 +- .../scripts/commands/entity/ShootCommand.java | 102 +++---- .../scripts/commands/entity/SpawnCommand.java | 4 +- .../scripts/commands/item/EngraveCommand.java | 46 +-- .../scripts/commands/item/EquipCommand.java | 40 +-- .../scripts/commands/item/GiveCommand.java | 14 +- .../scripts/commands/item/ScribeCommand.java | 18 +- .../scripts/commands/item/TakeCommand.java | 22 +- .../scripts/commands/npc/FishCommand.java | 18 +- .../scripts/commands/npc/SitCommand.java | 14 +- .../scripts/commands/npc/StandCommand.java | 12 +- .../commands/player/ExperienceCommand.java | 6 +- .../commands/player/ListenCommand.java | 16 +- .../commands/player/OxygenCommand.java | 24 +- .../commands/player/PermissionCommand.java | 6 +- .../commands/server/AnnounceCommand.java | 14 +- .../commands/world/AnimateChestCommand.java | 16 +- .../scripts/commands/world/BreakCommand.java | 4 +- .../commands/world/ChunkLoadCommand.java | 20 +- .../commands/world/CopyBlockCommand.java | 20 +- .../scripts/commands/world/MidiCommand.java | 36 +-- .../commands/world/ModifyBlockCommand.java | 44 +-- .../commands/world/PlayEffectCommand.java | 40 +-- .../commands/world/PlaySoundCommand.java | 16 +- .../scripts/commands/world/StrikeCommand.java | 2 +- .../scripts/commands/world/SwitchCommand.java | 32 +- .../scripts/commands/world/TimeCommand.java | 12 +- .../commands/world/WeatherCommand.java | 20 +- .../core/FormatScriptContainer.java | 2 +- .../core/InventoryScriptContainer.java | 34 +-- .../containers/core/ItemScriptContainer.java | 22 +- .../containers/core/ItemScriptHelper.java | 28 +- .../containers/core/TaskScriptContainer.java | 2 +- .../containers/core/WorldScriptHelper.java | 4 +- .../requirements/AbstractRequirement.java | 36 +-- .../requirements/RequirementChecker.java | 4 +- .../requirements/RequirementRegistry.java | 80 ++--- .../core/EnchantedRequirement.java | 2 +- .../requirements/core/FlaggedRequirement.java | 2 +- .../requirements/core/HoldingRequirement.java | 8 +- .../requirements/core/InGroupRequirement.java | 12 +- .../requirements/core/ItemRequirement.java | 2 +- .../requirements/core/MoneyRequirement.java | 10 +- .../requirements/core/OxygenRequirement.java | 18 +- .../core/PermissionRequirement.java | 12 +- .../requirements/core/PoweredRequirement.java | 2 +- .../requirements/core/TimeRequirement.java | 16 +- .../core/WorldGuardRegionRequirement.java | 18 +- .../scripts/triggers/AbstractTrigger.java | 14 +- .../scripts/triggers/core/ChatTrigger.java | 12 +- .../triggers/core/ProximityTrigger.java | 2 +- .../aufdemrand/denizen/tags/Attribute.java | 4 +- .../denizen/tags/ObjectFetcher.java | 2 +- .../aufdemrand/denizen/tags/TagManager.java | 4 +- .../denizen/tags/core/AnchorTags.java | 2 +- .../denizen/tags/core/ConstantTags.java | 2 +- .../denizen/tags/core/ContextTags.java | 2 +- .../denizen/tags/core/FlagTags.java | 12 +- .../denizen/tags/core/LocationTags.java | 4 +- .../aufdemrand/denizen/tags/core/NPCTags.java | 14 +- .../tags/core/NotableLocationTags.java | 10 +- .../denizen/tags/core/ProcedureScriptTag.java | 4 +- .../tags/core/SpecialCharacterTags.java | 8 +- .../denizen/tags/core/TextTags.java | 4 +- .../denizen/tags/core/UtilTags.java | 12 +- .../denizen/tags/core/_templateTag.java | 2 +- .../denizen/utilities/Conversion.java | 8 +- .../denizen/utilities/ParticleEffect.java | 66 ++-- .../denizen/utilities/RuntimeCompiler.java | 8 +- .../denizen/utilities/ScriptRepo.java | 2 +- .../denizen/utilities/Utilities.java | 66 ++-- .../denizen/utilities/Velocity.java | 26 +- .../denizen/utilities/debugging/DebugLog.java | 2 +- .../denizen/utilities/debugging/dB.java | 112 +++---- .../denizen/utilities/depends/Depends.java | 12 +- .../depends/WorldGuardUtilities.java | 38 +-- .../denizen/utilities/entity/Gravity.java | 12 +- .../denizen/utilities/entity/Position.java | 22 +- .../denizen/utilities/entity/Rotation.java | 46 +-- .../utilities/inventory/InventoryMenu.java | 6 +- .../inventory/InventoryMenuItem.java | 2 +- .../inventory/MenuCloseBehaviour.java | 2 +- .../javaluator/AbstractEvaluator.java | 36 +-- .../utilities/javaluator/BracketPair.java | 2 +- .../utilities/javaluator/Constant.java | 2 +- .../utilities/javaluator/DoubleEvaluator.java | 28 +- .../utilities/javaluator/Function.java | 2 +- .../utilities/javaluator/Operator.java | 10 +- .../utilities/javaluator/Parameters.java | 26 +- .../javaluator/StaticVariableSet.java | 6 +- .../denizen/utilities/javaluator/Token.java | 10 +- .../utilities/javaluator/Tokenizer.java | 6 +- .../denizen/utilities/midi/MidiUtil.java | 12 +- .../utilities/midi/NoteBlockReceiver.java | 8 +- .../denizen/utilities/midi/ToneUtil.java | 2 +- .../denizen/utilities/nbt/LeatherColorer.java | 8 +- .../utilities/nbt/MapOfEnchantments.java | 8 +- .../utilities/packets/PacketHelper.java | 10 +- .../packets/handler/NameplateHandler.java | 18 +- 162 files changed, 1845 insertions(+), 1845 deletions(-) diff --git a/src/main/java/net/aufdemrand/denizen/CommandHandler.java b/src/main/java/net/aufdemrand/denizen/CommandHandler.java index a060594b7f..32f916c311 100644 --- a/src/main/java/net/aufdemrand/denizen/CommandHandler.java +++ b/src/main/java/net/aufdemrand/denizen/CommandHandler.java @@ -40,7 +40,7 @@ public CommandHandler(Citizens plugin) { this.plugin = plugin; } - + /** *

Controls a NPCs Pushable Trait. When a NPC is 'pushable', the NPC * will move out of the way when colliding with another LivingEntity.

@@ -201,7 +201,7 @@ public void assignment(CommandContext args, CommandSender sender, NPC npc) throw if (args.hasValueFlag("set")) { String script = args.getFlag("set").replace("\"", ""); - + if (trait.setAssignment(script, dPlayer.mirrorBukkitPlayer(player))) if (trait.hasAssignment()) Messaging.send(sender, ChatColor.YELLOW + npc.getName() + "'s assignment is now: '" + trait.getAssignment().getName() + "'."); @@ -355,7 +355,7 @@ public void sitting(CommandContext args, CommandSender sender, NPC npc) throws C Messaging.send(sender, ChatColor.RED + npc.getName() + " needs to be a Player type NPC to sit!"); return; } - + if (!npc.hasTrait(SittingTrait.class)) npc.addTrait(SittingTrait.class); SittingTrait trait = npc.getTrait(SittingTrait.class); @@ -390,7 +390,7 @@ public void sitting(CommandContext args, CommandSender sender, NPC npc) throws C min = 1, max = 3, permission = "npc.stand") @Requirements(selected = true, ownership = true) public void standing(CommandContext args, CommandSender sender, NPC npc) throws CommandException { - + if (npc.hasTrait(SittingTrait.class)) { SittingTrait trait = npc.getTrait(SittingTrait.class); if (!trait.isSitting()) { @@ -410,9 +410,9 @@ public void standing(CommandContext args, CommandSender sender, NPC npc) throws trait.stand(); npc.removeTrait(SneakingTrait.class); } - - + + } /* @@ -486,19 +486,19 @@ public void startFishing(CommandContext args, CommandSender sender, NPC npc) thr Messaging.send(sender, ChatColor.RED + npc.getName() + " is already fishing!"); return; } - + if (args.hasFlag('c')) { trait.startFishing(args.getSenderTargetBlockLocation()); } - + if (args.hasFlag('f')) { trait.setCatchFish(true); } - + if (args.hasValueFlag("percent")) { trait.setCatchPercent(args.getFlagInteger("percent")); } - + if (args.hasValueFlag("location")) { String[] argsArray = args.getFlag("location").split(","); if (argsArray.length != 4) { @@ -536,7 +536,7 @@ public void stopFishing(CommandContext args, CommandSender sender, NPC npc) thro trait.stopFishing(); npc.removeTrait(FishingTrait.class); } - + /* * Effect */ @@ -547,22 +547,22 @@ public void stopFishing(CommandContext args, CommandSender sender, NPC npc) thro @Requirements(selected = true, ownership = true) public void playEffect(CommandContext args, CommandSender sender, NPC npc) throws CommandException { if (!npc.hasTrait(ParticlesTrait.class)) npc.addTrait(ParticlesTrait.class); - ParticlesTrait trait = npc.getTrait(ParticlesTrait.class); - + ParticlesTrait trait = npc.getTrait(ParticlesTrait.class); + if (args.hasValueFlag("delay")) { trait.setWait(args.getFlagInteger("delay")); } - + if (args.hasFlag('d')) { trait.setDense(true); } - + if (args.hasValueFlag("play")) { String name = args.getFlag("play"); if (!npc.hasTrait(ParticlesTrait.class)) npc.addTrait(ParticlesTrait.class); - + if (name.equalsIgnoreCase("none")) { - trait.setEffect("NONE"); + trait.setEffect("NONE"); } else if (name.equalsIgnoreCase("flame")) { trait.setEffect("FLAME"); } else if (name.equalsIgnoreCase("ender")) { @@ -578,11 +578,11 @@ public void playEffect(CommandContext args, CommandSender sender, NPC npc) throw } else if (name.equalsIgnoreCase("explosion")) { trait.setEffect("EXPLOSION"); } else Messaging.send(sender, ChatColor.RED + "Not a valid effect name!"); - + } else Messaging.send(sender, ChatColor.RED + "Please specify an effect name!"); - + } - + /* * Sneak */ @@ -596,7 +596,7 @@ public void sneaking(CommandContext args, CommandSender sender, NPC npc) throws Messaging.send(sender, ChatColor.RED + npc.getName() + " needs to be a Player type NPC to sneak!"); return; } - + if (!npc.hasTrait(SneakingTrait.class)) npc.addTrait(SneakingTrait.class); SneakingTrait trait = npc.getTrait(SneakingTrait.class); @@ -980,11 +980,11 @@ public void text(CommandContext args, CommandSender sender, NPC npc) throws Comm // before that, so it needs to be high min = 2, max = 20, permission = "notable.basic") public void addnotable(CommandContext args, CommandSender sender, NPC npc) throws CommandException { - + new dLocation(((Player) sender).getLocation()).rememberAs(args.getString(1)); Messaging.send(sender, "Created new notable called " + (args.getString(1))); } - + @Command( aliases = { "notable" }, usage = "list", desc = "Lists all notables", modifiers = { "list" }, diff --git a/src/main/java/net/aufdemrand/denizen/Denizen.java b/src/main/java/net/aufdemrand/denizen/Denizen.java index 95b47587e9..a2694865c1 100644 --- a/src/main/java/net/aufdemrand/denizen/Denizen.java +++ b/src/main/java/net/aufdemrand/denizen/Denizen.java @@ -98,7 +98,7 @@ public TriggerRegistry getTriggerRegistry() { return triggerRegistry; } - + /* * Denizen Managers */ @@ -139,7 +139,7 @@ public void onEnable() { } else startedSuccessful = true; versionTag = this.getDescription().getVersion(); - + // Startup procedure dB.echoDebug(DebugElement.Footer); dB.echoDebug(ChatColor.YELLOW + " _/_ _ ._ _ _ "); @@ -177,7 +177,7 @@ public void onEnable() { // Create the command script handler for listener WorldScriptHelper ws_helper = new WorldScriptHelper(); - + ItemScriptHelper is_helper = new ItemScriptHelper(); // Register traits diff --git a/src/main/java/net/aufdemrand/denizen/Settings.java b/src/main/java/net/aufdemrand/denizen/Settings.java index fbaadfd091..753cd3f9c7 100644 --- a/src/main/java/net/aufdemrand/denizen/Settings.java +++ b/src/main/java/net/aufdemrand/denizen/Settings.java @@ -6,11 +6,11 @@ public class Settings { /* - + # Whether Denizen should display debug in the console - + */ - + public static boolean ShowDebug() { return DenizenAPI.getCurrentInstance().getConfig() .getBoolean("Debug.Show", false); @@ -20,7 +20,7 @@ public static int ConsoleWidth() { return DenizenAPI.getCurrentInstance().getConfig() .getInt("Debug.Console width", 60); } - + /* # Sets the default speed between execution of commands in queues @@ -30,92 +30,92 @@ public static int ConsoleWidth() { public static String ScriptQueueSpeed() { String delay = DenizenAPI.getCurrentInstance().getConfig() .getString("Scripts.Queue speed", "0.5s"); - + // Check for users setting delay to 0, which will in turn lock up the server try { if (Double.valueOf(delay) < 1) delay = "1t"; } catch (Exception e) { delay = "0.5s"; } - + return delay; } - + /* # Whether scripts in subfolders of the scripts folder should be loaded - + */ - + public static boolean LoadScriptsInSubfolders() { return DenizenAPI.getCurrentInstance().getConfig() .getBoolean("Scripts.Load scripts in subfolders", true); } - + /* - + # Whether the Health trait should be enabled by default - + */ - + public static boolean HealthTraitEnabledByDefault() { return DenizenAPI.getCurrentInstance().getConfig() .getBoolean("Traits.Health.Enabled", false); } - + /* - + # Whether NPCs with the Health trait should respawn after being killed - + */ - + public static boolean HealthTraitRespawnEnabled() { return DenizenAPI.getCurrentInstance().getConfig() .getBoolean("Traits.Health.Respawn.Enabled", true); } - + /* - + # Whether NPCs with the Health trait should have a death animation - + */ - + public static boolean HealthTraitAnimatedDeathEnabled() { return DenizenAPI.getCurrentInstance().getConfig() .getBoolean("Traits.Health.Animated death.Enabled", true); } - + /* - + # How long it should take for NPCs with the Health trait to respawn - + */ - + public static String HealthTraitRespawnDelay() { return DenizenAPI.getCurrentInstance().getConfig() .getString("Traits.Health.Respawn.Delay", "10s"); } - + /* - + # Whether a certain trigger is enabled by default or not - + */ - + public static boolean TriggerEnabled(String triggerName) { return DenizenAPI.getCurrentInstance().getConfig() .getBoolean("Triggers." + String.valueOf(triggerName.charAt(0)).toUpperCase() + triggerName.substring(1).toLowerCase() + ".Enabled", true); } - + /* - + # Default duration of cooldown set to Denizens for when a trigger is # triggered. Not all triggers may use this, it is optional! - + */ - + public static double TriggerDefaultCooldown(String triggerName) { return Duration.valueOf(DenizenAPI.getCurrentInstance().getConfig() .getString("Triggers." + String.valueOf(triggerName.charAt(0)).toUpperCase() + triggerName.substring(1).toLowerCase() + ".Cooldown", "5s")).getSeconds(); } - + /* # This set of nodes defines ranges for different types of @@ -141,8 +141,8 @@ public static String TriggerDefaultCooldownType(String triggerName) { .getString("Triggers." + String.valueOf(triggerName.charAt(0)).toUpperCase() + triggerName.substring(1).toLowerCase() + ".Cooldown Type", "Player"); } - /* - + /* + # If the damage trigger is disabled on an NPC, and the NPC is not # vulnerable, both the right and left clicks can be used to activate # the click trigger. Default setting in versions 0.8+ is 'false', @@ -151,22 +151,22 @@ public static String TriggerDefaultCooldownType(String triggerName) { # # Select true if you would like invulnerable NPCs to use both right # and left clicks to activate the click trigger. - + */ - + public static boolean ClickTriggerAllowsLeftClick() { return DenizenAPI.getCurrentInstance().getConfig() .getBoolean("Triggers.Click.Allows left click", false); } /* - + # Default engage timeout. When NPCs are set to ENGAGE, this is # the default timeout that they will auto-DISENGAGE if not otherwise # specified. (Default, 150 seconds) - + */ - + public static String EngageTimeoutInSeconds() { return DenizenAPI.getCurrentInstance().getConfig() .getString("Commands.Engage.Timeout", "150s"); @@ -183,11 +183,11 @@ public static boolean ChatAsynchronous() { return DenizenAPI.getCurrentInstance().getConfig() .getBoolean("Triggers.Chat.Use asynchronous event", true); } - + /* # The formats in which Chat Trigger input from players appears to - # themselves and to players who can overhear them + # themselves and to players who can overhear them */ @@ -200,7 +200,7 @@ public static String ChatToNpcOverheardFormat() { return DenizenAPI.getCurrentInstance().getConfig() .getString("Triggers.Chat.Formats.Player to NPC overheard", " -> : "); } - + /* # The distance from which a player chatting to an NPC can be overheard @@ -212,14 +212,14 @@ public static double ChatToNpcOverhearingRange() { return DenizenAPI.getCurrentInstance().getConfig() .getDouble("Triggers.Chat.Overhearing range", 4); } - + /* # Prerequisites for triggering a Chat Trigger */ - + public static boolean ChatMustSeeNPC() { return DenizenAPI.getCurrentInstance().getConfig() .getBoolean("Triggers.Chat.Prerequisites.Must be able to see NPC", true); @@ -236,7 +236,7 @@ public static boolean ChatMustLookAtNPC() { # appear in the global chat */ - + public static boolean ChatGloballyIfFailedChatTriggers() { return DenizenAPI.getCurrentInstance().getConfig() .getBoolean("Triggers.Chat.Appears globally.If triggers failed", false); @@ -252,23 +252,23 @@ public static boolean ChatGloballyIfUninteractable() { .getBoolean("Triggers.Chat.Appears globally.If NPC uninteractable", true); } - + ///////////////////// // WORLD SCRIPTS ///////////////// - + /* # Whether the "on player chats" world event should use an # asynchronous Bukkit event or not */ - + public static boolean WorldScriptChatEventAsynchronous() { return DenizenAPI.getCurrentInstance().getConfig() .getBoolean("Scripts.World.Events.On player chats.Use asynchronous event", true); } - + /* # The frequency with which the "on time changes" world script diff --git a/src/main/java/net/aufdemrand/denizen/events/ExhaustedNPCEvent.java b/src/main/java/net/aufdemrand/denizen/events/ExhaustedNPCEvent.java index a051ec46cc..88da99cfff 100644 --- a/src/main/java/net/aufdemrand/denizen/events/ExhaustedNPCEvent.java +++ b/src/main/java/net/aufdemrand/denizen/events/ExhaustedNPCEvent.java @@ -9,7 +9,7 @@ * Bukkit event for when an NPC is exhausted. Exhausted NPCs cannot move * until their hunger level is below maxhunger, as tracked by the HungerTrait * provided by Denizen. - * + * * @author Jeremy Schroeder * */ @@ -21,11 +21,11 @@ public class ExhaustedNPCEvent extends NPCEvent implements Cancellable { public ExhaustedNPCEvent(NPC npc) { super(npc); } - + public HandlerList getHandlers() { return handlers; } - + public static HandlerList getHandlerList() { return handlers; } diff --git a/src/main/java/net/aufdemrand/denizen/events/ReplaceableTagEvent.java b/src/main/java/net/aufdemrand/denizen/events/ReplaceableTagEvent.java index f82e7745e4..3f52a14d79 100644 --- a/src/main/java/net/aufdemrand/denizen/events/ReplaceableTagEvent.java +++ b/src/main/java/net/aufdemrand/denizen/events/ReplaceableTagEvent.java @@ -20,9 +20,9 @@ * <^NAME[CONTEXT].TYPE[CONTEXT].SUBTYPE[CONTEXT].SPECIFIER[CONTEXT]:VALUE || FALLBACK VALUE> * * ^ - Optional. Specifies a QUICKTAG which is wasReplaced upon creation of arguments. - * Used in buildArgs(). If not used, replacement is done in Executer's execute() + * Used in buildArgs(). If not used, replacement is done in Executer's execute() * FALLBACK VALUE is used internally to specify the replace value if nothing else - * is substituted. Must be in '( )'s. + * is substituted. Must be in '( )'s. * * Examples: * diff --git a/src/main/java/net/aufdemrand/denizen/events/SavesReloadEvent.java b/src/main/java/net/aufdemrand/denizen/events/SavesReloadEvent.java index 31f5e3d92b..21abcc30dd 100644 --- a/src/main/java/net/aufdemrand/denizen/events/SavesReloadEvent.java +++ b/src/main/java/net/aufdemrand/denizen/events/SavesReloadEvent.java @@ -5,18 +5,18 @@ /** * Bukkit event for when Denizen 'saves' are reloaded. - * + * * @author Jeremy Schroeder * */ public class SavesReloadEvent extends Event { - + private static final HandlerList handlers = new HandlerList(); public HandlerList getHandlers() { return handlers; } - + public static HandlerList getHandlerList() { return handlers; } diff --git a/src/main/java/net/aufdemrand/denizen/events/ScriptEntryExecuteEvent.java b/src/main/java/net/aufdemrand/denizen/events/ScriptEntryExecuteEvent.java index 7a8c182999..4b78711c17 100644 --- a/src/main/java/net/aufdemrand/denizen/events/ScriptEntryExecuteEvent.java +++ b/src/main/java/net/aufdemrand/denizen/events/ScriptEntryExecuteEvent.java @@ -4,7 +4,7 @@ import org.bukkit.event.Cancellable; import org.bukkit.event.Event; import org.bukkit.event.HandlerList; - + public class ScriptEntryExecuteEvent extends Event implements Cancellable { private static final HandlerList handlers = new HandlerList(); @@ -12,11 +12,11 @@ public class ScriptEntryExecuteEvent extends Event implements Cancellable { private boolean cancelled = false; private boolean altered = false; - + public ScriptEntryExecuteEvent(ScriptEntry scriptEntry) { this.scriptEntry = scriptEntry; } - + public void alterScriptEntry(ScriptEntry scriptEntry) { this.scriptEntry = scriptEntry; altered = true; diff --git a/src/main/java/net/aufdemrand/denizen/events/ScriptFailEvent.java b/src/main/java/net/aufdemrand/denizen/events/ScriptFailEvent.java index 208c38546f..e44cdd07e9 100644 --- a/src/main/java/net/aufdemrand/denizen/events/ScriptFailEvent.java +++ b/src/main/java/net/aufdemrand/denizen/events/ScriptFailEvent.java @@ -2,44 +2,44 @@ import org.bukkit.event.Event; import org.bukkit.event.HandlerList; - + /** * Bukkit event for when a dScript FAIL command is executed. - * + * * @author Jeremy Schroeder * */ public class ScriptFailEvent extends Event { - + private static final HandlerList handlers = new HandlerList(); private String playerName; private String scriptName; private int count; - + public ScriptFailEvent(String playerName, String scriptName, int count) { this.scriptName = scriptName; this.playerName = playerName; this.count = count; } - + public int getCount() { return count; } - + public String getScriptName() { return scriptName; } - + public String getPlayerName() { return playerName; } - + public HandlerList getHandlers() { return handlers; } - + public static HandlerList getHandlerList() { return handlers; } diff --git a/src/main/java/net/aufdemrand/denizen/events/ScriptFinishEvent.java b/src/main/java/net/aufdemrand/denizen/events/ScriptFinishEvent.java index 1220cfc61a..becc5a22f8 100644 --- a/src/main/java/net/aufdemrand/denizen/events/ScriptFinishEvent.java +++ b/src/main/java/net/aufdemrand/denizen/events/ScriptFinishEvent.java @@ -6,7 +6,7 @@ /** * Bukkit event for when a dScript FINISH command is executed. - * + * * @author Jeremy Schroeder * */ @@ -15,29 +15,29 @@ public class ScriptFinishEvent extends Event { private String playerName; private String scriptName; private int count; - + public ScriptFinishEvent(String playerName, String theScript, int count) { this.scriptName = theScript; this.playerName = playerName; this.count = count; } - + public int getCount() { return count; } - + public String getScriptName() { return scriptName; } - + public String getPlayerName() { return playerName; } - + public HandlerList getHandlers() { return handlers; } - + public static HandlerList getHandlerList() { return handlers; } diff --git a/src/main/java/net/aufdemrand/denizen/events/ScriptReloadEvent.java b/src/main/java/net/aufdemrand/denizen/events/ScriptReloadEvent.java index c157f933ed..41deb48aaa 100644 --- a/src/main/java/net/aufdemrand/denizen/events/ScriptReloadEvent.java +++ b/src/main/java/net/aufdemrand/denizen/events/ScriptReloadEvent.java @@ -6,18 +6,18 @@ /** * Bukkit event for when Denizen dScripts are reloaded. This fires * after scripts are reloaded. - * + * * @author Jeremy Schroeder * */ public class ScriptReloadEvent extends Event { - + private static final HandlerList handlers = new HandlerList(); public HandlerList getHandlers() { return handlers; } - + public static HandlerList getHandlerList() { return handlers; } diff --git a/src/main/java/net/aufdemrand/denizen/exceptions/CommandExecutionException.java b/src/main/java/net/aufdemrand/denizen/exceptions/CommandExecutionException.java index 478751dd92..dfcab03d63 100644 --- a/src/main/java/net/aufdemrand/denizen/exceptions/CommandExecutionException.java +++ b/src/main/java/net/aufdemrand/denizen/exceptions/CommandExecutionException.java @@ -9,11 +9,11 @@ public class CommandExecutionException extends Exception { public CommandExecutionException(String msg) { super(msg); } - + public CommandExecutionException(Messages msg, String arg) { super(String.format(msg.toString(), arg)); } - + public CommandExecutionException(Messages msg) { super(msg.toString()); } diff --git a/src/main/java/net/aufdemrand/denizen/exceptions/InvalidArgumentsException.java b/src/main/java/net/aufdemrand/denizen/exceptions/InvalidArgumentsException.java index 7a6ced25bc..6bf885c8a5 100644 --- a/src/main/java/net/aufdemrand/denizen/exceptions/InvalidArgumentsException.java +++ b/src/main/java/net/aufdemrand/denizen/exceptions/InvalidArgumentsException.java @@ -9,11 +9,11 @@ public class InvalidArgumentsException extends Exception { public InvalidArgumentsException(String msg) { super(msg); } - + public InvalidArgumentsException(Messages msg, String arg) { super(String.format(msg.toString(), arg)); } - + public InvalidArgumentsException(Messages msg) { super(msg.toString()); } diff --git a/src/main/java/net/aufdemrand/denizen/exceptions/RequirementCheckException.java b/src/main/java/net/aufdemrand/denizen/exceptions/RequirementCheckException.java index f1f0b7341a..f8d8fc8438 100644 --- a/src/main/java/net/aufdemrand/denizen/exceptions/RequirementCheckException.java +++ b/src/main/java/net/aufdemrand/denizen/exceptions/RequirementCheckException.java @@ -9,11 +9,11 @@ public class RequirementCheckException extends Exception { public RequirementCheckException(String msg) { super(msg); } - + public RequirementCheckException(Messages msg, String arg) { super(String.format(msg.toString(), arg)); } - + public RequirementCheckException(Messages msg) { super(msg.toString()); } diff --git a/src/main/java/net/aufdemrand/denizen/exceptions/ScriptEntryCreationException.java b/src/main/java/net/aufdemrand/denizen/exceptions/ScriptEntryCreationException.java index d2fc448a5a..a185db1ad8 100644 --- a/src/main/java/net/aufdemrand/denizen/exceptions/ScriptEntryCreationException.java +++ b/src/main/java/net/aufdemrand/denizen/exceptions/ScriptEntryCreationException.java @@ -9,11 +9,11 @@ public class ScriptEntryCreationException extends Exception { public ScriptEntryCreationException(String msg) { super(msg); } - + public ScriptEntryCreationException(Messages msg, String arg) { super(String.format(msg.toString(), arg)); } - + public ScriptEntryCreationException(Messages msg) { super(msg.toString()); } diff --git a/src/main/java/net/aufdemrand/denizen/flags/FlagManager.java b/src/main/java/net/aufdemrand/denizen/flags/FlagManager.java index aa66951cb7..0173770647 100644 --- a/src/main/java/net/aufdemrand/denizen/flags/FlagManager.java +++ b/src/main/java/net/aufdemrand/denizen/flags/FlagManager.java @@ -74,7 +74,7 @@ public Flag getPlayerFlag(String playerName, String flagName) { /** * Flag object contains methods for working with Flags and contain a list - * of the values associated with said flag (if existing) and (optionally) an + * of the values associated with said flag (if existing) and (optionally) an * expiration (if existing). * * Storage example in Denizen saves.yml: @@ -90,7 +90,7 @@ public Flag getPlayerFlag(String playerName, String flagName) { * start at 1 and get higher as more items are added. Specifying an index of -1, or, * when possible, supplying NO index will result in retrieving/setting/etc the * item with the highest index. Also, note that when using a FLAG TAG in DSCRIPT, - * ie. , specifying no index will follow suit, that is, the + * ie. , specifying no index will follow suit, that is, the * value with the highest index will be referenced. * */ @@ -216,7 +216,7 @@ public Value getLast() { /** * Sets the value of the most recent value added to the flag. This does - * not create a new value unless the flag is currently empty of values. + * not create a new value unless the flag is currently empty of values. * */ public void set(Object obj) { @@ -252,7 +252,7 @@ else if (index > 0) { /** * Adds a value to the end of the Flag's Values. This value will have an index * of size() + 1. Returns the index of the value added. This could change if - * values are removed. + * values are removed. * */ public int add(Object obj) { @@ -264,7 +264,7 @@ public int add(Object obj) { } /** - * Splits a dScript list into values that are then added to the flag. + * Splits a dScript list into values that are then added to the flag. * Returns the index of the last value added to the flag. * */ @@ -298,7 +298,7 @@ public void remove(Object obj) { * Removes a value from the Flag's current values. If an index is specified, * that specific value is removed. If no index is specified (or -1 is * specified as the index), the first value that matches (values are - * checked as Double and String.equalsIgnoreCase) is removed. If a positive + * checked as Double and String.equalsIgnoreCase) is removed. If a positive * index is specified that does not exist, no removal is done. * */ @@ -414,7 +414,7 @@ else if (npc != null) { /** * Returns a String value of the last item in a Flag Value. If there is only - * a single item in the flag, it returns it. To return the value of another + * a single item in the flag, it returns it. To return the value of another * item in the Flag, use 'flag.get(index).asString()'. * */ @@ -428,7 +428,7 @@ public String toString() { /** * Removes flag if expiration is found to be up. This is called when an action - * is done on the flag, such as get() or put(). If expired, the flag will be + * is done on the flag, such as get() or put(). If expired, the flag will be * erased before moving on. * */ @@ -646,8 +646,8 @@ public int asInteger() { } /** - * Returns a String value of the entirety of the values - * contained as a comma-separated list. If the value doesn't + * Returns a String value of the entirety of the values + * contained as a comma-separated list. If the value doesn't * exist, "" is returned. * */ diff --git a/src/main/java/net/aufdemrand/denizen/interfaces/RegistrationableInstance.java b/src/main/java/net/aufdemrand/denizen/interfaces/RegistrationableInstance.java index 0c474c966e..d353202db3 100644 --- a/src/main/java/net/aufdemrand/denizen/interfaces/RegistrationableInstance.java +++ b/src/main/java/net/aufdemrand/denizen/interfaces/RegistrationableInstance.java @@ -2,21 +2,21 @@ /** * Container interface for instances loaded into a dRegistry. - * + * * @author Jeremy Schroeder * */ public interface RegistrationableInstance { - + public RegistrationableInstance activate(); - + public RegistrationableInstance as(String name); - + public String getName(); - + public void onEnable(); - + public void onDisable(); } diff --git a/src/main/java/net/aufdemrand/denizen/interfaces/dExternal.java b/src/main/java/net/aufdemrand/denizen/interfaces/dExternal.java index a6b8add34f..8b045b8cca 100644 --- a/src/main/java/net/aufdemrand/denizen/interfaces/dExternal.java +++ b/src/main/java/net/aufdemrand/denizen/interfaces/dExternal.java @@ -7,5 +7,5 @@ public interface dExternal { * */ public void load(); - + } diff --git a/src/main/java/net/aufdemrand/denizen/interfaces/dRegistry.java b/src/main/java/net/aufdemrand/denizen/interfaces/dRegistry.java index f60e7c8596..e14fe9f846 100644 --- a/src/main/java/net/aufdemrand/denizen/interfaces/dRegistry.java +++ b/src/main/java/net/aufdemrand/denizen/interfaces/dRegistry.java @@ -5,71 +5,71 @@ /** * Represents a Denizen Instance Registry for the various extensible parts, * including Commands, Requirements, and Activities. - * + * * @author Jeremy Schroeder - * + * */ public interface dRegistry { /** * Called by an AbstractInstance to get added to the registry. - * - * @param registrationName + * + * @param registrationName * The name to use in the registry - * @param commandInstance + * @param commandInstance * A cast (AbstractInstance) of the instance being registered. Usually '(AbstractInstance) this'. - * + * * @return false if an exception has been thrown. - * + * */ public boolean register(String registrationName, RegistrationableInstance commandInstance); /** * Returns a Map of the instances added by the register() method keyed by the registration name. - * + * * @return the entire registry. - * + * */ public Map list(); /** * Gets a specific instance of AbstractInstance that has been previously registered. - * - * @param clazz + * + * @param clazz * class of the requested AbstractInstance. - * + * * @return the instance of the class specified. - * + * */ public T get(Class clazz); /** * Gets a specific instance of AbstractInstance that has been previously registered. - * + * * @param instanceKey * string key in which the AbstractInstance was registered with. - * + * * @return the instance of the key specified. - * + * */ public RegistrationableInstance get(String instanceKey); /** * Generic method for registering the core classes of this registry's type - * + * */ public void registerCoreMembers(); - + /** * Calls an onDisable method on all registered instances. - * + * */ public void disableCoreMembers(); - + } diff --git a/src/main/java/net/aufdemrand/denizen/listeners/AbstractListener.java b/src/main/java/net/aufdemrand/denizen/listeners/AbstractListener.java index f045480b3f..ad447dc3ab 100644 --- a/src/main/java/net/aufdemrand/denizen/listeners/AbstractListener.java +++ b/src/main/java/net/aufdemrand/denizen/listeners/AbstractListener.java @@ -172,10 +172,10 @@ public void save() { deconstructed(); } - + /** * Stores a field away for retrieving later. Should be used in the onSave() method. - * + * */ public void store(String key, Object object) { savable.put(key, object); diff --git a/src/main/java/net/aufdemrand/denizen/listeners/AbstractListenerType.java b/src/main/java/net/aufdemrand/denizen/listeners/AbstractListenerType.java index e78e8d3a30..daeb1d197c 100644 --- a/src/main/java/net/aufdemrand/denizen/listeners/AbstractListenerType.java +++ b/src/main/java/net/aufdemrand/denizen/listeners/AbstractListenerType.java @@ -12,7 +12,7 @@ public abstract class AbstractListenerType implements RegistrationableInstance { Denizen denizen; String name; Class instanceClass; - + @Override public AbstractListenerType activate() { this.denizen = (Denizen) Bukkit.getServer().getPluginManager().getPlugin("Denizen"); @@ -46,24 +46,24 @@ public AbstractListener createInstance(dPlayer player, String listenerId) { public String getName() { return this.name; } - + /** * Part of the Plugin disable sequence. - * + * * Can be '@Override'n by a Listener which requires a method when bukkit sends a * onDisable() to Denizen. (ie. Server shuts down or restarts) - * + * */ public void onDisable() { - + } - + public AbstractListenerType withClass(Class listenerInstanceClass) { this.instanceClass = listenerInstanceClass; return null; } - + } diff --git a/src/main/java/net/aufdemrand/denizen/listeners/core/BlockListenerInstance.java b/src/main/java/net/aufdemrand/denizen/listeners/core/BlockListenerInstance.java index f00f228c96..3d7976e227 100644 --- a/src/main/java/net/aufdemrand/denizen/listeners/core/BlockListenerInstance.java +++ b/src/main/java/net/aufdemrand/denizen/listeners/core/BlockListenerInstance.java @@ -24,23 +24,23 @@ public class BlockListenerInstance extends AbstractListener implements Listener { public static enum BlockType { BUILD, COLLECT, BREAK } - + // //The type of action // BlockType type = null; - + // //The blocks // dList blocks; - + // //The counters // Integer required = 1; Integer blocks_so_far = 0; - + // //Modifiers // @@ -52,10 +52,10 @@ public static enum BlockType { BUILD, COLLECT, BREAK } public void onBuild(List args) { for (aH.Argument arg : args) { - + if (arg.matchesEnum(BlockType.values()) && type == null) type = BlockType.valueOf(arg.getValue().toUpperCase()); - + else if (arg.matchesPrefix("qty, q") && arg.matchesPrimitive(aH.PrimitiveType.Integer)) this.required = aH.getIntegerFrom(arg.getValue()); @@ -66,12 +66,12 @@ else if (arg.matchesPrefix("region, r")) else if (arg.matchesPrefix("cuboid, c") && arg.matchesArgumentType(dCuboid.class)) this.cuboid = arg.asType(dCuboid.class); - + else if (arg.matchesPrefix("blocks, block, b, name, names")) blocks = arg.asType(dList.class); - + } - + if (blocks == null) blocks = new dList("*"); @@ -128,7 +128,7 @@ public void deconstructed() { PlayerPickupItemEvent.getHandlerList().unregister(this); BlockPlaceEvent.getHandlerList().unregister(this); } - + public void check() { if (blocks_so_far >= required) { finish(); @@ -139,15 +139,15 @@ public void check() { public void listenBreak(BlockBreakEvent event) { //Check if event references proper player. if (event.getPlayer() != player.getPlayerEntity()) return; - + //Check if region is specified, and if so, is the player in it. if (region != null) if (!WorldGuardUtilities.inRegion(player.getPlayerEntity().getLocation(), region)) return; - + // Same with the CUBOID argument... if (cuboid != null) if (!cuboid.isInsideCuboid(player.getLocation())) return; - + //Type BREAK if (type == BlockType.BREAK) { //If the block matches, count it!! @@ -171,12 +171,12 @@ public void listenCollect(PlayerPickupItemEvent event) { //Check if region is specified, and if so, is the player in it. if (region != null) if (!WorldGuardUtilities.inRegion(player.getPlayerEntity().getLocation(), region)) return; - + // Same with the CUBOID argument... if (cuboid != null) if (!cuboid.isInsideCuboid(player.getLocation())) return; - - //Type COLLECT + + //Type COLLECT if (type == BlockType.COLLECT) { //If the block matches, count it!! if (blocks.contains(event.getItem().getItemStack().getType().name().toLowerCase()) @@ -186,14 +186,14 @@ public void listenCollect(PlayerPickupItemEvent event) { if (itemsCollected.contains(event.getItem().getEntityId())) return; else itemsCollected.add(event.getItem().getEntityId()); - + blocks_so_far = blocks_so_far + event.getItem().getItemStack().getAmount(); dB.echoDebug(ChatColor.YELLOW + "// " + player.getName() + " collected a " + event.getItem().getItemStack().getType().toString() + "."); check(); } } } - + @EventHandler public void listenBucket(PlayerBucketFillEvent event) { //Check if event references proper player. @@ -202,11 +202,11 @@ public void listenBucket(PlayerBucketFillEvent event) { //Check if region is specified, and if so, is the player in it. if (region != null) if (!WorldGuardUtilities.inRegion(player.getPlayerEntity().getLocation(), region)) return; - + // Same with the CUBOID argument... if (cuboid != null) if (!cuboid.isInsideCuboid(player.getLocation())) return; - + //Type COLLECT if (type == BlockType.COLLECT) { //If the block matches, count it!! @@ -229,19 +229,19 @@ public void listenPlace(BlockPlaceEvent event) { //Check if region is specified, and if so, is the player in it. if (region != null) if (!WorldGuardUtilities.inRegion(player.getPlayerEntity().getLocation(), region)) return; - + // Same with the CUBOID argument... if (cuboid != null) if (!cuboid.isInsideCuboid(player.getLocation())) return; - + //Type BUILD if (type == BlockType.BUILD) { - + //If the block matches, count it!! if (blocks.contains(event.getBlock().getType().name().toLowerCase()) || blocks.contains(String.valueOf(event.getBlock().getTypeId())) || blocks.contains("*")) { - + //If a block has already been placed at that location, dont count it. if (blocksPlaced.contains(event.getBlock().getLocation())) return; @@ -252,25 +252,25 @@ public void listenPlace(BlockPlaceEvent event) { } } } - + @EventHandler public void listenTag(ReplaceableTagEvent event) { - + if (!event.matches("LISTENER")) return; if (!event.getType().equalsIgnoreCase(id)) return; - + if (event.getValue().equalsIgnoreCase("region")) { event.setReplaced(region); } - + else if (event.getValue().equalsIgnoreCase("required")) { event.setReplaced(required.toString()); } - + else if (event.getValue().equalsIgnoreCase("blocks_so_far")) { event.setReplaced(blocks_so_far.toString()); } - + else if (event.getValue().equalsIgnoreCase("blocks")) { String blockList = ""; for (String curTar : blocks){ diff --git a/src/main/java/net/aufdemrand/denizen/listeners/core/BlockListenerType.java b/src/main/java/net/aufdemrand/denizen/listeners/core/BlockListenerType.java index 460352e757..f8ae5442e2 100644 --- a/src/main/java/net/aufdemrand/denizen/listeners/core/BlockListenerType.java +++ b/src/main/java/net/aufdemrand/denizen/listeners/core/BlockListenerType.java @@ -3,7 +3,7 @@ import net.aufdemrand.denizen.listeners.AbstractListenerType; public class BlockListenerType extends AbstractListenerType{ - + @Override public void onEnable() { //nothing to do here diff --git a/src/main/java/net/aufdemrand/denizen/listeners/core/ItemDropListenerInstance.java b/src/main/java/net/aufdemrand/denizen/listeners/core/ItemDropListenerInstance.java index 1c32fd1074..a73fa1677d 100644 --- a/src/main/java/net/aufdemrand/denizen/listeners/core/ItemDropListenerInstance.java +++ b/src/main/java/net/aufdemrand/denizen/listeners/core/ItemDropListenerInstance.java @@ -21,32 +21,32 @@ import net.aufdemrand.denizen.utilities.depends.WorldGuardUtilities; public class ItemDropListenerInstance extends AbstractListener implements Listener { - + ItemDropType type = null; - + ItemStack item = null; Location location = null; Material block = null; EntityType mob = null; - + String dropper = null; String region = null; - + Integer radius = 5; Integer dropRate = 100; Integer quantity = 1; Integer qtyDropped = 0; - + @Override public void constructed() { denizen.getServer().getPluginManager().registerEvents(this, denizen); - + } @Override public void deconstructed() { EntityDeathEvent.getHandlerList().unregister(this); - + } @Override @@ -130,13 +130,13 @@ public void onBuild(List args) { @Override public void onCancel() { // nothing to do here - + } @Override public void onFinish() { // nothing to do here - + } @Override @@ -153,7 +153,7 @@ public void onLoad() { quantity = (Integer) get("required"); qtyDropped = (Integer) get("qtyDropped"); //r = (Random) get("r"); - + } @Override @@ -186,7 +186,7 @@ public String report() { } return null; } - + @EventHandler public void mobKilled(EntityDeathEvent event) { if (type != ItemDropType.MOBKILL) return; @@ -203,7 +203,7 @@ public void mobKilled(EntityDeathEvent event) { if (!WorldGuardUtilities.inRegion(player.getPlayerEntity().getLocation(), region)) return; } dB.echoDebug("...within region"); - + dB.echoDebug("...trying to drop item"); if (Utilities.getRandom().nextInt(101) < dropRate) { dB.echoDebug("...item should drop now"); @@ -213,7 +213,7 @@ public void mobKilled(EntityDeathEvent event) { check(); } } - + @EventHandler public void blockMined(BlockBreakEvent event) { if (type != ItemDropType.BLOCKBREAK) return; @@ -230,7 +230,7 @@ public void blockMined(BlockBreakEvent event) { if (!WorldGuardUtilities.inRegion(player.getPlayerEntity().getLocation(), region)) return; } dB.echoDebug("...within region"); - + if (Utilities.getRandom().nextInt(101) < dropRate) { event.getBlock().getWorld().dropItem(event.getBlock().getLocation(), item); qtyDropped++; @@ -238,7 +238,7 @@ public void blockMined(BlockBreakEvent event) { check(); } } - + @EventHandler public void blockPlaced(BlockPlaceEvent event) { if (type != ItemDropType.BLOCKPLACE) return; @@ -255,7 +255,7 @@ public void blockPlaced(BlockPlaceEvent event) { if (!WorldGuardUtilities.inRegion(player.getPlayerEntity().getLocation(), region)) return; } dB.echoDebug("...within region"); - + if (Utilities.getRandom().nextInt(101) < dropRate) { event.getBlock().getWorld().dropItem(event.getBlock().getLocation(), item); qtyDropped++; @@ -263,7 +263,7 @@ public void blockPlaced(BlockPlaceEvent event) { check(); } } - + private void check() { dB.echoDebug(qtyDropped + "/" + quantity + " dropped"); if (quantity.equals(qtyDropped)) { diff --git a/src/main/java/net/aufdemrand/denizen/listeners/core/ItemDropListenerType.java b/src/main/java/net/aufdemrand/denizen/listeners/core/ItemDropListenerType.java index 291d16a2dd..2a69d4416a 100644 --- a/src/main/java/net/aufdemrand/denizen/listeners/core/ItemDropListenerType.java +++ b/src/main/java/net/aufdemrand/denizen/listeners/core/ItemDropListenerType.java @@ -3,13 +3,13 @@ import net.aufdemrand.denizen.listeners.AbstractListenerType; public class ItemDropListenerType extends AbstractListenerType { - + enum ItemDropType { MOBKILL, BLOCKBREAK, BLOCKPLACE } - + @Override public void onEnable() { // TODO Auto-generated method stub - + } } diff --git a/src/main/java/net/aufdemrand/denizen/listeners/core/ItemListenerInstance.java b/src/main/java/net/aufdemrand/denizen/listeners/core/ItemListenerInstance.java index 96d806f149..4bbbb265b5 100644 --- a/src/main/java/net/aufdemrand/denizen/listeners/core/ItemListenerInstance.java +++ b/src/main/java/net/aufdemrand/denizen/listeners/core/ItemListenerInstance.java @@ -25,27 +25,27 @@ public class ItemListenerInstance extends AbstractListener implements Listener { public enum ItemType { CRAFT, SMELT, FISH } ItemType type = null; - + dList items; - + int required = 0; int items_so_far = 0; - + String region = null; dCuboid cuboid = null; - + @Override public void onBuild(List args) { - + for (aH.Argument arg : args) { - + if (arg.matchesEnum(ItemType.values()) && type == null) this.type = ItemType.valueOf(arg.getValue().toUpperCase()); - + else if (arg.matchesPrefix("qty, q") && arg.matchesPrimitive(aH.PrimitiveType.Integer)) this.required = aH.getIntegerFrom(arg.getValue()); - + else if (arg.matchesPrefix("items, item, i, name, names")) items = arg.asType(dList.class); @@ -56,7 +56,7 @@ else if (arg.matchesPrefix("cuboid, c") && arg.matchesArgumentType(dCuboid.class)) this.cuboid = arg.asType(dCuboid.class); } - + if (items == null) items = new dList("*"); @@ -65,7 +65,7 @@ else if (arg.matchesPrefix("cuboid, c") cancel(); } } - + public void increment(String object, int amount) { items_so_far = items_so_far + amount; dB.echoDebug(ChatColor.YELLOW + "// " + player.getName() + " " + @@ -75,19 +75,19 @@ public void increment(String object, int amount) { @EventHandler public void listenItem(InventoryClickEvent event) { - + // Proceed if the slot clicked is a RESULT slot and the player is the right one if (event.getSlotType().toString().equals("RESULT") - && event.getWhoClicked() == player.getPlayerEntity()) { + && event.getWhoClicked() == player.getPlayerEntity()) { // If REGION argument specified, check. If not in region, don't count kill! if (region != null) if (!WorldGuardUtilities.inRegion(player.getLocation(), region)) return; - + // Same with the CUBOID argument... if (cuboid != null) if (!cuboid.isInsideCuboid(player.getLocation())) return; - + // Put the type of this inventory in a string and check if it matches the // listener's type String inventoryType = event.getInventory().getType().toString(); @@ -96,17 +96,17 @@ public void listenItem(InventoryClickEvent event) { // Get the item in the result slot as an ItemStack final ItemStack item = new ItemStack(event.getCurrentItem()); - + //if item isn't a required item, then return if (!items.contains(item.getType().name().toLowerCase()) && !items.contains(item.getTypeId()) && !items.contains("*")) return; - + if (event.isShiftClick()) { // Save the quantity of items of this type that the player had // before the event took place final int initialQty = new dInventory(player.getPlayerEntity().getInventory()).count(item, false); - + // Run a task 1 tick later, after the event has occurred, and // see how many items of this type the player has then in the // inventory @@ -116,14 +116,14 @@ public void listenItem(InventoryClickEvent event) { public void run() { int newQty = new dInventory(player.getPlayerEntity().getInventory()).count(item, false); int difference = newQty - initialQty; - + // If any items were obtained (i.e. if shift click was // used with the player's inventory not being full), // increase the number of current items if (difference > 0) { increment(item.getType().toString(), difference); } - + } }, 1); } else { @@ -131,7 +131,7 @@ public void run() { // by the quantity of the item in the result slot increment(item.getType().toString(), item.getAmount()); } - + } } } @@ -144,7 +144,7 @@ public void listenFish(PlayerFishEvent event) { // If REGION argument specified, check. If not in region, don't count kill! if (region != null) if (!WorldGuardUtilities.inRegion(player.getLocation(), region)) return; - + // Same with the CUBOID argument... if (cuboid != null) if (!cuboid.isInsideCuboid(player.getLocation())) return; @@ -152,7 +152,7 @@ public void listenFish(PlayerFishEvent event) { if (event.getState().toString().equals("CAUGHT_FISH")) increment("FISH", 1); } - + @Override public void onSave() { try { @@ -177,7 +177,7 @@ public void onLoad() { items_so_far = (Integer) get("Quantity Done"); region = (String) get("Region"); cuboid = dCuboid.valueOf((String) get("Cuboid")); - } catch (Exception e) { + } catch (Exception e) { dB.echoError("Unable to load ITEM listener for '%s'!", player.getName()); cancel(); } @@ -195,10 +195,10 @@ public void check() { finish(); } } - + @Override public void onCancel() { - + } @Override @@ -210,7 +210,7 @@ public String report() { @Override public void constructed() { - denizen.getServer().getPluginManager().registerEvents(this, denizen); + denizen.getServer().getPluginManager().registerEvents(this, denizen); } @Override diff --git a/src/main/java/net/aufdemrand/denizen/listeners/core/ItemListenerType.java b/src/main/java/net/aufdemrand/denizen/listeners/core/ItemListenerType.java index 9b29ca8e0f..970f4ddbe0 100644 --- a/src/main/java/net/aufdemrand/denizen/listeners/core/ItemListenerType.java +++ b/src/main/java/net/aufdemrand/denizen/listeners/core/ItemListenerType.java @@ -3,9 +3,9 @@ import net.aufdemrand.denizen.listeners.AbstractListenerType; public class ItemListenerType extends AbstractListenerType { - + @Override public void onEnable() { - + } } diff --git a/src/main/java/net/aufdemrand/denizen/listeners/core/KillListenerInstance.java b/src/main/java/net/aufdemrand/denizen/listeners/core/KillListenerInstance.java index 8c7ecd928e..c8733a6cbc 100644 --- a/src/main/java/net/aufdemrand/denizen/listeners/core/KillListenerInstance.java +++ b/src/main/java/net/aufdemrand/denizen/listeners/core/KillListenerInstance.java @@ -173,7 +173,7 @@ public void listen(EntityDeathEvent event) { // If REGION argument specified, check. If not in region, don't count kill! if (region != null) if (!WorldGuardUtilities.inRegion(player.getLocation(), region)) return; - + // Same with the CUBOID argument... if (cuboid != null) if (!cuboid.isInsideCuboid(player.getLocation())) return; diff --git a/src/main/java/net/aufdemrand/denizen/listeners/core/TravelListenerType.java b/src/main/java/net/aufdemrand/denizen/listeners/core/TravelListenerType.java index 5eb0d2260d..5dcc857004 100644 --- a/src/main/java/net/aufdemrand/denizen/listeners/core/TravelListenerType.java +++ b/src/main/java/net/aufdemrand/denizen/listeners/core/TravelListenerType.java @@ -3,7 +3,7 @@ import net.aufdemrand.denizen.listeners.AbstractListenerType; public class TravelListenerType extends AbstractListenerType { - + @Override public void onEnable() { // nothing to do here diff --git a/src/main/java/net/aufdemrand/denizen/npc/traits/FishingTrait.java b/src/main/java/net/aufdemrand/denizen/npc/traits/FishingTrait.java index f3a8cd19ca..60ed7f7615 100644 --- a/src/main/java/net/aufdemrand/denizen/npc/traits/FishingTrait.java +++ b/src/main/java/net/aufdemrand/denizen/npc/traits/FishingTrait.java @@ -28,58 +28,58 @@ public class FishingTrait extends Trait { private boolean fishing = false; @Persist("catch fish") private boolean catchFish = false; - + @Persist("fishing spot") private Location fishingLocation = null; - + ArrayList available = new ArrayList(); EntityHuman eh = null; WorldServer nmsworld = null; Location fishingSpot = null; EntityFishingHook fishHook = null; EntityItem fish = null; - + @Persist("catch chance") int catchPercent = 65; - + int reelCount = 100; int castCount = 0; - + @Override public void run() { reelCount++; castCount++; - - if(fish != null) + + if(fish != null) if(fish.getBukkitEntity().getLocation().distance(npc.getBukkitEntity().getLocation())<3) { try{ fish.getBukkitEntity().remove(); } catch(Exception e) { } } - + if(reelCount == 400) { reel(); reelCount = 0; castCount = 325; } - + if(castCount == 400) { cast(); castCount = 0; } } - + @Override public void onSpawn() { eh = ((CraftPlayer) npc.getBukkitEntity()).getHandle(); nmsworld = ((CraftWorld) npc.getBukkitEntity().getWorld()).getHandle(); } - + /** * Makes the NPC fish at the specified location - * + * * TODO Reimplement variance, so each cast doesn't land in the exact same spot. - * + * * @param location */ public void startFishing(Location location) { @@ -88,7 +88,7 @@ public void startFishing(Location location) { cast(); fishing = true; } - + /** * Makes the stop fishing. */ @@ -96,24 +96,24 @@ public void stopFishing() { DenizenAPI.getDenizenNPC(npc).action("stop fishing", null); reel(); - + fishingLocation = null; fishing = false; } - + /** * Makes the NPC fish in the nearest water - * + * * TODO Needs logic for handling that. */ public void startFishing() { fishing = true; fishingLocation = npc.getBukkitEntity().getLocation(); } - + private void cast() { DenizenAPI.getDenizenNPC(npc).action("cast fishing rod", null); - + if(fishingLocation == null) { dB.echoError("Fishing location not found!"); return; @@ -138,7 +138,7 @@ private void cast() { Vector victor = to.clone().subtract(from).toVector(); Double dist = Math.sqrt(Math.pow(victor.getX(), 2) + Math.pow(victor.getZ(), 2)); elev = victor.getY(); - + if (dist == 0) return; @@ -147,7 +147,7 @@ private void cast() { return; victor.setY(Math.tan(launchAngle) * dist); victor = normalizeVector(victor); - v = v + (.5 * Math.pow(hangtime, 2)); + v = v + (.5 * Math.pow(hangtime, 2)); //Random rand = new Random(1234); v = v+ (Utilities.getRandom().nextDouble() - .8)/2; victor = victor.multiply(v / 20.0); @@ -155,19 +155,19 @@ private void cast() { Projectile theHook = (Projectile) fishHook.getBukkitEntity(); theHook.setShooter(npc.getBukkitEntity()); theHook.setVelocity(victor); - - PlayerAnimation.ARM_SWING.play((Player) npc.getBukkitEntity()); + + PlayerAnimation.ARM_SWING.play((Player) npc.getBukkitEntity()); } - + private void reel() { DenizenAPI.getDenizenNPC(npc).action("reel in fishing rod", null); - + int chance = (int)(Math.random()*100); - + try{ fishHook.getBukkitEntity().remove(); } catch(Exception e){ } - + if (chance>catchPercent && fishHook != null && catchFish) { try{ fish.getBukkitEntity().remove(); @@ -185,29 +185,29 @@ private void reel() { nmsworld.addEntity(fish); DenizenAPI.getDenizenNPC(npc).action("catch fish", null); } - + PlayerAnimation.ARM_SWING.play((Player) npc.getBukkitEntity()); } - + /** * Checks if the NPC is currently fishing - * + * * @return boolean */ public boolean isFishing() { return fishing; } - + /** * Gets the location the NPC is casting to * Returns null if the NPC isn't fishing - * + * * @return Location */ public Location getFishingLocation() { return fishingLocation; } - + public FishingTrait() { super("fishing"); } @@ -234,18 +234,18 @@ public static double hangtime(double launchAngle, double v, double elev, double return (a + Math.sqrt(Math.pow(a, 2) + b)) / g; } - + public static Vector normalizeVector(Vector victor){ double mag = Math.sqrt(Math.pow(victor.getX(), 2) + Math.pow(victor.getY(), 2) + Math.pow(victor.getZ(), 2)); - if (mag !=0) + if (mag !=0) return victor.multiply(1/mag); return victor.multiply(0); } - + public void setCatchFish(Boolean catchFish) { this.catchFish = catchFish; } - + public void setCatchPercent(int catchPercent) { this.catchPercent = catchPercent; } diff --git a/src/main/java/net/aufdemrand/denizen/npc/traits/InvisibleTrait.java b/src/main/java/net/aufdemrand/denizen/npc/traits/InvisibleTrait.java index 2daf49dbc9..7397910dfb 100644 --- a/src/main/java/net/aufdemrand/denizen/npc/traits/InvisibleTrait.java +++ b/src/main/java/net/aufdemrand/denizen/npc/traits/InvisibleTrait.java @@ -20,7 +20,7 @@ public InvisibleTrait() { } public void setInvisible(boolean invisible) { - + this.invisible = invisible; if (invisible) setInvisible(); else if (npc.isSpawned()) diff --git a/src/main/java/net/aufdemrand/denizen/npc/traits/NameplateTrait.java b/src/main/java/net/aufdemrand/denizen/npc/traits/NameplateTrait.java index 4bb90f6b60..19c06e5dce 100644 --- a/src/main/java/net/aufdemrand/denizen/npc/traits/NameplateTrait.java +++ b/src/main/java/net/aufdemrand/denizen/npc/traits/NameplateTrait.java @@ -24,11 +24,11 @@ *

Adds the ability to change the nameplate (aka nametag) above a NPC's head and * add colors like red, green, blue and gold. Special cases like the magic color * are also being supported

- * + * *

Once an NPC with the nameplate trait is being spawned (or the nameplate is * being changed by commands) the server checks against the specific packet and * modifies it.

- * + * *

Please mind that the nameplates can only be 16 characters long, * including the color codes!

*/ @@ -81,7 +81,7 @@ public void setColor(ChatColor color, String player) { /** * Returns the {@link ChatColor} prefixed to the nameplate - * + * * @return The stored {@link ChatColor} */ public ChatColor getColor() { @@ -93,7 +93,7 @@ public ChatColor getColor() { /** * Returns the {@link ChatColor} prefixed to the nameplate for a specific * player. - * + * * @param player The player name * @return The stored {@link ChatColor} for the specific player */ @@ -101,93 +101,93 @@ public ChatColor getColor(String player) { if(!colors.containsKey(player)) return getColor(); else return ChatColor.valueOf(colors.get(player)); } - + /** * Returns true if a color has been set - * + * * @return True if set, otherwise false */ public boolean hasColor() { return getColor() != null; } - + /** * Returns true if a color has been set for this player - * + * * @param player The player name to check * @return True if set, otherwise false */ public boolean hasColor(String player) { return getColor(player) != null; } - + /** * Retrieve the trimmed nameplate including the set color (max. 16 chars). - * + * * @return The trimmed nameplate including color */ public String getTrimmedTag() { return getTrimmedTag(DEFAULT_KEY); } - + /** * Retrieve the trimmed nameplate including the set color (max. 16 chars) for * the specific player. - * + * * @param player The player name * @return The trimmed nameplate including color */ public String getTrimmedTag(String player) { String tag = getNPC().getName(); ChatColor c = getColor(player); - + if(c != null) tag = c + tag; if(tag.length() > 16) tag = tag.substring(0, 16); - + return tag; } public void refreshTag(NPC npc) { if( Depends.protocolManager == null || !npc.isSpawned() ) return; - + int maxDistance = Bukkit.getServer().getViewDistance() * 16; List viewers = new ArrayList(); - + for (Player p : getPlayersInRadius(npc, maxDistance)) { if( p.getEntityId() == npc.getBukkitEntity().getEntityId() ) continue; - + viewers.add(p); } - + refreshTag(npc, viewers); } - + private void refreshTag(NPC npc, List players) { Entity npcEntity = npc.getBukkitEntity(); - + if(npcEntity != null) { Depends.protocolManager.updateEntity(npcEntity, players); } } - + private List getPlayersInRadius( NPC npc, int distance ) { List players = new ArrayList(); int dSquared = distance * distance; - + Location loc = npc.getBukkitEntity().getLocation(); World world = npc.getBukkitEntity().getWorld(); - + for ( Player p : Bukkit.getServer().getOnlinePlayers()) { if( p.getWorld() != world) continue; - + if( p.getLocation().distanceSquared(loc) <= dSquared) { players.add(p); } } - + return players; } - - + + } diff --git a/src/main/java/net/aufdemrand/denizen/npc/traits/NicknameTrait.java b/src/main/java/net/aufdemrand/denizen/npc/traits/NicknameTrait.java index a380e66336..ee342b36f2 100644 --- a/src/main/java/net/aufdemrand/denizen/npc/traits/NicknameTrait.java +++ b/src/main/java/net/aufdemrand/denizen/npc/traits/NicknameTrait.java @@ -56,11 +56,11 @@ public String getNickname() { else return DenizenAPI.getCurrentInstance().tagManager() .tag(null, DenizenAPI.getDenizenNPC(npc), nickname, false); } - + /** * Gets the current nickname of this NPC and strips out all text colors. * To get the colored nickname use {@link #getNickname()}. - * + * * @return The uncolored nickname for this NPC */ public String getUncoloredNickname() { diff --git a/src/main/java/net/aufdemrand/denizen/npc/traits/ParticlesTrait.java b/src/main/java/net/aufdemrand/denizen/npc/traits/ParticlesTrait.java index 26101f51be..e5616156d6 100644 --- a/src/main/java/net/aufdemrand/denizen/npc/traits/ParticlesTrait.java +++ b/src/main/java/net/aufdemrand/denizen/npc/traits/ParticlesTrait.java @@ -14,43 +14,43 @@ import org.bukkit.entity.Wolf; public class ParticlesTrait extends Trait { - + public enum EffectType { NONE, SMOKE, FLAME, ENDER, POTBREAK, HEART, POTION, EXPLOSION } - + //DataWatcher dw; //EntityLiving el; - + Denizen denizen = DenizenAPI.getCurrentInstance(); World world; - + @Persist("effect type") EffectType effectType = EffectType.NONE; - + @Persist("particle delay") int wait = 10; - + @Persist("dense") Boolean dense = false; - + int counter = 0; //int c = 0; int tempcounter = 0; - + @Override public void run() { if (world == null) { return; } - + if (effectType == null) { effectType = EffectType.NONE; } - + if (tempcounter > 20) { dB.log("current effect: " + effectType.name()); } counter++; - + switch (effectType) { case NONE: break; @@ -103,39 +103,39 @@ public void run() { } break; } - - + + } - + @Override public void onSpawn() { //el = ((CraftLivingEntity)npc.getBukkitEntity()).getHandle(); //dw = el.getDataWatcher(); world = npc.getBukkitEntity().getWorld(); } - + public void playFlameEffect() { Location location = npc.getBukkitEntity().getLocation(); world.playEffect(location, Effect.MOBSPAWNER_FLAMES, 0); if (dense) world.playEffect(location.add(0, 1, 0), Effect.MOBSPAWNER_FLAMES, 0); } - + public void playEnderEffect() { Location location = npc.getBukkitEntity().getLocation(); world.playEffect(location, Effect.ENDER_SIGNAL, 0); if (dense) world.playEffect(location.add(0, 1, 0), Effect.ENDER_SIGNAL, 0); } - + public void playPotionEffect() { //dw.watch(8, Integer.valueOf(2)); } - + public void playPotionBreakEffect() { Location location = npc.getBukkitEntity().getLocation(); world.playEffect(location, Effect.POTION_BREAK, 0); if (dense) world.playEffect(location.add(0, 1, 0), Effect.POTION_BREAK, 0); } - + public void playHeartEffect() { Location location = npc.getBukkitEntity().getLocation(); Wolf tempWolf = (Wolf) world.spawn(location, Wolf.class); @@ -144,7 +144,7 @@ public void playHeartEffect() { if (dense) tempWolf.playEffect(EntityEffect.WOLF_HEARTS); tempWolf.remove(); } - + public void playSmokeEffect() { Location location = npc.getBukkitEntity().getLocation(); world.playEffect(location, Effect.SMOKE, 0); @@ -156,7 +156,7 @@ public void playSmokeEffect() { world.playEffect(location, Effect.SMOKE, 6); world.playEffect(location, Effect.SMOKE, 7); world.playEffect(location, Effect.SMOKE, 8); - if (dense) { + if (dense) { world.playEffect(location.add(0, 1, 0), Effect.SMOKE, 0); world.playEffect(location.add(0, 1, 0), Effect.SMOKE, 1); world.playEffect(location.add(0, 1, 0), Effect.SMOKE, 2); @@ -173,19 +173,19 @@ public void playExplosionEffect() { Location location = npc.getBukkitEntity().getLocation(); world.createExplosion(location, 0); } - + public void setEffect(String effectType) { this.effectType = EffectType.valueOf(effectType.toUpperCase()); } - + public void setWait(Integer ticks) { wait = ticks; } - + public ParticlesTrait() { super("particles"); } - + public void setDense (Boolean dense) { this.dense = dense; } diff --git a/src/main/java/net/aufdemrand/denizen/npc/traits/PushableTrait.java b/src/main/java/net/aufdemrand/denizen/npc/traits/PushableTrait.java index ab26a223d9..6c259d414a 100644 --- a/src/main/java/net/aufdemrand/denizen/npc/traits/PushableTrait.java +++ b/src/main/java/net/aufdemrand/denizen/npc/traits/PushableTrait.java @@ -142,7 +142,7 @@ public void NPCPush (NPCPushEvent event) { * * @param event */ - @EventHandler + @EventHandler public void NPCCompleteDestination (NavigationCompleteEvent event) { if (event.getNPC() == npc && pushed) { EntityLiving handle = ((CraftLivingEntity) npc.getBukkitEntity()).getHandle(); diff --git a/src/main/java/net/aufdemrand/denizen/npc/traits/SittingTrait.java b/src/main/java/net/aufdemrand/denizen/npc/traits/SittingTrait.java index d70c4dc8a4..8a50478538 100644 --- a/src/main/java/net/aufdemrand/denizen/npc/traits/SittingTrait.java +++ b/src/main/java/net/aufdemrand/denizen/npc/traits/SittingTrait.java @@ -16,27 +16,27 @@ import org.bukkit.event.block.BlockBreakEvent; public class SittingTrait extends Trait implements Listener { - + @Persist("sitting") private boolean sitting = false; - + @Persist("chair location") private Location chairLocation = null; - + EntityHuman eh = null; - + @Override public void run() { if (eh == null || chairLocation == null) return; if (!Utilities.checkLocation(npc.getBukkitEntity(), chairLocation, 1)) stand(); } - + @Override public void onSpawn() { eh = ((CraftPlayer) npc.getBukkitEntity()).getHandle(); if (sitting) sit(); } - + /** * Makes the NPC sit */ @@ -52,10 +52,10 @@ public void sit() { sitting = true; chairLocation = npc.getBukkitEntity().getLocation(); } - + /** * Makes the NPC sit a the specified location - * + * * @param location */ public void sit(Location location) { @@ -64,53 +64,53 @@ public void sit(Location location) { if (npc.getBukkitEntity().getType() != EntityType.PLAYER) { return; } - + /* * Teleport NPC to the location before * sending the sit packet to the clients. */ eh.getBukkitEntity().teleport(location.add(0.5, 0, 0.5)); dB.echoDebug("...NPC moved to chair"); - + ((EntityPlayer) eh).getDataWatcher().watch(0, Byte.valueOf((byte) 0x04)); - + sitting = true; chairLocation = location; } - + /** * Makes the NPC stand */ public void stand() { DenizenAPI.getDenizenNPC(npc).action("stand", null); - + ((EntityPlayer) eh).getDataWatcher().watch(0, Byte.valueOf((byte) 0x00)); - + chairLocation = null; sitting = false; } - + /** * Checks if the NPC is currently sitting - * + * * @return boolean */ public boolean isSitting() { return sitting; } - + /** * Gets the chair the NPC is sitting on * Returns null if the NPC isnt sitting - * + * * @return Location */ public Location getChair() { return chairLocation; } - - + + /** * If someone tries to break the poor * NPC's chair, we need to stop them! @@ -123,7 +123,7 @@ public void onBlockBreak(BlockBreakEvent event) { event.setCancelled(true); } } - + public SittingTrait() { super("sitting"); } diff --git a/src/main/java/net/aufdemrand/denizen/npc/traits/SleepingTrait.java b/src/main/java/net/aufdemrand/denizen/npc/traits/SleepingTrait.java index e2aa96c72d..448bb68652 100644 --- a/src/main/java/net/aufdemrand/denizen/npc/traits/SleepingTrait.java +++ b/src/main/java/net/aufdemrand/denizen/npc/traits/SleepingTrait.java @@ -14,19 +14,19 @@ public class SleepingTrait extends Trait { @Persist("sleeping") private boolean sleeping = false; - + @Persist("bed location") private Location bedLocation = null; - + @Override public void run() { if (npc == null || bedLocation == null) return; - + //if (npc.getBukkitEntity().getPassenger() == null && sitting) eh.mount(eh); - - if (!Utilities.checkLocation(npc.getBukkitEntity(), bedLocation, 1)) wakeUp(); + + if (!Utilities.checkLocation(npc.getBukkitEntity(), bedLocation, 1)) wakeUp(); } - + /** * Makes the NPC sleep */ @@ -34,36 +34,36 @@ public void toSleep() { if (sleeping) { return; } - + PlayerAnimation.SLEEP.play((Player) npc.getBukkitEntity()); - + sleeping = true; bedLocation = npc.getBukkitEntity().getLocation(); } - + /** * Makes the NPC sleep a the specified location - * + * * @param location */ public void toSleep(Location location) { if (sleeping) { return; } - + /* * Teleport NPC to the location before * playing sleep animation. */ //TODO Adjust the .add() npc.getBukkitEntity().teleport(location.add(0.5, 0, 0.5)); - + PlayerAnimation.SLEEP.play((Player) npc.getBukkitEntity()); - + sleeping = true; bedLocation = location; } - + /** * Makes the NPC wake up */ @@ -71,33 +71,33 @@ public void wakeUp() { if (!sleeping) { return; } - + PlayerAnimation.STOP_SLEEPING.play((Player) npc.getBukkitEntity()); - + bedLocation = null; sleeping = false; } - + /** * Checks if the NPC is currently sleeping - * + * * @return boolean */ public boolean isSleeping() { return sleeping; } - + /** * Gets the bed the NPC is sleeping on * Returns null if the NPC isnt sleeping - * + * * @return Location */ public Location getBed() { return bedLocation; } - - + + /** * If someone tries to break the poor * NPC's bed, we need to stop them! @@ -110,7 +110,7 @@ public void onBlockBreak(BlockBreakEvent event) { event.setCancelled(true); } } - + public SleepingTrait() { super("sleeping"); } diff --git a/src/main/java/net/aufdemrand/denizen/npc/traits/SneakingTrait.java b/src/main/java/net/aufdemrand/denizen/npc/traits/SneakingTrait.java index 154e421f80..3137fe8289 100644 --- a/src/main/java/net/aufdemrand/denizen/npc/traits/SneakingTrait.java +++ b/src/main/java/net/aufdemrand/denizen/npc/traits/SneakingTrait.java @@ -11,18 +11,18 @@ import org.bukkit.event.Listener; public class SneakingTrait extends Trait implements Listener { - + @Persist("sneaking") private boolean sneaking = false; - + EntityHuman eh = null; - + @Override public void onSpawn() { eh = ((CraftPlayer) npc.getBukkitEntity()).getHandle(); if (sneaking) sneak(); } - + /**x * Makes the NPC sneak */ @@ -37,27 +37,27 @@ public void sneak() { sneaking = true; } - + /** * Makes the NPC stand */ - public void stand() { + public void stand() { DenizenAPI.getDenizenNPC(npc).action("stand", null); - + ((EntityPlayer) eh).getDataWatcher().watch(0, Byte.valueOf((byte) 0x00)); - + sneaking = false; } - + /** * Checks if the NPC is currently sneaking - * + * * @return boolean */ public boolean isSneaking() { return sneaking; } - + public SneakingTrait() { super("sneaking"); } diff --git a/src/main/java/net/aufdemrand/denizen/npc/traits/TriggerTrait.java b/src/main/java/net/aufdemrand/denizen/npc/traits/TriggerTrait.java index dbfbb88cfb..371b29236d 100644 --- a/src/main/java/net/aufdemrand/denizen/npc/traits/TriggerTrait.java +++ b/src/main/java/net/aufdemrand/denizen/npc/traits/TriggerTrait.java @@ -116,8 +116,8 @@ public void describe(CommandSender sender, int page) throws CommandException { Paginator paginator = new Paginator().header("Triggers"); paginator.addLine("Key: Name Status Cooldown Cooldown Type (Radius)"); for (Entry entry : enabled.entrySet()) { - String line = " " + entry.getKey() - + " " + (entry.getValue() ? "Enabled" : "Disabled") + String line = " " + entry.getKey() + + " " + (entry.getValue() ? "Enabled" : "Disabled") + " " + getCooldownDuration(entry.getKey()) + " " + getCooldownType(entry.getKey()).name() + " " + (getRadius(entry.getKey()) == -1 ? "" : getRadius(entry.getKey())); @@ -139,7 +139,7 @@ public boolean triggerCooldownOnly(AbstractTrigger triggerClass, dPlayer player) DenizenAPI.getCurrentInstance().getTriggerRegistry().setCooldown(npc, player, triggerClass, getCooldownDuration(triggerClass.getName()), getCooldownType(triggerClass.getName())); return true; } - + public boolean trigger(AbstractTrigger triggerClass, dPlayer player) { // Check cool down, return false if not yet met if (!DenizenAPI.getCurrentInstance().getTriggerRegistry().checkCooldown(npc, player, triggerClass, getCooldownType(triggerClass.getName()))) diff --git a/src/main/java/net/aufdemrand/denizen/objects/Duration.java b/src/main/java/net/aufdemrand/denizen/objects/Duration.java index fc23c07680..2bee9f34ab 100644 --- a/src/main/java/net/aufdemrand/denizen/objects/Duration.java +++ b/src/main/java/net/aufdemrand/denizen/objects/Duration.java @@ -290,13 +290,13 @@ public String getAttribute(Attribute attribute) { if (attribute == null) return null; - + ///////////////////// // CONVERSION ATTRIBUTES ///////////////// - + // <--[tag] - // @attribute + // @attribute // @returns Element(double) // @description // returns the number of hours in the Duration. @@ -304,9 +304,9 @@ public String getAttribute(Attribute attribute) { if (attribute.startsWith("in_hours") || attribute.startsWith("hours")) return new Element(seconds / 1800) .getAttribute(attribute.fulfill(1)); - + // <--[tag] - // @attribute + // @attribute // @returns Element(double) // @description // returns the number of minutes in the Duration. @@ -314,7 +314,7 @@ public String getAttribute(Attribute attribute) { if (attribute.startsWith("in_minutes") || attribute.startsWith("minutes")) return new Element(seconds / 60) .getAttribute(attribute.fulfill(1)); - + // <--[tag] // @attribute // @returns Element(double) @@ -326,7 +326,7 @@ public String getAttribute(Attribute attribute) { .getAttribute(attribute.fulfill(1)); // <--[tag] - // @attribute + // @attribute // @returns Element(integer) // @description // returns the number of ticks in the Duration. (20t/second) @@ -334,12 +334,12 @@ public String getAttribute(Attribute attribute) { if (attribute.startsWith("in_ticks") || attribute.startsWith("ticks")) return new Element(getTicksAsInt()) .getAttribute(attribute.fulfill(1)); - - + + ///////////////////// // DEBUG ATTRIBUTES ///////////////// - + if (attribute.startsWith("prefix")) return new Element(prefix) .getAttribute(attribute.fulfill(1)); @@ -359,14 +359,14 @@ public String getAttribute(Attribute attribute) { return new Element(debug()) .getAttribute(attribute.fulfill(1)); } - - + + ///////////////////// // FORMAT ATTRIBUTES ///////////////// - + // <--[tag] - // @attribute + // @attribute // @returns Element // @description // returns the value of the duration in an easily readable @@ -375,16 +375,16 @@ public String getAttribute(Attribute attribute) { // there are less than 10 minutes left. // --> if (attribute.startsWith("formatted") || attribute.startsWith("value")) { - + // Make sure you don't change these longs into doubles // and break the code - + long seconds = (long) this.seconds; long days = seconds / 86400; long hours = (seconds - days * 86400) / 3600; long minutes = (seconds - days * 86400 - hours * 3600) / 60; seconds = seconds - days * 86400 - hours * 3600 - minutes * 60; - + String timeString = ""; if (days > 0) diff --git a/src/main/java/net/aufdemrand/denizen/objects/Element.java b/src/main/java/net/aufdemrand/denizen/objects/Element.java index 1ff90f87f4..fc22756aa2 100644 --- a/src/main/java/net/aufdemrand/denizen/objects/Element.java +++ b/src/main/java/net/aufdemrand/denizen/objects/Element.java @@ -37,27 +37,27 @@ public Element(String string) { this.prefix = "element"; this.element = string; } - + public Element(Boolean bool) { this.prefix = "boolean"; this.element = String.valueOf(bool); - } + } public Element(Integer integer) { this.prefix = "integer"; this.element = String.valueOf(integer); } - + public Element(Byte byt) { this.prefix = "byte"; this.element = String.valueOf(byt); } - + public Element(Short shrt) { this.prefix = "short"; this.element = String.valueOf(shrt); } - + public Element(Long lng) { this.prefix = "long"; this.element = String.valueOf(lng); @@ -67,7 +67,7 @@ public Element(Double dbl) { this.prefix = "double"; this.element = String.valueOf(dbl); } - + public Element(Float flt) { this.prefix = "float"; this.element = String.valueOf(flt); @@ -141,23 +141,23 @@ public boolean isUnique() { public String getAttribute(Attribute attribute) { if (attribute == null) return null; - - + + ///////////////////// // CONVERSION ATTRIBUTES ///////////////// - + // <--[tag] - // @attribute + // @attribute // @returns Element(Boolean) // @description - // Returns the element as true/false. + // Returns the element as true/false. // --> if (attribute.startsWith("asboolean") || attribute.startsWith("as_boolean")) return new Element(Boolean.valueOf(element).toString()) .getAttribute(attribute.fulfill(1)); - + // <--[tag] // @attribute // @returns Element(Number) @@ -172,9 +172,9 @@ public String getAttribute(Attribute attribute) { dB.echoError("'" + element + "' is not a valid Double."); return new Element("null").getAttribute(attribute.fulfill(1)); } - + // <--[tag] - // @attribute + // @attribute // @returns Duration // @description // Returns the element as a duration. @@ -182,17 +182,17 @@ public String getAttribute(Attribute attribute) { if (attribute.startsWith("asduration") || attribute.startsWith("as_duration")) return Duration.valueOf(element).getAttribute(attribute.fulfill(1)); - + // <--[tag] - // @attribute + // @attribute // @returns dEntity // @description - // Returns the element as an entity. Note: the value must be a valid entity. + // Returns the element as an entity. Note: the value must be a valid entity. // --> if (attribute.startsWith("asentity") || attribute.startsWith("as_entity")) return dEntity.valueOf(element).getAttribute(attribute.fulfill(1)); - + // <--[tag] // @attribute // @returns Element(Number) @@ -211,9 +211,9 @@ public String getAttribute(Attribute attribute) { dB.echoError("'" + element + "' is not a valid Integer."); return new Element("null").getAttribute(attribute.fulfill(1)); } - + // <--[tag] - // @attribute + // @attribute // @returns dItem // @description // Returns the element as an item. Additional attributes can be accessed by dItem. @@ -224,7 +224,7 @@ public String getAttribute(Attribute attribute) { return dItem.valueOf(element).getAttribute(attribute.fulfill(1)); // <--[tag] - // @attribute + // @attribute // @returns dList // @description // Returns the element as a list. Lists are sometimes prefixed with li@ and are @@ -233,9 +233,9 @@ public String getAttribute(Attribute attribute) { if (attribute.startsWith("aslist") || attribute.startsWith("as_list")) return dList.valueOf(element).getAttribute(attribute.fulfill(1)); - + // <--[tag] - // @attribute + // @attribute // @returns dLocation // @description // Returns the element as a location. Note: the value must be a valid location. @@ -243,7 +243,7 @@ public String getAttribute(Attribute attribute) { if (attribute.startsWith("aslocation") || attribute.startsWith("as_location")) return dLocation.valueOf(element).getAttribute(attribute.fulfill(1)); - + // <--[tag] // @attribute // @returns Element(Number) @@ -261,7 +261,7 @@ public String getAttribute(Attribute attribute) { return new Element("null").getAttribute(attribute.fulfill(1)); } } - + // <--[tag] // @attribute // @returns dNPC @@ -273,9 +273,9 @@ public String getAttribute(Attribute attribute) { return dNPC.valueOf(element).getAttribute(attribute.fulfill(1)); // <--[tag] - // @attribute + // @attribute // @returns dPlayer - // @description + // @description // Returns the element as a player. Note: the value must be a valid player. Can be online or offline. // --> if (attribute.startsWith("asplayer") @@ -283,7 +283,7 @@ public String getAttribute(Attribute attribute) { return dPlayer.valueOf(element).getAttribute(attribute.fulfill(1)); // <--[tag] - // @attribute + // @attribute // @returns dScript // @description // Returns the element as a script. Note: the value must be a valid script. @@ -292,11 +292,11 @@ public String getAttribute(Attribute attribute) { || attribute.startsWith("as_script")) return dScript.valueOf(element).getAttribute(attribute.fulfill(1)); - + ///////////////////// // DEBUG ATTRIBUTES ///////////////// - + // <--[tag] // @attribute // @returns Element @@ -330,7 +330,7 @@ public String getAttribute(Attribute attribute) { return new Element(debug()) .getAttribute(attribute.fulfill(1)); } - + // <--[tag] // @attribute // @returns Element @@ -340,12 +340,12 @@ public String getAttribute(Attribute attribute) { if (attribute.startsWith("prefix")) return new Element(prefix) .getAttribute(attribute.fulfill(1)); - - + + ///////////////////// // MATH ATTRIBUTES ///////////////// - + // <--[tag] // @attribute // @returns Element(Number) @@ -356,7 +356,7 @@ public String getAttribute(Attribute attribute) { return new Element(Math.abs(asDouble())) .getAttribute(attribute.fulfill(1)); } - + // <--[tag] // @attribute ]> // @returns Element(Number) @@ -368,7 +368,7 @@ public String getAttribute(Attribute attribute) { return new Element(asDouble() + aH.getDoubleFrom(attribute.getContext(1))) .getAttribute(attribute.fulfill(1)); } - + // <--[tag] // @attribute ]> // @returns Element(Number) @@ -380,7 +380,7 @@ public String getAttribute(Attribute attribute) { return new Element(asDouble() / aH.getDoubleFrom(attribute.getContext(1))) .getAttribute(attribute.fulfill(1)); } - + // <--[tag] // @attribute ]> // @returns Element(Number) @@ -392,7 +392,7 @@ public String getAttribute(Attribute attribute) { return new Element(asDouble() % aH.getDoubleFrom(attribute.getContext(1))) .getAttribute(attribute.fulfill(1)); } - + // <--[tag] // @attribute ]> // @returns Element(Number) @@ -404,7 +404,7 @@ public String getAttribute(Attribute attribute) { return new Element(asDouble() * aH.getDoubleFrom(attribute.getContext(1))) .getAttribute(attribute.fulfill(1)); } - + // <--[tag] // @attribute // @returns Element(Number) @@ -415,7 +415,7 @@ public String getAttribute(Attribute attribute) { return new Element(Math.sqrt(asDouble())) .getAttribute(attribute.fulfill(1)); } - + // <--[tag] // @attribute ]> // @returns Element(Number) @@ -427,14 +427,14 @@ public String getAttribute(Attribute attribute) { return new Element(asDouble() - aH.getDoubleFrom(attribute.getContext(1))) .getAttribute(attribute.fulfill(1)); } - - + + ///////////////////// // STRING CHECKING ATTRIBUTES ///////////////// - + // <--[tag] - // @attribute ]> + // @attribute ]> // @returns Element(Boolean) // @description // Returns whether the element contains a specified string, case in-sensitive. Can use @@ -454,7 +454,7 @@ else if (element.toLowerCase().contains(contains.toLowerCase())) return new Element("true").getAttribute(attribute.fulfill(1)); else return new Element("false").getAttribute(attribute.fulfill(1)); } - + // <--[tag] // @attribute ]> // @returns Element(Boolean) @@ -472,7 +472,7 @@ else if (element.toLowerCase().contains(contains.toLowerCase())) // --> if (attribute.startsWith("last_color")) return new Element(ChatColor.getLastColors(element)).getAttribute(attribute.fulfill(1)); - + // <--[tag] // @attribute // @returns Element(Number) @@ -483,7 +483,7 @@ else if (element.toLowerCase().contains(contains.toLowerCase())) return new Element(element.length()) .getAttribute(attribute.fulfill(1)); } - + // <--[tag] // @attribute ]> // @returns Element(Boolean) @@ -492,14 +492,14 @@ else if (element.toLowerCase().contains(contains.toLowerCase())) // --> if (attribute.startsWith("starts_with") || attribute.startsWith("startswith")) return new Element(element.startsWith(attribute.getContext(1))).getAttribute(attribute.fulfill(1)); - - + + ///////////////////// // STRING MANIPULATION ATTRIBUTES ///////////////// - + // <--[tag] - // @attribute ]> + // @attribute ]> // @returns Element // @description // Returns the portion of an element after a specified string. ie. returns 'world'. @@ -511,7 +511,7 @@ else if (element.toLowerCase().contains(contains.toLowerCase())) (element.indexOf(delimiter) + delimiter.length())) .getAttribute(attribute.fulfill(1)); } - + // <--[tag] // @attribute ]> // @returns Element @@ -525,7 +525,7 @@ else if (element.toLowerCase().contains(contains.toLowerCase())) (0, element.indexOf(delimiter))) .getAttribute(attribute.fulfill(1)); } - + // <--[tag] // @attribute ]> // @returns Element @@ -552,7 +552,7 @@ else if (element.toLowerCase().contains(contains.toLowerCase())) return new Element(element.replace(replace, replacement)) .getAttribute(attribute.fulfill(1)); } - + // <--[tag] // @attribute ].limit[<#>]> // @returns dList @@ -586,7 +586,7 @@ else if (element.toLowerCase().contains(contains.toLowerCase())) return new dList(Arrays.asList(StringUtils.split(element, split_string))) .getAttribute(attribute.fulfill(1)); } - + // <--[tag] // @attribute // @returns Element @@ -595,8 +595,8 @@ else if (element.toLowerCase().contains(contains.toLowerCase())) // --> if (attribute.startsWith("strip_color")) return new Element(ChatColor.stripColor(element)).getAttribute(attribute.fulfill(1)); - - + + // <--[tag] // @attribute (,<#>)]> // @returns Element diff --git a/src/main/java/net/aufdemrand/denizen/objects/dColor.java b/src/main/java/net/aufdemrand/denizen/objects/dColor.java index 1b8f6af4cb..6174809df2 100644 --- a/src/main/java/net/aufdemrand/denizen/objects/dColor.java +++ b/src/main/java/net/aufdemrand/denizen/objects/dColor.java @@ -17,7 +17,7 @@ public class dColor implements dObject { ////////////////// // OBJECT FETCHER //////////////// - + /** * Gets a Color Object from a string form. * @@ -31,7 +31,7 @@ public static dColor valueOf(String string) { string = string.toUpperCase().replace("CO@", ""); if (string.matches("RANDOM")) { - + // Get a color using random RGB values return new dColor(Utilities.getRandom().nextInt(256), Utilities.getRandom().nextInt(256), @@ -44,9 +44,9 @@ public static dColor valueOf(String string) { return new dColor(aH.getIntegerFrom(m.group(1)), aH.getIntegerFrom(m.group(2)), aH.getIntegerFrom(m.group(3))); - + Field colorField = null; - + try { colorField = Color.class.getField(string.toUpperCase()); } catch (SecurityException e1) { @@ -61,7 +61,7 @@ public static dColor valueOf(String string) { // No match return null; } - + /** * Determines whether a string is a valid color. * @@ -75,19 +75,19 @@ public static boolean matches(String arg) { if (arg.toUpperCase().matches("RANDOM")) return true; - + Matcher m = rgbPattern.matcher(arg); - + if (m.matches()) return true; - + for (Field field : Color.class.getFields()) if (arg.toUpperCase().matches(field.getName())) return true; - + return false; } - - + + /////////////// // Constructors ///////////// @@ -95,7 +95,7 @@ public static boolean matches(String arg) { public dColor(int red, int green, int blue) { color = Color.fromRGB(red, green, blue); } - + public dColor(Field field) { try { color = (Color) field.get(null); @@ -109,8 +109,8 @@ public dColor(Field field) { public dColor(Color color) { this.color = color; } - - + + ///////////////////// // INSTANCE FIELDS/METHODS ///////////////// @@ -122,7 +122,7 @@ public dColor(Color color) { public Color getColor() { return color; } - + String prefix = "color"; @Override diff --git a/src/main/java/net/aufdemrand/denizen/objects/dEntity.java b/src/main/java/net/aufdemrand/denizen/objects/dEntity.java index 3954ba5c74..b88553e8fb 100644 --- a/src/main/java/net/aufdemrand/denizen/objects/dEntity.java +++ b/src/main/java/net/aufdemrand/denizen/objects/dEntity.java @@ -222,7 +222,7 @@ else if (isSaved(m.group(2))) for (EntityType type : EntityType.values()) { if (type.name().equalsIgnoreCase(m.group(1))) - // Construct a new 'vanilla' unspawned dEntity + // Construct a new 'vanilla' unspawned dEntity return new dEntity(type, data1, data2); } } @@ -344,7 +344,7 @@ public NPC getNPC() { public boolean isNPC() { return CitizensAPI.getNPCRegistry().isNPC(entity); } - + /** * Get the Player corresponding to this entity * @@ -377,7 +377,7 @@ public boolean isPlayer() { public boolean isGeneric() { return identify().matches("e@\\D+"); } - + /** * Get the location of this entity * @@ -389,10 +389,10 @@ public dLocation getLocation() { if (!isGeneric()) { return new dLocation(entity.getLocation()); } - + return null; } - + /** * Get the eye location of this entity * @@ -404,10 +404,10 @@ public dLocation getEyeLocation() { if (!isGeneric() && isLivingEntity()) { return new dLocation(getLivingEntity().getEyeLocation()); } - + return null; } - + /** * Gets the velocity of this entity * @@ -421,7 +421,7 @@ public Vector getVelocity() { } return null; } - + /** * Sets the velocity of this entity * @@ -433,7 +433,7 @@ public void setVelocity(Vector vector) { entity.setVelocity(vector); } } - + public void spawnAt(Location location) { // If the entity is already spawned, teleport it. if (entity != null && isUnique()) entity.teleport(location); @@ -459,7 +459,7 @@ public void spawnAt(Location location) { org.bukkit.entity.Entity ent = null; if (entity_type.name().matches("PLAYER")) { - + NPC npc = CitizensAPI.getNPCRegistry().createNPC(EntityType.PLAYER, data1); npc.spawn(location); } @@ -505,9 +505,9 @@ else if (entity_type.name().matches("FALLING_BLOCK")) { ent = location.getWorld().spawnEntity(location, entity_type); entity = ent; - + if (entity_type.name().matches("PIG_ZOMBIE")) { - + // Give pig zombies golden swords by default, unless data2 specifies // a different weapon if (!dItem.matches(data1)) { @@ -518,7 +518,7 @@ else if (entity_type.name().matches("FALLING_BLOCK")) { .setItemInHand(dItem.valueOf(data1).getItemStack()); } else if (entity_type.name().matches("SKELETON")) { - + // Give skeletons bows by default, unless data2 specifies // a different weapon if (!dItem.matches(data2)) { @@ -611,9 +611,9 @@ else if (entity != null) public boolean isSpawned() { return entity != null; } - + public boolean isValid() { - + return entity.isValid(); } @@ -646,7 +646,7 @@ public void target(LivingEntity target) { // as well for one of the two methods below EntityLiving nmsTarget = target != null ? ((CraftLivingEntity) target).getHandle() : null; - + ((CraftCreature) entity).getHandle(). setGoalTarget(nmsTarget); @@ -806,7 +806,7 @@ public String getAttribute(Attribute attribute) { dB.echoDebug("dEntity has returned null."); return "null"; } - + // <--[tag] // @attribute // @returns dEntity @@ -908,7 +908,7 @@ public String getAttribute(Attribute attribute) { if (attribute.startsWith("eye_location")) return new dLocation(getEyeLocation()) .getAttribute(attribute.fulfill(1)); - + // <--[tag] // @attribute // @returns dLocation @@ -999,7 +999,7 @@ else if ((float) getLivingEntity().getHealth() / maxHealth < 1) if (attribute.startsWith("is_tameable")) return new Element(entity instanceof Tameable) .getAttribute(attribute.fulfill(1)); - + // <--[tag] // @attribute // @returns Element(Boolean) @@ -1015,7 +1015,7 @@ else if ((float) getLivingEntity().getHealth() / maxHealth < 1) return Element.FALSE .getAttribute(attribute.fulfill(1)); } - + // <--[tag] // @attribute // @returns dPlayer @@ -1030,7 +1030,7 @@ else if ((float) getLivingEntity().getHealth() / maxHealth < 1) return new Element("null") .getAttribute(attribute.fulfill(1)); } - + // <--[tag] // @attribute // @returns Element(Boolean) diff --git a/src/main/java/net/aufdemrand/denizen/objects/dInventory.java b/src/main/java/net/aufdemrand/denizen/objects/dInventory.java index 692494cd72..a312bae306 100644 --- a/src/main/java/net/aufdemrand/denizen/objects/dInventory.java +++ b/src/main/java/net/aufdemrand/denizen/objects/dInventory.java @@ -32,14 +32,14 @@ import net.citizensnpcs.api.CitizensAPI; public class dInventory implements dObject, Notable { - + ///////////////////// // PATTERNS ///////////////// - + final static Pattern inventory_by_type = Pattern.compile("(in@)(npc|player|entity|location|equipment)(\\[)(.+?)(\\])", Pattern.CASE_INSENSITIVE); final static Pattern inventory_by_script = Pattern.compile("(in@)(.+)", Pattern.CASE_INSENSITIVE); - + ///////////////////// // NOTABLE METHODS ///////////////// @@ -47,7 +47,7 @@ public class dInventory implements dObject, Notable { public boolean isUnique() { return holderType.equals("notable"); } - + @Note("inventory") public String getSaveObject() { return holderIdentifier; @@ -68,44 +68,44 @@ public void forget() { holderType_old = null; holderIdentifier_old = null; } - + ////////////////// // OBJECT FETCHER //////////////// - + public static dInventory valueOf(String string) { return valueOf(string, null, null); } - + /** - * + * * Gets a dInventory from a string format. * * @param string * The inventory in string form. (in@player[playerName], in@scriptName, etc.) - * @return + * @return * The dInventory value. If the string is incorrectly formatted or * the specified inventory is invalid, this is null. * */ @ObjectFetcher("in") public static dInventory valueOf(String string, dPlayer player, dNPC npc) { - + if (string == null) return null; - + Matcher m = inventory_by_type.matcher(string); - + if (m.matches()) { // Set the type of the inventory holder String t = m.group(2); // Set the name/id/location of the inventory holder String h = m.group(4); - + if (t.equalsIgnoreCase("npc")) { // Check if the NPC ID specified is valid - if (dNPC.matches((h.startsWith("n@") ? h : "n@" + h)) - && (dNPC.valueOf((h.startsWith("n@") ? h : "n@" + h)).getEntity() instanceof Player + if (dNPC.matches((h.startsWith("n@") ? h : "n@" + h)) + && (dNPC.valueOf((h.startsWith("n@") ? h : "n@" + h)).getEntity() instanceof Player || dNPC.valueOf((h.startsWith("n@") ? h : "n@" + h)).getEntity() instanceof Horse)) return new dInventory(dNPC.valueOf(h).getEntity()); } @@ -139,40 +139,40 @@ else if (dPlayer.matches(h) && Bukkit.getPlayer(h.substring(2)).isOnline()) { return new dInventory(InventoryType.CRAFTING, t, h).add(Bukkit.getPlayer(h.substring(2)) .getEquipment().getArmorContents()); } - else if (dEntity.matches(h) && dEntity.valueOf(h).isLivingEntity() + else if (dEntity.matches(h) && dEntity.valueOf(h).isLivingEntity() && dEntity.valueOf(h).isSpawned()) { return new dInventory(InventoryType.CRAFTING, t, h).add(dEntity.valueOf(h).getLivingEntity() .getEquipment().getArmorContents()); } } - + // If the dInventory is invalid, alert the user and return null dB.echoError("Value of dInventory returning null. Invalid " + t + " specified: " + h); return null; - + } - + // Match in@scriptName for Inventory Scripts m = inventory_by_script.matcher(string); - + if (m.matches()) { - + if (ScriptRegistry.containsScript(m.group(2), InventoryScriptContainer.class)) return ScriptRegistry.getScriptContainerAs(m.group(2), InventoryScriptContainer.class).getInventoryFrom(player, npc); - + if (NotableManager.isSaved(m.group(2)) && NotableManager.isType(m.group(2), dInventory.class)) return (dInventory) NotableManager.getSavedObject(m.group(2)); - + dB.echoError("Value of dInventory returning null. Invalid script specified: " + m.group(2)); return null; - + } - + dB.echoError("Value of dInventory returning null. Invalid dInventory specified: " + string); return null; - + } - + /** * Determine whether a string is a valid inventory. * @@ -184,16 +184,16 @@ public static boolean matches(String arg) { if (valueOf(arg) != null) return true; - + return false; } - - + + /////////////// // Constructors ///////////// - + String holderType = null; String holderType_old = null; String holderIdentifier = null; @@ -201,9 +201,9 @@ public static boolean matches(String arg) { public dInventory(Inventory inventory) { if (inventory.getHolder() != null) { - + InventoryHolder holder = inventory.getHolder(); - + if (!(holder instanceof LivingEntity)) { if (holder instanceof DoubleChest) holderIdentifier = ((DoubleChest) holder).getLocation().toString(); @@ -240,7 +240,7 @@ else if (holder instanceof StorageMinecart) { // Uncomment this when Denizen implements inventories for all! // holderType = "npc"; // holderIdentifier = String.valueOf(((NPC) holder).getId()); - + dB.echoError("Only Player-type NPCs can have inventories."); return; } @@ -249,27 +249,27 @@ else if (holder instanceof StorageMinecart) { holderIdentifier = String.valueOf(((LivingEntity) holder).getEntityId()); } } - + } this.inventory = inventory; } - + public dInventory(InventoryType type) { inventory = Bukkit.getServer().createInventory(null, type); } - + public dInventory(InventoryType type, String id, String identifier) { inventory = Bukkit.getServer().createInventory(null, type); holderType = id; holderIdentifier = identifier; } - + public dInventory(int size, String id, String identifier) { inventory = Bukkit.getServer().createInventory(null, size); holderType = id; holderIdentifier = identifier; } - + public dInventory(InventoryHolder holder) { if (!(holder instanceof LivingEntity)) { if (holder instanceof DoubleChest) @@ -307,7 +307,7 @@ else if (holder instanceof StorageMinecart) { // Uncomment this when Denizen implements inventories for all! // holderType = "npc"; // holderIdentifier = String.valueOf(((NPC) holder).getId()); - + dB.echoError("Only Player-type NPCs can have inventories."); return; } @@ -317,13 +317,13 @@ else if (holder instanceof StorageMinecart) { } } } - + public dInventory(Player player) { this.inventory = player.getInventory(); holderType = "player"; holderIdentifier = player.getName(); } - + public dInventory(BlockState state) { if (state instanceof InventoryHolder) { this.inventory = ((InventoryHolder) state).getInventory(); @@ -331,7 +331,7 @@ public dInventory(BlockState state) { holderIdentifier = new dLocation(state.getLocation()).identify(); } } - + public dInventory(LivingEntity entity) { if (entity instanceof InventoryHolder) { this.inventory = ((InventoryHolder) entity).getInventory(); @@ -340,7 +340,7 @@ public dInventory(LivingEntity entity) { } } - + ///////////////////// // INSTANCE FIELDS/METHODS ///////////////// @@ -352,7 +352,7 @@ public dInventory(LivingEntity entity) { public Inventory getInventory() { return inventory; } - + /** * Add an array of items to this inventory * and return the result @@ -361,21 +361,21 @@ public Inventory getInventory() { * @return The resulting dInventory * */ - + public dInventory add(ItemStack... items) { if (inventory == null || items == null) return this; - + inventory.addItem(items); - + return this; } - + public HashMap addWithLeftovers(ItemStack... items) { if (inventory == null || items == null) return null; - + return inventory.addItem(items); } - + /** * Count the number or quantities of stacks that * match an item in an inventory. @@ -386,13 +386,13 @@ public HashMap addWithLeftovers(ItemStack... items) { * @return The number of stacks or quantity of items * */ - + public int count(ItemStack item, boolean stacks) { if (inventory == null) return 0; - + int qty = 0; - + for (ItemStack invStack : inventory) { // If ItemStacks are empty here, they are null @@ -400,23 +400,23 @@ public int count(ItemStack item, boolean stacks) { // If item is null, include all items in the // inventory - + if (item == null || invStack.isSimilar(item)) { - + // If stacks is true, only count the number // of stacks // // Otherwise, count the quantities of stacks - + if (stacks == true) qty++; else qty = qty + invStack.getAmount(); } } } - + return qty; } - + /** * Keep only the items from a certain array * in this inventory, removing all others @@ -425,41 +425,41 @@ public int count(ItemStack item, boolean stacks) * @return The resulting dInventory * */ - + public dInventory keep(ItemStack[] items) { - + if (inventory == null || items == null) return this; - + for (ItemStack invStack : inventory) { - + if (invStack != null) { - + boolean keep = false; - + // See if the item array contains // this inventory item for (ItemStack item : items) { - + if (invStack.isSimilar(item)) { - + keep = true; break; } } - + // If the item array did not contain // this inventory item, remove it // from the inventory if (keep == false) { - + this.remove(invStack); } } } - + return this; } - + /** * Exclude an array of items from this * inventory by removing them over and over @@ -469,23 +469,23 @@ public dInventory keep(ItemStack[] items) { * @return The resulting dInventory * */ - + public dInventory exclude(ItemStack[] items) { - + if (inventory == null || items == null) return this; - + int oldCount = this.count(null, false); int newCount = -1; - + while (oldCount != newCount) { - + oldCount = newCount; newCount = this.remove(items).count(null, false); } - + return this; } - + /** * Fill an inventory with an array of items by * continuing to add the items to it over and @@ -495,23 +495,23 @@ public dInventory exclude(ItemStack[] items) { * @return The resulting dInventory * */ - + public dInventory fill(ItemStack[] items) { - + if (inventory == null || items == null) return this; - + int oldCount = this.count(null, false); int newCount = -1; - + while (oldCount != newCount) { - + oldCount = newCount; newCount = this.add(items).count(null, false); } - + return this; } - + /** * Return the dLocation of this inventory's * holder @@ -519,25 +519,25 @@ public dInventory fill(ItemStack[] items) { * @return The holder's dLocation * */ - + public dLocation getLocation() { - + if (inventory != null) { - + InventoryHolder holder = inventory.getHolder(); - + if (holder instanceof BlockState) { return new dLocation(((BlockState) holder).getLocation()); } else if (holder instanceof Player) { - + return new dLocation(((Player) holder).getLocation()); } } - + return null; } - + /** * Remove an array of items from this inventory, * and return the result @@ -546,19 +546,19 @@ else if (holder instanceof Player) { * @return The resulting dInventory * */ - + public dInventory remove(ItemStack[] items) { - + if (inventory == null || items == null) return this; - + for (ItemStack item : items) { - + if (item != null) inventory.removeItem(item); } - + return this; } - + /** * Remove a book from this inventory, comparing * only its title and author with books in the @@ -570,51 +570,51 @@ public dInventory remove(ItemStack[] items) { * @return The resulting dInventory * */ - + public dInventory removeBook(ItemStack book) { - + if (inventory == null || book == null) return this; - + // We have to manually keep track of the quantity // we are removing, because we are not relying on // Bukkit methods to find matching itemStacks int qty = book.getAmount(); - + // Store the book's meta information in a variable BookMeta bookMeta = (BookMeta) book.getItemMeta(); - + for (ItemStack invStack : inventory) { if (qty == 0) break; - + if (invStack != null && invStack.getItemMeta() instanceof BookMeta) { - + BookMeta invMeta = (BookMeta) invStack.getItemMeta(); - + if (invMeta.getAuthor().equalsIgnoreCase(bookMeta.getAuthor()) && invMeta.getTitle().equalsIgnoreCase(bookMeta.getTitle())) { // Make sure we don't remove more books than we // need to if (qty - invStack.getAmount() < 0) { - + invStack.setAmount((qty - invStack.getAmount()) * -1); } else { - + inventory.removeItem(invStack); - + // Update the quantity we still have to remove qty = qty - invStack.getAmount(); } } } - + } - + return this; } - + /** * Replace another inventory with this one, * cropping it if necessary so that it fits. @@ -622,64 +622,64 @@ public dInventory removeBook(ItemStack book) { * @param destination The destination inventory * */ - + public void replace(dInventory destination) { - + if (inventory == null || destination == null) return; - + // If the destination is smaller than our current inventory, // add as many items as possible - + if (destination.getSize() < this.getSize()) { destination.clear(); destination.add(this.getContents()); } else { - + destination.setContents(this.getContents()); } } - + public void clear() { if (inventory != null) inventory.clear(); } - + public ItemStack[] getContents() { if (inventory != null) return inventory.getContents(); else return new ItemStack[0]; } - + public InventoryType getInventoryType() { return inventory.getType(); } - + public int getSize() { return inventory.getSize(); } - + public void remove(ItemStack item) { inventory.remove(item); } - + public void setContents(ItemStack[] contents) { inventory.setContents(contents); } - + //////////////////////// // dObject Methods ///////////////////// private String prefix = getObjectType(); - + public String getObjectType() { return "Inventory"; } - + public String getPrefix() { return prefix; } - + public dInventory setPrefix(String prefix) { this.prefix = prefix; return this; @@ -695,7 +695,7 @@ public String identify() { } public String getAttribute(Attribute attribute) { - + if (attribute == null) return null; // <--[tag] @@ -707,22 +707,22 @@ public String getAttribute(Attribute attribute) { // --> if (attribute.startsWith("contains")) { if (attribute.hasContext(1) && dItem.matches(attribute.getContext(1))) { - + int qty = 1; - + if (attribute.getAttribute(2).startsWith("qty") && attribute.hasContext(2) && aH.matchesInteger(attribute.getContext(2))) { - + qty = attribute.getIntContext(2); } - + return new Element(getInventory().containsAtLeast (dItem.valueOf(attribute.getContext(1)).getItemStack(), qty)) .getAttribute(attribute.fulfill(qty == 1 ? 1 : 2)); } } - + // <--[tag] // @attribute // @returns dLocation @@ -730,11 +730,11 @@ public String getAttribute(Attribute attribute) { // Returns the location of this inventory's holder. // --> if (attribute.startsWith("location")) { - + return new dLocation(getLocation()) .getAttribute(attribute.fulfill(1)); } - + // <--[tag] // @attribute ]> // @returns Element(Number) @@ -751,7 +751,7 @@ public String getAttribute(Attribute attribute) { else return new Element(count(null, false)) .getAttribute(attribute.fulfill(1)); - + // <--[tag] // @attribute // @returns Element(Number) @@ -761,7 +761,7 @@ public String getAttribute(Attribute attribute) { if (attribute.startsWith("size")) return new Element(getSize()) .getAttribute(attribute.fulfill(1)); - + // <--[tag] // @attribute // @returns Element(Number) @@ -777,7 +777,7 @@ public String getAttribute(Attribute attribute) { else return new Element(count(null, true)) .getAttribute(attribute.fulfill(1)); - + // <--[tag] // @attribute // @returns Element @@ -787,7 +787,7 @@ public String getAttribute(Attribute attribute) { if (attribute.startsWith("type")) return new Element(getInventory().getType().name()) .getAttribute(attribute.fulfill(1)); - + // <--[tag] // @attribute // @returns dInventory(Equipment) @@ -810,7 +810,7 @@ else if (inventory.getHolder() instanceof LivingEntity) identifier = "e@" + ((Player) getInventory().getHolder()).getEntityId(); else return new Element("null") .getAttribute(attribute.fulfill(1)); - + return new dInventory(InventoryType.CRAFTING, "equipment", identifier) .add(((PlayerInventory) getInventory()).getArmorContents()) .getAttribute(attribute.fulfill(1)); @@ -822,7 +822,7 @@ else if (getInventory() instanceof HorseInventory) { .getAttribute(attribute.fulfill(1)); } } - + // <--[tag] // @attribute // @returns dList(dItem) @@ -837,7 +837,7 @@ else if (getInventory() instanceof HorseInventory) { } return new dList(items).getAttribute(attribute.fulfill(1)); } - + return new Element(identify()).getAttribute(attribute.fulfill(0)); } diff --git a/src/main/java/net/aufdemrand/denizen/objects/dItem.java b/src/main/java/net/aufdemrand/denizen/objects/dItem.java index bd9954d12b..4e41e90ddf 100644 --- a/src/main/java/net/aufdemrand/denizen/objects/dItem.java +++ b/src/main/java/net/aufdemrand/denizen/objects/dItem.java @@ -517,7 +517,7 @@ public String getAttribute(Attribute attribute) { if (attribute == null) return null; // <--[tag] - // @attribute + // @attribute // @returns Element(Number) // @description // Returns the number of items in the dItem's itemstack. @@ -527,7 +527,7 @@ public String getAttribute(Attribute attribute) { .getAttribute(attribute.fulfill(1)); // <--[tag] - // @attribute + // @attribute // @returns Element // @description // Returns a valid identification for the item @@ -538,9 +538,9 @@ public String getAttribute(Attribute attribute) { } // <--[tag] - // @attribute + // @attribute // @returns Element(Number) - // @description + // @description // Returns the item ID number of the item. // --> if (attribute.startsWith("id")) @@ -571,7 +571,7 @@ public String getAttribute(Attribute attribute) { } // <--[tag] - // @attribute + // @attribute // @returns Element(Number) // @description // Returns the current durability of the item. @@ -581,7 +581,7 @@ public String getAttribute(Attribute attribute) { .getAttribute(attribute.fulfill(1)); // <--[tag] - // @attribute + // @attribute // @returns Element(Boolean) // @description // Returns true if the item can be repaired. Otherwise, returns false. @@ -595,7 +595,7 @@ public String getAttribute(Attribute attribute) { // @returns Element // @description // Returns the formatted material name of the item to be used in a sentence. - // Correctly uses singular and plural forms of item names, among other things. + // Correctly uses singular and plural forms of item names, among other things. // --> if (attribute.startsWith("material.formatted")) { @@ -637,7 +637,7 @@ public String getAttribute(Attribute attribute) { } // <--[tag] - // @attribute + // @attribute // @returns Element // @description // Returns the material corresponding to the item @@ -647,7 +647,7 @@ public String getAttribute(Attribute attribute) { .getAttribute(attribute.fulfill(1)); // <--[tag] - // @attribute + // @attribute // @returns Element // @description // Returns the display name of the item, as set by API or an 'anvil'. @@ -680,7 +680,7 @@ public String getAttribute(Attribute attribute) { BookMeta bookInfo = (BookMeta) getItemStack().getItemMeta(); // <--[tag] - // @attribute + // @attribute // @returns Element // @description // Returns the author of the book. Note: Item must be a 'written_book'. @@ -700,7 +700,7 @@ public String getAttribute(Attribute attribute) { .getAttribute(attribute.fulfill(1)); // <--[tag] - // @attribute + // @attribute // @returns Element(Number) // @description // Returns the number of pages in the book. Note: Item must be a 'written_book'. @@ -710,7 +710,7 @@ public String getAttribute(Attribute attribute) { .getAttribute(attribute.fulfill(1)); // <--[tag] - // @attribute ]> + // @attribute ]> // @returns Element // @description // Returns the page specified from the book as an element. @@ -720,7 +720,7 @@ public String getAttribute(Attribute attribute) { .getAttribute(attribute.fulfill(1)); // <--[tag] - // @attribute + // @attribute // @returns dList // @description // Returns the pages of the book as a dList. @@ -736,7 +736,7 @@ public String getAttribute(Attribute attribute) { } // <--[tag] - // @attribute + // @attribute // @returns Element // @description // Returns the script name of the item if it was created by an item script-container.. @@ -750,10 +750,10 @@ public String getAttribute(Attribute attribute) { } // <--[tag] - // @attribute + // @attribute // @returns dList // @description - // Returns lore as a dList. Excludes the custom-script-id lore. + // Returns lore as a dList. Excludes the custom-script-id lore. // To get that information, use . // --> if (attribute.startsWith("lore")) { diff --git a/src/main/java/net/aufdemrand/denizen/objects/dList.java b/src/main/java/net/aufdemrand/denizen/objects/dList.java index 2eb78fe4d0..c589cbbaf6 100644 --- a/src/main/java/net/aufdemrand/denizen/objects/dList.java +++ b/src/main/java/net/aufdemrand/denizen/objects/dList.java @@ -22,7 +22,7 @@ public class dList extends ArrayList implements dObject { final static Pattern split_char = Pattern.compile("\\|"); final static Pattern identifier = Pattern.compile("li@", Pattern.CASE_INSENSITIVE); - + @ObjectFetcher("li, fl") public static dList valueOf(String string) { if (string == null) return null; @@ -148,33 +148,33 @@ public boolean isUnique() { public String getObjectType() { return "List"; } - + public String[] toArray() { - + List list = new ArrayList(); - + for (String string : this) { list.add(string); } - + return list.toArray(new String[list.size()]); } - + // Return a list that includes only elements belonging to a certain class public List filter(Class dClass) { - + List results = new ArrayList(); - + for (String element : this) { - + try { if ((Boolean) dClass.getMethod("matches", String.class).invoke(null, element)) { - - dObject object = (dObject) dClass.getMethod("valueOf", String.class).invoke(null, element); - + + dObject object = (dObject) dClass.getMethod("valueOf", String.class).invoke(null, element); + // Only add the object if it is not null, thus filtering useless // list items - + if (object != null) { results.add(object); } @@ -183,7 +183,7 @@ public List filter(Class dClass) { e.printStackTrace(); } } - + if (results.size() > 0) return results; else return null; } @@ -308,11 +308,11 @@ public String getAttribute(Attribute attribute) { return new Element(item).getAttribute(attribute.fulfill(1)); } - + if (attribute.startsWith("last")) { return new Element(get(size() - 1)).getAttribute(attribute.fulfill(1)); } - + if (attribute.startsWith("contains")) { if (attribute.hasContext(1)) { boolean state = false; @@ -323,7 +323,7 @@ public String getAttribute(Attribute attribute) { break; } } - + return new Element(state).getAttribute(attribute.fulfill(1)); } } diff --git a/src/main/java/net/aufdemrand/denizen/objects/dLocation.java b/src/main/java/net/aufdemrand/denizen/objects/dLocation.java index a862975d01..d0038a1fc5 100644 --- a/src/main/java/net/aufdemrand/denizen/objects/dLocation.java +++ b/src/main/java/net/aufdemrand/denizen/objects/dLocation.java @@ -86,8 +86,8 @@ public static void remove(String id) { * Called on server startup or /denizen reload locations. Should probably not be called manually. */ public static void _recallLocations() { - - + + List loclist = DenizenAPI.getCurrentInstance().getSaves().getStringList("dScript.Locations"); uniqueObjects.clear(); for (String location : loclist) { @@ -407,7 +407,7 @@ public String getAttribute(Attribute attribute) { if (attribute.startsWith("find") || attribute.startsWith("nearest")) { attribute.fulfill(1); - + // <--[tag] // @attribute |...].within[X]> // @returns dList @@ -436,7 +436,7 @@ public String getAttribute(Attribute attribute) { .getRelative(x,y,z).getData()))) found.add(new dLocation(getBlock().getRelative(x,y,z).getLocation())); } else found.add(new dLocation(getBlock().getRelative(x,y,z).getLocation())); - + Collections.sort(found, new Comparator() { @Override public int compare(dLocation loc1, dLocation loc2) { @@ -483,7 +483,7 @@ else if (attribute.startsWith("surface_blocks") && l.add(0,1,0).getBlock().getType() == Material.AIR) found.add(new dLocation(getBlock().getRelative(x,y,z).getLocation())); } - + Collections.sort(found, new Comparator() { @Override public int compare(dLocation loc1, dLocation loc2) { @@ -491,9 +491,9 @@ public int compare(dLocation loc1, dLocation loc2) { } }); - return new dList(found).getAttribute(attribute); + return new dList(found).getAttribute(attribute); } - + // <--[tag] // @attribute // @returns dList @@ -509,7 +509,7 @@ else if (attribute.startsWith("players") for (Player player : Bukkit.getOnlinePlayers()) if (Utilities.checkLocation(this, player.getLocation(), radius)) found.add(new dPlayer(player)); - + Collections.sort(found, new Comparator() { @Override public int compare(dPlayer pl1, dPlayer pl2) { @@ -519,7 +519,7 @@ public int compare(dPlayer pl1, dPlayer pl2) { return new dList(found).getAttribute(attribute); } - + // <--[tag] // @attribute // @returns dList @@ -535,7 +535,7 @@ else if (attribute.startsWith("npcs") for (dNPC npc : DenizenAPI.getSpawnedNPCs()) if (Utilities.checkLocation(this, npc.getLocation(), radius)) found.add(npc); - + Collections.sort(found, new Comparator() { @Override public int compare(dNPC npc1, dNPC npc2) { @@ -545,7 +545,7 @@ public int compare(dNPC npc1, dNPC npc2) { return new dList(found).getAttribute(attribute); } - + // <--[tag] // @attribute // @returns dList @@ -561,7 +561,7 @@ else if (attribute.startsWith("npcs") for (dNPC npc : DenizenAPI.getSpawnedNPCs()) if (Utilities.checkLocation(this, npc.getLocation(), radius)) found.add(npc); - + Collections.sort(found, new Comparator() { @Override public int compare(dNPC npc1, dNPC npc2) { @@ -587,7 +587,7 @@ else if (attribute.startsWith("entities") for (Entity entity : getWorld().getEntities()) if (Utilities.checkLocation(this, entity.getLocation(), radius)) found.add(new dEntity(entity)); - + Collections.sort(found, new Comparator() { @Override public int compare(dEntity ent1, dEntity ent2) { @@ -627,7 +627,7 @@ public int compare(dEntity ent1, dEntity ent2) { return new Element("null").getAttribute(attribute); } - + // <--[tag] // @attribute // @returns dInventory @@ -707,7 +707,7 @@ public int compare(dEntity ent1, dEntity ent2) { // Returns the horizontal distance between 2 locations. // --> if (attribute.getAttribute(2).startsWith("horizontal")) { - + // <--[tag] // @attribute ].horizontal.multiworld> // @returns Element(Number) @@ -733,7 +733,7 @@ else if (this.getWorld() == toLocation.getWorld()) // Returns the vertical distance between 2 locations. // --> else if (attribute.getAttribute(2).startsWith("vertical")) { - + // <--[tag] // @attribute ].vertical.multiworld> // @returns Element(Number) @@ -841,7 +841,7 @@ else return new Element(this.distance(toLocation)) if (attribute.startsWith("pitch")) { return new Element(getPitch()).getAttribute(attribute.fulfill(1)); } - + // <--[tag] // @attribute // @returns Element(Number) @@ -852,7 +852,7 @@ else return new Element(this.distance(toLocation)) return new Element(getYaw()) .getAttribute(attribute.fulfill(2)); } - + // <--[tag] // @attribute // @returns Element(Number) @@ -863,7 +863,7 @@ else return new Element(this.distance(toLocation)) return new Element(Rotation.normalizeYaw(getYaw())) .getAttribute(attribute.fulfill(1)); } - + // <--[tag] // @attribute ]> // @returns Element(Boolean) @@ -873,13 +873,13 @@ else return new Element(this.distance(toLocation)) // --> if (attribute.startsWith("facing")) { if (attribute.hasContext(1)) { - + // The default number of degrees if there is no degrees attribute int degrees = 45; - + // The attribute to fulfill from int attributePos = 1; - + // <--[tag] // @attribute ].degrees[X]> // @returns Element(Boolean) @@ -891,11 +891,11 @@ else return new Element(this.distance(toLocation)) if (attribute.getAttribute(2).startsWith("degrees") && attribute.hasContext(2) && aH.matchesInteger(attribute.getContext(2))) { - + degrees = attribute.getIntContext(2); attributePos++; } - + if (dLocation.matches(attribute.getContext(1))) { return new Element(Rotation.isFacingLocation (this, dLocation.valueOf(attribute.getContext(1)), degrees)) @@ -906,10 +906,10 @@ else if (dEntity.matches(attribute.getContext(1))) { (this, dEntity.valueOf(attribute.getContext(1)) .getBukkitEntity().getLocation(), degrees)) .getAttribute(attribute.fulfill(attributePos)); - } + } } } - + // <--[tag] // @attribute // @returns Element(Number) @@ -942,14 +942,14 @@ else if (dEntity.matches(attribute.getContext(1))) { return Element.TRUE.getAttribute(attribute.fulfill(1)); return Element.FALSE.getAttribute(attribute.fulfill(1)); } - + // Check if the player is in any region else { return new Element(WorldGuardUtilities.inRegion(this)) .getAttribute(attribute.fulfill(1)); } } - + // <--[tag] // @attribute // @returns dList diff --git a/src/main/java/net/aufdemrand/denizen/objects/dMaterial.java b/src/main/java/net/aufdemrand/denizen/objects/dMaterial.java index 1c79ea8246..18dfa4b24f 100644 --- a/src/main/java/net/aufdemrand/denizen/objects/dMaterial.java +++ b/src/main/java/net/aufdemrand/denizen/objects/dMaterial.java @@ -12,11 +12,11 @@ public class dMaterial implements dObject { final static Pattern materialPattern = Pattern.compile("(?:m@)?(\\w+)[,:]?(\\d+)?", Pattern.CASE_INSENSITIVE); - + ////////////////// // OBJECT FETCHER //////////////// - + /** * Gets a Material Object from a string form. * @@ -29,42 +29,42 @@ public static dMaterial valueOf(String string) { if (string.toLowerCase().matches("random") || string.toLowerCase().matches("m@random")) { - + // Get a random material return new dMaterial(Material.values()[Utilities.getRandom().nextInt(Material.values().length)]); } - + Matcher m = materialPattern.matcher(string); - + if (m.matches()) { - + int data = -1; - + if (m.group(2) != null) { - + data = aH.getIntegerFrom(m.group(2)); } - + if (aH.matchesInteger(m.group(1))) { - - return new dMaterial(aH.getIntegerFrom(m.group(1)), data); + + return new dMaterial(aH.getIntegerFrom(m.group(1)), data); } else { - + for (Material material : Material.values()) { - + if (material.name().equalsIgnoreCase(m.group(1))) { - + return new dMaterial(material, data); } } } } - + // No match return null; } - + /** * Determine whether a string is a valid material. * @@ -76,14 +76,14 @@ public static boolean matches(String arg) { if (arg.toUpperCase().matches("RANDOM")) return true; - + Matcher m = materialPattern.matcher(arg); - + return m.matches(); } - - + + /////////////// // Constructors ///////////// @@ -91,25 +91,25 @@ public static boolean matches(String arg) { public dMaterial(Material material) { this.material = material; } - + public dMaterial(Material material, int data) { this.material = material; if (data < 0) this.data = null; else this.data = (byte) data; } - + public dMaterial(int id) { this.material = Material.getMaterial(id); } - + public dMaterial(int id, int data) { this.material = Material.getMaterial(id); if (data < 0) this.data = null; else this.data = (byte) data; } - + ///////////////////// // INSTANCE FIELDS/METHODS ///////////////// @@ -122,11 +122,11 @@ public dMaterial(int id, int data) { public Material getMaterial() { return material; } - + public String name() { return material.name(); } - + public Byte getData() { return data; } @@ -140,7 +140,7 @@ public boolean matchesMaterialData(MaterialData data) { return (material == data.getItemType() && data.equals(data.getData())); else return material == data.getItemType(); } - + public MaterialData getMaterialData() { return new MaterialData(material, data != null ? data : 0); } @@ -196,7 +196,7 @@ public String getAttribute(Attribute attribute) { if (attribute.startsWith("has_gravity")) return new Element(material.hasGravity()) .getAttribute(attribute.fulfill(1)); - + // <--[tag] // @attribute // @returns Element(integer) @@ -206,7 +206,7 @@ public String getAttribute(Attribute attribute) { if (attribute.startsWith("id")) return new Element(material.getId()) .getAttribute(attribute.fulfill(1)); - + // <--[tag] // @attribute // @returns Element(boolean) @@ -216,7 +216,7 @@ public String getAttribute(Attribute attribute) { if (attribute.startsWith("is_block")) return new Element(material.isBlock()) .getAttribute(attribute.fulfill(1)); - + // <--[tag] // @attribute // @returns Element(boolean) @@ -226,7 +226,7 @@ public String getAttribute(Attribute attribute) { if (attribute.startsWith("is_burnable")) return new Element(material.isBurnable()) .getAttribute(attribute.fulfill(1)); - + // <--[tag] // @attribute // @returns Element(boolean) @@ -236,7 +236,7 @@ public String getAttribute(Attribute attribute) { if (attribute.startsWith("is_edible")) return new Element(material.isEdible()) .getAttribute(attribute.fulfill(1)); - + // <--[tag] // @attribute // @returns Element(boolean) @@ -246,7 +246,7 @@ public String getAttribute(Attribute attribute) { if (attribute.startsWith("is_flammable")) return new Element(material.isFlammable()) .getAttribute(attribute.fulfill(1)); - + // <--[tag] // @attribute // @returns Element(boolean) @@ -256,7 +256,7 @@ public String getAttribute(Attribute attribute) { if (attribute.startsWith("is_occluding")) return new Element(material.isOccluding()) .getAttribute(attribute.fulfill(1)); - + // <--[tag] // @attribute // @returns Element(boolean) @@ -266,7 +266,7 @@ public String getAttribute(Attribute attribute) { if (attribute.startsWith("is_record")) return new Element(material.isRecord()) .getAttribute(attribute.fulfill(1)); - + // <--[tag] // @attribute // @returns Element(boolean) @@ -276,7 +276,7 @@ public String getAttribute(Attribute attribute) { if (attribute.startsWith("is_solid")) return new Element(material.isSolid()) .getAttribute(attribute.fulfill(1)); - + // <--[tag] // @attribute // @returns Element(boolean) @@ -286,7 +286,7 @@ public String getAttribute(Attribute attribute) { if (attribute.startsWith("is_transparent")) return new Element(material.isTransparent()) .getAttribute(attribute.fulfill(1)); - + // <--[tag] // @attribute // @returns Element(integer) @@ -296,7 +296,7 @@ public String getAttribute(Attribute attribute) { if (attribute.startsWith("max_durability")) return new Element(material.getMaxDurability()) .getAttribute(attribute.fulfill(1)); - + // <--[tag] // @attribute // @returns Element(integer) @@ -306,7 +306,7 @@ public String getAttribute(Attribute attribute) { if (attribute.startsWith("max_stack_size")) return new Element(material.getMaxStackSize()) .getAttribute(attribute.fulfill(1)); - + return new Element(identify()).getAttribute(attribute.fulfill(0)); } diff --git a/src/main/java/net/aufdemrand/denizen/objects/dNPC.java b/src/main/java/net/aufdemrand/denizen/objects/dNPC.java index ed4382370e..81018eb369 100644 --- a/src/main/java/net/aufdemrand/denizen/objects/dNPC.java +++ b/src/main/java/net/aufdemrand/denizen/objects/dNPC.java @@ -104,7 +104,7 @@ public LivingEntity getEntity() { return null; } } - + public dEntity getDenizenEntity() { try { return new dEntity(getCitizen().getBukkitEntity()); @@ -141,7 +141,7 @@ public InteractScriptContainer getInteractScriptQuietly(dPlayer player, Class // @returns Element @@ -363,7 +363,7 @@ && getCitizen().getTrait(Anchors.class).getAnchor(attribute.getContext(1)) != nu // --> if (attribute.startsWith("owner")) return new Element(getOwner()).getAttribute(attribute.fulfill(1)); - + // <--[tag] // @attribute // @returns dInventory diff --git a/src/main/java/net/aufdemrand/denizen/objects/dPlayer.java b/src/main/java/net/aufdemrand/denizen/objects/dPlayer.java index 5a5bdd70a0..dc9d5cbb94 100644 --- a/src/main/java/net/aufdemrand/denizen/objects/dPlayer.java +++ b/src/main/java/net/aufdemrand/denizen/objects/dPlayer.java @@ -289,7 +289,7 @@ public String getAttribute(Attribute attribute) { // --> if (attribute.startsWith("is_online")) return new Element(isOnline()).getAttribute(attribute.fulfill(1)); - + // <--[tag] // @attribute // @returns Element @@ -298,7 +298,7 @@ public String getAttribute(Attribute attribute) { // --> if (attribute.startsWith("ip")) return new Element(getPlayerEntity().getAddress().getHostName()).getAttribute(attribute.fulfill(1)); - + // <--[tag] // @attribute // @returns dList(dPlayer) @@ -309,7 +309,7 @@ public String getAttribute(Attribute attribute) { // --> if (attribute.startsWith("list")) { List players = new ArrayList(); - + // <--[tag] // @attribute // @returns dList(dPlayer) @@ -323,7 +323,7 @@ public String getAttribute(Attribute attribute) { players.add(player.getName()); return new dList(players).getAttribute(attribute.fulfill(2)); } - + // <--[tag] // @attribute // @returns dList(dPlayer) @@ -462,7 +462,7 @@ else return new Element(PlayerTags.playerChatHistory.get(player_name).get(x - 1) // --> if (attribute.startsWith("xp.to_next_level")) return new Element(getPlayerEntity().getExpToLevel()) - .getAttribute(attribute.fulfill(2)); + .getAttribute(attribute.fulfill(2)); // <--[tag] // @attribute diff --git a/src/main/java/net/aufdemrand/denizen/objects/dWorld.java b/src/main/java/net/aufdemrand/denizen/objects/dWorld.java index ce4d0de082..30bd4345b2 100644 --- a/src/main/java/net/aufdemrand/denizen/objects/dWorld.java +++ b/src/main/java/net/aufdemrand/denizen/objects/dWorld.java @@ -67,11 +67,11 @@ public static boolean matches(String arg) { public World getWorld() { return Bukkit.getWorld(world_name); } - + public String getName() { return world_name; } - + public List getEntities() { return getWorld().getEntities(); } @@ -132,11 +132,11 @@ public dObject setPrefix(String prefix) { public String getAttribute(Attribute attribute) { if (attribute == null) return null; - + ///////////////////// // ENTITY LIST ATTRIBUTES ///////////////// - + // <--[tag] // @attribute // @returns dList(dPlayer) @@ -151,7 +151,7 @@ public String getAttribute(Attribute attribute) { return new dList(entities) .getAttribute(attribute.fulfill(1)); } - + // <--[tag] // @attribute // @returns dList(dPlayer) @@ -166,7 +166,7 @@ public String getAttribute(Attribute attribute) { return new dList(entities) .getAttribute(attribute.fulfill(1)); } - + // <--[tag] // @attribute // @returns dList(dPlayer) @@ -181,12 +181,12 @@ public String getAttribute(Attribute attribute) { return new dList(players) .getAttribute(attribute.fulfill(1)); } - - + + ///////////////////// // DEBUG ATTRIBUTES ///////////////// - + // <--[tag] // @attribute // @returns Element @@ -196,12 +196,12 @@ public String getAttribute(Attribute attribute) { if (attribute.startsWith("prefix")) return new Element(prefix) .getAttribute(attribute.fulfill(1)); - - + + ///////////////////// // GEOGRAPHY ATTRIBUTES ///////////////// - + // <--[tag] // @attribute // @returns dLocation @@ -227,11 +227,11 @@ public String getAttribute(Attribute attribute) { return new Element(getWorld().getSeaLevel()) .getAttribute(attribute.fulfill(1)); - + ///////////////////// // IDENTIFICATION ATTRIBUTES ///////////////// - + // <--[tag] // @attribute // @returns Element @@ -241,7 +241,7 @@ public String getAttribute(Attribute attribute) { if (attribute.startsWith("name")) return new Element(getWorld().getName()) .getAttribute(attribute.fulfill(1)); - + // <--[tag] // @attribute // @returns Element @@ -251,12 +251,12 @@ public String getAttribute(Attribute attribute) { if (attribute.startsWith("seed")) return new Element(getWorld().getSeed()) .getAttribute(attribute.fulfill(1)); - - + + ///////////////////// // SETTINGS ATTRIBUTES ///////////////// - + // <--[tag] // @attribute // @returns Element(boolean) @@ -266,7 +266,7 @@ public String getAttribute(Attribute attribute) { if (attribute.startsWith("allows_animals")) return new Element(getWorld().getAllowAnimals()) .getAttribute(attribute.fulfill(1)); - + // <--[tag] // @attribute // @returns Element(boolean) @@ -276,7 +276,7 @@ public String getAttribute(Attribute attribute) { if (attribute.startsWith("allows_monsters")) return new Element(getWorld().getAllowMonsters()) .getAttribute(attribute.fulfill(1)); - + // <--[tag] // @attribute // @returns Element(boolean) @@ -286,7 +286,7 @@ public String getAttribute(Attribute attribute) { if (attribute.startsWith("allows_pvp")) return new Element(getWorld().getPVP()) .getAttribute(attribute.fulfill(1)); - + // <--[tag] // @attribute // @returns Element(integer) @@ -296,7 +296,7 @@ public String getAttribute(Attribute attribute) { if (attribute.startsWith("ambient_spawn_limit")) return new Element(getWorld().getAmbientSpawnLimit()) .getAttribute(attribute.fulfill(1)); - + // <--[tag] // @attribute // @returns Element(integer) @@ -306,7 +306,7 @@ public String getAttribute(Attribute attribute) { if (attribute.startsWith("animal_spawn_limit")) return new Element(getWorld().getAnimalSpawnLimit()) .getAttribute(attribute.fulfill(1)); - + // <--[tag] // @attribute // @returns Element(boolean) @@ -316,7 +316,7 @@ public String getAttribute(Attribute attribute) { if (attribute.startsWith("can_generate_structures")) return new Element(getWorld().canGenerateStructures()) .getAttribute(attribute.fulfill(1)); - + // <--[tag] // @attribute // @returns Element @@ -326,7 +326,7 @@ public String getAttribute(Attribute attribute) { if (attribute.startsWith("difficulty")) return new Element(getWorld().getDifficulty().name()) .getAttribute(attribute.fulfill(1)); - + // <--[tag] // @attribute // @returns Element(integer) @@ -336,7 +336,7 @@ public String getAttribute(Attribute attribute) { if (attribute.startsWith("max_height")) return new Element(getWorld().getMaxHeight()) .getAttribute(attribute.fulfill(1)); - + // <--[tag] // @attribute // @returns Element(integer) @@ -346,7 +346,7 @@ public String getAttribute(Attribute attribute) { if (attribute.startsWith("monster_spawn_limit")) return new Element(getWorld().getMonsterSpawnLimit()) .getAttribute(attribute.fulfill(1)); - + // <--[tag] // @attribute // @returns Element(long) @@ -356,7 +356,7 @@ public String getAttribute(Attribute attribute) { if (attribute.startsWith("ticks_per_animal_spawn")) return new Element(getWorld().getTicksPerAnimalSpawns() ) .getAttribute(attribute.fulfill(1)); - + // <--[tag] // @attribute // @returns Element(long) @@ -366,7 +366,7 @@ public String getAttribute(Attribute attribute) { if (attribute.startsWith("ticks_per_monster_spawn")) return new Element(getWorld().getTicksPerMonsterSpawns() ) .getAttribute(attribute.fulfill(1)); - + // <--[tag] // @attribute // @returns Element(integer) @@ -376,12 +376,12 @@ public String getAttribute(Attribute attribute) { if (attribute.startsWith("water_animal_spawn_limit")) return new Element(getWorld().getWaterAnimalSpawnLimit()) .getAttribute(attribute.fulfill(1)); - - + + ///////////////////// // TIME ATTRIBUTES ///////////////// - + // Return "day", "night", "dawn" or "dusk" // <--[tag] // @attribute @@ -390,18 +390,18 @@ public String getAttribute(Attribute attribute) { // returns the time as day, night, dawn, or dusk // --> if (attribute.startsWith("time.period")) { - + long time = getWorld().getTime(); String period; - - if (time >= 23000) period = "dawn"; + + if (time >= 23000) period = "dawn"; else if (time >= 13500) period = "night"; else if (time >= 12500) period = "dusk"; else period = "day"; - + return new Element(period).getAttribute(attribute.fulfill(2)); } - + // <--[tag] // @attribute // @returns Element(long) @@ -412,11 +412,11 @@ public String getAttribute(Attribute attribute) { return new Element(getWorld().getTime()) .getAttribute(attribute.fulfill(1)); - + ///////////////////// // WEATHER ATTRIBUTES ///////////////// - + // <--[tag] // @attribute // @returns Element(boolean) @@ -426,7 +426,7 @@ public String getAttribute(Attribute attribute) { if (attribute.startsWith("has_storm")) return new Element(getWorld().hasStorm()) .getAttribute(attribute.fulfill(1)); - + // <--[tag] // @attribute // @returns Element diff --git a/src/main/java/net/aufdemrand/denizen/scripts/ScriptBuilder.java b/src/main/java/net/aufdemrand/denizen/scripts/ScriptBuilder.java index 1cea873df5..0daf76de4f 100644 --- a/src/main/java/net/aufdemrand/denizen/scripts/ScriptBuilder.java +++ b/src/main/java/net/aufdemrand/denizen/scripts/ScriptBuilder.java @@ -31,8 +31,8 @@ public static List addObjectToEntries(List scriptEntry return scriptEntryList; } - /* - * Builds ScriptEntry(ies) of items read from a script + /* + * Builds ScriptEntry(ies) of items read from a script */ public static List buildScriptEntries(List contents, ScriptContainer parent, dPlayer player, dNPC npc) { diff --git a/src/main/java/net/aufdemrand/denizen/scripts/ScriptHelper.java b/src/main/java/net/aufdemrand/denizen/scripts/ScriptHelper.java index 9f8f1119a0..a5cc747264 100644 --- a/src/main/java/net/aufdemrand/denizen/scripts/ScriptHelper.java +++ b/src/main/java/net/aufdemrand/denizen/scripts/ScriptHelper.java @@ -148,4 +148,4 @@ private static String yamlKeysToUpperCase(String string) { return sb.toString(); } -} \ No newline at end of file +} diff --git a/src/main/java/net/aufdemrand/denizen/scripts/commands/AbstractCommand.java b/src/main/java/net/aufdemrand/denizen/scripts/commands/AbstractCommand.java index df2cfed480..437fd8cf7d 100644 --- a/src/main/java/net/aufdemrand/denizen/scripts/commands/AbstractCommand.java +++ b/src/main/java/net/aufdemrand/denizen/scripts/commands/AbstractCommand.java @@ -13,22 +13,22 @@ public abstract class AbstractCommand implements RegistrationableInstance { /** * Contains required options for a Command in a single class for the * ability to add optional options in the future. - * + * * {@see withOptions} for information on using CommandOptions with this command. - * + * */ - public class CommandOptions { + public class CommandOptions { public String USAGE_HINT; public int REQUIRED_ARGS; - + public CommandOptions(String usageHint, int numberOfRequiredArgs) { this.USAGE_HINT = usageHint; this.REQUIRED_ARGS = numberOfRequiredArgs; } } - + public Denizen denizen; - + protected String name; public CommandOptions commandOptions; @@ -47,95 +47,95 @@ public AbstractCommand as(String commandName) { onEnable(); return this; } - + public abstract void execute(ScriptEntry scriptEntry) throws CommandExecutionException; - + @Override public String getName() { return name; } - + /** * Returns the {@link CommandOptions} specified at startup. - * + * * @return commandOptions - * + * */ public CommandOptions getOptions() { return commandOptions; } - + /** * Returns USAGE_HINT specified in the {@link CommandOptions}, if specified. - * + * * @return USAGE_HINT if specified, otherwise "No usage defined! See documentation for more information!" - * + * */ public String getUsageHint() { return !commandOptions.USAGE_HINT.equals("") ? commandOptions.USAGE_HINT : "No usage defined! See documentation for more information!"; } - + /** * Part of the Plugin disable sequence. - * + * * Can be '@Override'n by a Command which requires a method when bukkit sends a * onDisable() to Denizen. (ie. Server shuts down or restarts) - * + * */ public void onDisable() { - + } /** - * Part of the Plugin enable sequence. This is called when the command is + * Part of the Plugin enable sequence. This is called when the command is * instanced by the CommandRegistry, which is generally on a server startup. - * + * * Can be '@Override'n by a Command which requires a method when starting, such * as registering as a Bukkit Listener. - * + * */ public void onEnable() { - + } - + /** * Called by the CommandExecuter before the execute() method is called. Arguments * should be iterated through and checked before continuing to execute(). Note that * PLAYER:player_name and NPCID:# arguments are parsed automatically by the Executer * and should not be handled by this Command otherwise. Their output is stored in the - * attached {@link ScriptEntry} and can be retrieved with scriptEntry.getPlayer(), + * attached {@link ScriptEntry} and can be retrieved with scriptEntry.getPlayer(), * scriptEntry.getOfflinePlayer() (if the player specified is not online), and * scriptEntry.getNPC(). Remember that any of these have a possibility of being null * and should be handled accordingly if required by this Command. - * + * * @param scriptEntry * The {@link ScriptEntry}, which contains run-time context that may * be utilized by this Command. * @throws InvalidArgumentsException * Will halt execution of this Command and hint usage to the console to avoid * unwanted behavior due to missing information. - * + * */ public abstract void parseArgs(ScriptEntry scriptEntry) throws InvalidArgumentsException; - + /** * Creates a new {@link CommandOptions} for this command. - * + * * @param usageHint * A String representation of the suggested usage format of this command. * Typically []'s represent required arguments and ()'s represent optional arguments. - * Example from SWITCH command: [LOCATION:x,y,z,world] (STATE:ON|OFF|TOGGLE) (DURATION:#) + * Example from SWITCH command: [LOCATION:x,y,z,world] (STATE:ON|OFF|TOGGLE) (DURATION:#) * @param numberOfRequiredArgs * The minimum number of required arguments needed to ensure proper functionality. The * Executer will not parseArgs() for this command if this number is not met. * @return * The newly created CommandOptions object for the possibility of setting other * criteria, though currently none exists. - * + * */ public CommandOptions withOptions(String usageHint, int numberOfRequiredArgs) { this.commandOptions = new CommandOptions(usageHint, numberOfRequiredArgs); return commandOptions; } - + } diff --git a/src/main/java/net/aufdemrand/denizen/scripts/commands/BracedCommand.java b/src/main/java/net/aufdemrand/denizen/scripts/commands/BracedCommand.java index 48b697fcf3..9e4e648371 100644 --- a/src/main/java/net/aufdemrand/denizen/scripts/commands/BracedCommand.java +++ b/src/main/java/net/aufdemrand/denizen/scripts/commands/BracedCommand.java @@ -11,12 +11,12 @@ import net.aufdemrand.denizen.utilities.debugging.dB; public abstract class BracedCommand extends AbstractCommand { - + public final boolean hyperdebug = false; /** * Gets the commands inside the braces of this ScriptEntry. - * + * * @param scriptEntry * The ScriptEntry to get the braced commands from. * @@ -24,16 +24,16 @@ public abstract class BracedCommand extends AbstractCommand { * The argument to start at. * @return * The list of ScriptEntries to be executed in the command. - * + * * @throws InvalidArgumentsException */ public ArrayList getBracedCommands(ScriptEntry scriptEntry, int startArg) throws InvalidArgumentsException { - + // We need a place to store the commands being built at... TreeMap> commandList = new TreeMap>(); // And a place to store finished commands... ArrayList commands = new ArrayList(); - + int bracesEntered = 0; boolean newCommand = true; @@ -41,7 +41,7 @@ public ArrayList getBracedCommands(ScriptEntry scriptEntry, int sta scriptEntry.getResidingQueue().injectEntry(scriptEntry, 0); // Send info to debug if (hyperdebug) dB.echoDebug("Starting getBracedCommands..."); - + // If the specified amount of possible entries is less than the queue size, print that instead if (hyperdebug) dB.echoDebug("...with queue size: " + scriptEntry.getResidingQueue().getQueueSize()); if (hyperdebug) dB.echoDebug("...with first command name: " + scriptEntry.getCommandName()); @@ -49,13 +49,13 @@ public ArrayList getBracedCommands(ScriptEntry scriptEntry, int sta ScriptEntry entry = scriptEntry.getResidingQueue().getEntry(0); if (hyperdebug) dB.echoDebug("Entry found: " + entry.getCommandName()); - + // Loop through the arguments of each entry List argList = aH.interpret(entry.getArguments()); for (int i = startArg;i < argList.size(); i++) { aH.Argument arg = argList.get(i); if (hyperdebug) dB.echoDebug("Arg found: " + arg.raw_value); - + // Listen for opened braces if (arg.matches("{")) { bracesEntered++; @@ -65,7 +65,7 @@ public ArrayList getBracedCommands(ScriptEntry scriptEntry, int sta commandList.get(commandList.lastKey()).add(arg.raw_value); } } - + // Listen for closed braces else if (arg.matches("}")) { bracesEntered--; @@ -75,7 +75,7 @@ else if (arg.matches("}")) { commandList.get(commandList.lastKey()).add(arg.raw_value); } } - + // Finish building a command else if (newCommand && bracesEntered <= 1) { commandList.put(commandList.size(), new ArrayList()); @@ -83,13 +83,13 @@ else if (newCommand && bracesEntered <= 1) { newCommand = false; if (hyperdebug) dB.echoDebug("Treating as new command"); } - + // Start building a command else if (arg.matches("-") && bracesEntered == 1) { newCommand = true; if (hyperdebug) dB.echoDebug("Assuming following is a new command"); } - + // Continue building the current command else { newCommand = false; @@ -97,7 +97,7 @@ else if (arg.matches("-") && bracesEntered == 1) { if (hyperdebug) dB.echoDebug("Adding to the command"); } } - + // Add all the new commands to the final list for (ArrayList command : commandList.values()) { try { @@ -120,10 +120,10 @@ else if (arg.matches("-") && bracesEntered == 1) { if (hyperdebug) dB.echoError(e.getMessage()); } } - + // Remove the commands from the current queue, so there's no YAML errors scriptEntry.getResidingQueue().removeEntry(0); - + // Return the list of commands in the braces return commands; } diff --git a/src/main/java/net/aufdemrand/denizen/scripts/commands/CommandExecuter.java b/src/main/java/net/aufdemrand/denizen/scripts/commands/CommandExecuter.java index 374019c598..ceeac9f02d 100644 --- a/src/main/java/net/aufdemrand/denizen/scripts/commands/CommandExecuter.java +++ b/src/main/java/net/aufdemrand/denizen/scripts/commands/CommandExecuter.java @@ -30,7 +30,7 @@ public CommandExecuter(Denizen denizen) { } /* - * Executes a command defined in scriptEntry + * Executes a command defined in scriptEntry */ public boolean execute(ScriptEntry scriptEntry) { @@ -202,10 +202,10 @@ else if (arg.matchesPrefix("save") && !if_ignore) { dB.echoError("Enable '/denizen stacktrace' for the nitty-gritty."); else e.printStackTrace(); } - + } return true; } - + } diff --git a/src/main/java/net/aufdemrand/denizen/scripts/commands/CommandRegistry.java b/src/main/java/net/aufdemrand/denizen/scripts/commands/CommandRegistry.java index 42bbfa12a6..e17b31343c 100644 --- a/src/main/java/net/aufdemrand/denizen/scripts/commands/CommandRegistry.java +++ b/src/main/java/net/aufdemrand/denizen/scripts/commands/CommandRegistry.java @@ -90,7 +90,7 @@ public void registerCoreMembers() { // --> registerCoreMember(AnchorCommand.class, "ANCHOR", "anchor [id:] [assume/remove/add /walkto/walknear (r:#)]", 2); - + // <--[command] // @Name Animate // @Usage animate [|...] [animation:] @@ -109,7 +109,7 @@ public void registerCoreMembers() { // --> registerCoreMember(AnimateCommand.class, "ANIMATE", "animate [|...] [animation:]", 1); - + // <--[command] // @Name AnimateChest // @Usage animatechest [] ({open}/close) (sound:{true}/false) @@ -128,7 +128,7 @@ public void registerCoreMembers() { // --> registerCoreMember(AnimateChestCommand.class, "ANIMATECHEST", "animatechest [] ({open}/close) (sound:{true}/false)", 1); - + // <--[command] // @Name Announce // @Usage announce [""] (to_ops) (to_flagged:) @@ -147,7 +147,7 @@ public void registerCoreMembers() { // --> registerCoreMember(AnnounceCommand.class, "ANNOUNCE", "announce [\"\"] (to_ops) (to_flagged:)", 1); - + // <--[command] // @Name Assignment // @Usage assignment [{set}/remove] (script:) @@ -166,7 +166,7 @@ public void registerCoreMembers() { // --> registerCoreMember(AssignmentCommand.class, "ASSIGNMENT", "assignment [{set}/remove] (script:)", 1); - + // <--[command] // @Name Attack // @Usage attack (cancel) (|...) (target:) @@ -183,7 +183,7 @@ public void registerCoreMembers() { // @Example // Todo // --> - registerCoreMember(AttackCommand.class, + registerCoreMember(AttackCommand.class, "ATTACK", "attack (cancel) (|...) (target:)", 0); // <--[command] @@ -204,7 +204,7 @@ public void registerCoreMembers() { // --> registerCoreMember(BreakCommand.class, "BREAK", "break [] (entity:) (radius:<#.#>)", 1); - + // <--[command] // @Name Burn // @Usage burn [|...] (duration:) @@ -223,7 +223,7 @@ public void registerCoreMembers() { // --> registerCoreMember(BurnCommand.class, "BURN", "burn [|...] (duration:)", 1); - + // <--[command] // @Name Cast, Potion // @Usage cast [] (remove) (duration:) (power:<#>) (|...) @@ -253,9 +253,9 @@ public void registerCoreMembers() { // @Example TODO // // --> - registerCoreMember(CastCommand.class, + registerCoreMember(CastCommand.class, "CAST, POTION", "cast [] (remove) (duration:) (power:<#>) (|...)", 1); - + // <--[command] // @Name Chat // @Usage chat [""] (targets:|...) @@ -272,9 +272,9 @@ public void registerCoreMembers() { // @Example // Todo // --> - registerCoreMember(ChatCommand.class, + registerCoreMember(ChatCommand.class, "CHAT", "chat [\"\"] (targets:|...)", 1); - + // <--[command] // @Name ChunkLoad // @Usage chunkload ({add}/remove/removeall) [] (duration:) @@ -460,7 +460,7 @@ public void registerCoreMembers() { // @Example // Todo // --> - registerCoreMember(DetermineCommand.class, + registerCoreMember(DetermineCommand.class, "DETERMINE", "determine []", 1); // <--[command] @@ -468,19 +468,19 @@ public void registerCoreMembers() { // @Usage disengage (npc:) // @Required 0 // @Stable 1.0 - // @Short Enables a NPCs triggers that have been temporarily disabled by the engage command. + // @Short Enables a NPCs triggers that have been temporarily disabled by the engage command. // @Author aufdemrand // // @Description - // Re-enables any toggled triggers that have been disabled by disengage. Using - // disengage inside scripts must have a NPC to reference, or one may be specified + // Re-enables any toggled triggers that have been disabled by disengage. Using + // disengage inside scripts must have a NPC to reference, or one may be specified // by supplying a valid dNPC object with the npc argument. // // This is mostly regarded as an 'interact script command', though it may be used inside // other script types. This is because disengage works with the trigger system, which is an - // interact script-container feature. + // interact script-container feature. // - // NPCs that are interacted with while engaged will fire an 'on unavailable' assignment + // NPCs that are interacted with while engaged will fire an 'on unavailable' assignment // script-container action. // // @See Engage Command @@ -495,7 +495,7 @@ public void registerCoreMembers() { // // @Example // --> - registerCoreMember(DisengageCommand.class, + registerCoreMember(DisengageCommand.class, "DISENGAGE", "disengage (npc:)", 0); // <--[command] @@ -533,9 +533,9 @@ public void registerCoreMembers() { // @Example // Todo // --> - registerCoreMember(DropCommand.class, + registerCoreMember(DropCommand.class, "DROP", "drop [//] [] (qty:<#>)", 1); - + // <--[command] // @Name Engage // @Usage engage () (npc:) @@ -545,8 +545,8 @@ public void registerCoreMembers() { // @Author aufdemrand // // @Description - // Engaging a NPC will temporarily disable any interact script-container triggers. To reverse - // this behavior, use either the disengage command, or specify a duration in which the engage + // Engaging a NPC will temporarily disable any interact script-container triggers. To reverse + // this behavior, use either the disengage command, or specify a duration in which the engage // should timeout. Specifying an engage without a duration will render the NPC engaged until // a disengage is used on the NPC. Engaging a NPC affects all players attempting to interact // with the NPC. @@ -581,7 +581,7 @@ public void registerCoreMembers() { // - flag player finished_quests:->:super_quest // // @Example - // + // // --> registerCoreMember(EngageCommand.class, "ENGAGE", "engage () (npc:)", 0); @@ -604,7 +604,7 @@ public void registerCoreMembers() { // --> registerCoreMember(EngraveCommand.class, "ENGRAVE", "engrave (set/remove)", 0); - + // <--[command] // @Name Equip // @Usage equip (player/{npc}) (hand:) (head:) (chest:) (legs:) (boots:) @@ -621,9 +621,9 @@ public void registerCoreMembers() { // @Example // Todo // --> - registerCoreMember(EquipCommand.class, + registerCoreMember(EquipCommand.class, "EQUIP", "equip (player/{npc}) (hand:) (head:) (chest:) (legs:) (boots:)", 1); - + // <--[command] // @Name Execute // @Usage execute [as_player/as_op/as_npc/as_server] [] @@ -680,7 +680,7 @@ public void registerCoreMembers() { // --> registerCoreMember(ExplodeCommand.class, "EXPLODE", "explode (power:<#.#>) () (fire) (breakblocks)", 0); - + // <--[command] // @Name Fail // @Usage fail (script:) @@ -697,9 +697,9 @@ public void registerCoreMembers() { // @Example // Todo // --> - registerCoreMember(FailCommand.class, + registerCoreMember(FailCommand.class, "FAIL", "fail (script:)", 0); - + // <--[command] // @Name Feed // @Usage feed (amt:<#>) (target:|...) @@ -716,7 +716,7 @@ public void registerCoreMembers() { // @Example // Todo // --> - registerCoreMember(FeedCommand.class, + registerCoreMember(FeedCommand.class, "FEED", "feed (amt:<#>) (target:|...)", 0); // <--[command] @@ -735,7 +735,7 @@ public void registerCoreMembers() { // @Example // Todo // --> - registerCoreMember(FinishCommand.class, + registerCoreMember(FinishCommand.class, "FINISH", "finish (script:)", 0); // <--[command] @@ -756,7 +756,7 @@ public void registerCoreMembers() { // --> registerCoreMember(FireworkCommand.class, "FIREWORK", "firework () (power:<#>) (type:/random) (primary:|...) (fade:|...) (flicker) (trail)", 0); - + // <--[command] // @Name Fish // @Usage fish (catchfish) (stop) () (catchpercent:<#>) @@ -773,7 +773,7 @@ public void registerCoreMembers() { // @Example // Todo // --> - registerCoreMember(FishCommand.class, + registerCoreMember(FishCommand.class, "FISH", "fish (catchfish) (stop) () (catchpercent:<#>)", 1); // <--[command] @@ -792,9 +792,9 @@ public void registerCoreMembers() { // @Example // Todo // --> - registerCoreMember(FlagCommand.class, + registerCoreMember(FlagCommand.class, "FLAG", "flag ({player}/npc/global) [([<#>])](:)[:] (duration:)", 1); - + // <--[command] // @Name Fly // @Usage fly (cancel) [|...] (origin:) (destinations:|...) (speed:<#.#>) @@ -813,7 +813,7 @@ public void registerCoreMembers() { // --> registerCoreMember(FlyCommand.class, "FLY", "fly (cancel) [|...] (origin:) (destinations:|...) (speed:<#.#>)", 1); - + // <--[command] // @Name Follow // @Usage follow (stop) (lead:<#.#>) (target:) @@ -830,9 +830,9 @@ public void registerCoreMembers() { // @Example // Todo // --> - registerCoreMember(FollowCommand.class, + registerCoreMember(FollowCommand.class, "FOLLOW", "follow (stop) (lead:<#.#>) (target:)", 0); - + // <--[command] // @Name ForEach // @Usage foreach [|...] [] @@ -842,7 +842,7 @@ public void registerCoreMembers() { // @Author Morphan1/mcmonkey // // @Description - // Loops through a dList of any type. For each item in the dList, the specified commands will be ran for + // Loops through a dList of any type. For each item in the dList, the specified commands will be ran for // that item. To call the value of the item while in the loop, you can use %value%. // // @Usage @@ -856,7 +856,7 @@ public void registerCoreMembers() { // --> registerCoreMember(ForEachCommand.class, "FOREACH", "foreach [|...] []", 2); - + // <--[command] // @Name Give // @Usage give [money/] (qty:<#>) (engrave) (to:) @@ -875,7 +875,7 @@ public void registerCoreMembers() { // --> registerCoreMember(GiveCommand.class, "GIVE", "give [money/] (qty:<#>) (engrave) (to:)", 1); - + // <--[command] // @Name Group // @Usage group [add/remove] [] (world:) @@ -894,7 +894,7 @@ public void registerCoreMembers() { // --> registerCoreMember(GroupCommand.class, "GROUP", "group [add/remove] [] (world:)", 2); - + // <--[command] // @Name Head // @Usage head (player) [skin:] @@ -913,7 +913,7 @@ public void registerCoreMembers() { // --> registerCoreMember(HeadCommand.class, "HEAD", "head (player) [skin:]", 0); - + // <--[command] // @Name Heal // @Usage heal (<#.#>) (|...) @@ -930,9 +930,9 @@ public void registerCoreMembers() { // @Example // Todo // --> - registerCoreMember(HealCommand.class, + registerCoreMember(HealCommand.class, "HEAL", "heal (<#.#>) (|...)", 0); - + // <--[command] // @Name Health // @Usage health [<#>] @@ -951,7 +951,7 @@ public void registerCoreMembers() { // --> registerCoreMember(HealthCommand.class, "HEALTH", "health [<#>]", 1); - + // <--[command] // @Name Hurt // @Usage hurt (<#.#>) (|...) @@ -970,7 +970,7 @@ public void registerCoreMembers() { // --> registerCoreMember(HurtCommand.class, "HURT", "hurt (<#.#>) (|...)", 0); - + // <--[command] // @Name If // @Usage if [] (!)( ) (&&/|| ...) [] (else ) @@ -987,7 +987,7 @@ public void registerCoreMembers() { // @Example // Todo // --> - registerCoreMember(IfCommand.class, + registerCoreMember(IfCommand.class, "IF", "if [] (!)( ) (&&/|| ...) [] (else )", 2); // <--[command] @@ -1046,7 +1046,7 @@ public void registerCoreMembers() { // --> registerCoreMember(InvisibleCommand.class, "INVISIBLE", "invisible [player/npc] [state:true/false/toggle]", 2); - + // <--[command] // @Name Leash // @Usage leash (cancel) [|...] (holder:/) @@ -1065,7 +1065,7 @@ public void registerCoreMembers() { // --> registerCoreMember(LeashCommand.class, "LEASH", "leash (cancel) [|...] (holder:/)", 1); - + // <--[command] // @Name Listen // @Usage listen ({new}/cancel/finish) [kill/block/item/itemdrop/travel] [] [script:] (id:) @@ -1084,7 +1084,7 @@ public void registerCoreMembers() { // --> registerCoreMember(ListenCommand.class, "LISTEN", "listen ({new}/cancel/finish) [kill/block/item/itemdrop/travel] [] [script:] (id:)", 2); - + // <--[command] // @Name Log // @Usage log [] (type:severe/info/warning/fine/finer/finest) [file:] @@ -1103,7 +1103,7 @@ public void registerCoreMembers() { // --> registerCoreMember(LogCommand.class, "LOG", "log [] (type:severe/info/warning/fine/finer/finest) [file:]", 2); - + // <--[command] // @Name Look // @Usage look (|...) [] (duration:) @@ -1122,7 +1122,7 @@ public void registerCoreMembers() { // --> registerCoreMember(LookCommand.class, "LOOK", "look (|...) [] (duration:)", 1); - + // <--[command] // @Name LookClose // @Usage lookclose [state:true/false] @@ -1141,7 +1141,7 @@ public void registerCoreMembers() { // --> registerCoreMember(LookcloseCommand.class, "LOOKCLOSE", "lookclose [state:true/false]", 1); - + // <--[command] // @Name Midi // @Usage midi [file:] [/listeners:|...] (tempo:<#.#>) @@ -1160,7 +1160,7 @@ public void registerCoreMembers() { // --> registerCoreMember(MidiCommand.class, "MIDI", "midi [file:] [/listeners:|...] (tempo:<#.#>)", 1); - + // <--[command] // @Name Mount // @Usage mount (cancel) [|...] () @@ -1179,7 +1179,7 @@ public void registerCoreMembers() { // --> registerCoreMember(MountCommand.class, "MOUNT", "mount (cancel) [|...] ()", 0); - + // <--[command] // @Name ModifyBlock // @Usage modifyblock [] [] (radius:<#>) (height:<#>) (depth:<#>) @@ -1198,7 +1198,7 @@ public void registerCoreMembers() { // --> registerCoreMember(ModifyBlockCommand.class, "MODIFYBLOCK", "modifyblock [] [] (radius:<#>) (height:<#>) (depth:<#>)", 2); - + // <--[command] // @Name Nameplate // @Usage nameplate [] [set:] (target:) +--> Requires ProtocolLib @@ -1217,7 +1217,7 @@ public void registerCoreMembers() { // --> registerCoreMember(NameplateCommand.class, "NAMEPLATE", "nameplate [] [set:] (target:) +--> Requires ProtocolLib", 1); - + // <--[command] // @Name Narrate // @Usage narrate [""] (targets:|...) (format:) @@ -1236,7 +1236,7 @@ public void registerCoreMembers() { // --> registerCoreMember(NarrateCommand.class, "NARRATE", "narrate [\"\"] (targets:|...) (format:)", 1); - + // <--[command] // @Name Note // @Usage note [] [as:] @@ -1255,7 +1255,7 @@ public void registerCoreMembers() { // --> registerCoreMember(NoteCommand.class, "NOTE", "note [] [as:]", 2); - + // <--[command] // @Name Oxygen // @Usage oxygen (type:maximum/remaining) (mode:set/add/remove) [qty:<#>] @@ -1274,7 +1274,7 @@ public void registerCoreMembers() { // --> registerCoreMember(OxygenCommand.class, "OXYGEN", "oxygen (type:maximum/remaining) (mode:set/add/remove) [qty:<#>]", 1); - + // <--[command] // @Name PlayEffect // @Usage playeffect [] [effect:] (data:<#.#>) (visibility:<#.#>) (qty:<#>) (offset:<#.#>) @@ -1293,7 +1293,7 @@ public void registerCoreMembers() { // --> registerCoreMember(PlayEffectCommand.class, "PLAYEFFECT", "playeffect [] [effect:] (data:<#.#>) (visibility:<#.#>) (qty:<#>) (offset:<#.#>)", 2); - + // <--[command] // @Name PlaySound // @Usage playsound [] [sound:] (volume:<#.#>) (pitch:<#.#>) @@ -1312,7 +1312,7 @@ public void registerCoreMembers() { // --> registerCoreMember(PlaySoundCommand.class, "PLAYSOUND", "playsound [] [sound:] (volume:<#.#>) (pitch:<#.#>)", 2); - + // <--[command] // @Name Permission // @Usage permission [add|remove] [permission] (player:) (group:) (world:) @@ -1369,7 +1369,7 @@ public void registerCoreMembers() { // --> registerCoreMember(PauseCommand.class, "PAUSE", "pause [waypoints/navigation]", 1); - + // <--[command] // @Name Queue // @Usage queue (queue:) [clear/pause/resume/delay:<#>] @@ -1388,7 +1388,7 @@ public void registerCoreMembers() { // --> registerCoreMember(QueueCommand.class, "QUEUE", "queue (queue:) [clear/pause/resume/delay:<#>]", 1); - + // <--[command] // @Name Random // @Usage random [<#>] @@ -1405,9 +1405,9 @@ public void registerCoreMembers() { // @Example // Todo // --> - registerCoreMember(RandomCommand.class, + registerCoreMember(RandomCommand.class, "RANDOM", "random [<#>]", 1); - + // <--[command] // @Name Remove // @Usage remove [|...] (region:) @@ -1424,7 +1424,7 @@ public void registerCoreMembers() { // @Example // Todo // --> - registerCoreMember(RemoveCommand.class, + registerCoreMember(RemoveCommand.class, "REMOVE", "remove [|...] (region:)", 0); // <--[command] @@ -1541,7 +1541,7 @@ public void registerCoreMembers() { // --> registerCoreMember(ScoreboardCommand.class, "SCOREBOARD", "scoreboard [set/remove/show/hide] [] [value:] (priority:<#>)", 1); - + // <--[command] // @Name Scribe // @Usage scribe [script:] (give/drop/equip) () () @@ -1579,7 +1579,7 @@ public void registerCoreMembers() { // --> registerCoreMember(ShootCommand.class, "SHOOT", "shoot [|...] (origin:/) (destination:) (height:<#.#>) (gravity:<#.#>) (script:)", 1); - + // <--[command] // @Name ShowFake // @Usage showfake [] [|...] (d:{10s}) @@ -1615,9 +1615,9 @@ public void registerCoreMembers() { // @Example // Todo // --> - registerCoreMember(SignCommand.class, + registerCoreMember(SignCommand.class, "SIGN", "sign (type:{sign_post}/wall_sign) [\"|...\"] [] (direction:n/e/w/s)", 1); - + // <--[command] // @Name Sit // @Usage sit () @@ -1634,7 +1634,7 @@ public void registerCoreMembers() { // @Example // Todo // --> - registerCoreMember(SitCommand.class, + registerCoreMember(SitCommand.class, "SIT", "sit ()", 0); // <--[command] @@ -1655,7 +1655,7 @@ public void registerCoreMembers() { // --> registerCoreMember(SpawnCommand.class, "SPAWN", "spawn [|...] () (target:)", 1); - + // <--[command] // @Name Stand // @Usage stand @@ -1672,9 +1672,9 @@ public void registerCoreMembers() { // @Example // Todo // --> - registerCoreMember(StandCommand.class, + registerCoreMember(StandCommand.class, "STAND", "stand", 0); - + // <--[command] // @Name Strike // @Usage strike (no_damage) [] @@ -1693,7 +1693,7 @@ public void registerCoreMembers() { // --> registerCoreMember(StrikeCommand.class, "STRIKE", "strike (no_damage) []", 1); - + // <--[command] // @Name Switch // @Usage switch [] (state:[{toggle}/on/off]) (duration:) @@ -1712,7 +1712,7 @@ public void registerCoreMembers() { // --> registerCoreMember(SwitchCommand.class, "SWITCH", "switch [] (state:[{toggle}/on/off]) (duration:)", 1); - + // <--[command] // @Name Take // @Usage take [money/iteminhand/] (qty:<#>) (from:) @@ -1731,7 +1731,7 @@ public void registerCoreMembers() { // --> registerCoreMember(TakeCommand.class, "TAKE", "take [money/iteminhand/] (qty:<#>) (from:)", 1); - + // <--[command] // @Name Teleport // @Usage teleport (|...) () @@ -1750,7 +1750,7 @@ public void registerCoreMembers() { // --> registerCoreMember(TeleportCommand.class, "TELEPORT", "teleport (|...) ()", 1); - + // <--[command] // @Name Time // @Usage time [type:{global}/player] [] (world:) @@ -1769,7 +1769,7 @@ public void registerCoreMembers() { // --> registerCoreMember(TimeCommand.class, "TIME", "time [type:{global}/player] [] (world:)", 1); - + // <--[command] // @Name Trigger // @Usage trigger [name:chat/click/damage/proximity] (state:true/false) (cooldown:<#.#>) (radius:<#>) @@ -1786,9 +1786,9 @@ public void registerCoreMembers() { // @Example // Todo // --> - registerCoreMember(TriggerCommand.class, + registerCoreMember(TriggerCommand.class, "TRIGGER", "trigger [name:chat/click/damage/proximity] (state:true/false) (cooldown:<#.#>) (radius:<#>)", 2); - + // <--[command] // @Name Viewer // @Usage viewer ({create }/modify/remove) [id:] (type:{sign_post}/wall_sign) (display:{location}/score/logged_in) (direction:n/e/w/s) @@ -1813,7 +1813,7 @@ public void registerCoreMembers() { // --> registerCoreMember(ViewerCommand.class, "VIEWER", "viewer ({create }/modify/remove) [id:] (type:{sign_post}/wall_sign) (display:{location}/score/logged_in) (direction:n/e/w/s)", 2); - + // <--[command] // @Name Vulnerable // @Usage vulnerable (state:{true}/false/toggle) @@ -1830,9 +1830,9 @@ public void registerCoreMembers() { // @Example // Todo // --> - registerCoreMember(VulnerableCommand.class, + registerCoreMember(VulnerableCommand.class, "VULNERABLE", "vulnerable (state:{true}/false/toggle)", 0); - + // <--[command] // @Name Wait // @Usage wait () (queue:) @@ -1849,7 +1849,7 @@ public void registerCoreMembers() { // @Example // Todo // --> - registerCoreMember(WaitCommand.class, + registerCoreMember(WaitCommand.class, "WAIT", "wait () (queue:)", 0); // <--[command] @@ -1889,7 +1889,7 @@ public void registerCoreMembers() { // --> registerCoreMember(WeatherCommand.class, "WEATHER", "weather [type:{global}/player] [sunny/storm/thunder] (world:)", 1); - + // <--[command] // @Name Yaml // @Usage yaml [load/create/save:]/[write:]/[write: value:] [id:] @@ -1925,16 +1925,16 @@ public void registerCoreMembers() { // @Example // Todo // --> - registerCoreMember(ZapCommand.class, + registerCoreMember(ZapCommand.class, "ZAP", "zap (