From c0d5792bf0369c93f055c83a4a4dc2399e5e1964 Mon Sep 17 00:00:00 2001 From: mcmonkey4eva Date: Mon, 2 Sep 2013 18:26:05 -0700 Subject: [PATCH] More formatting For the good of newlineumanity! --- .../scripts/commands/entity/FlyCommand.java | 92 +++++++++---------- .../scripts/commands/entity/HeadCommand.java | 22 ++--- .../commands/entity/HealthCommand.java | 2 +- .../commands/entity/InvisibleCommand.java | 12 +-- .../scripts/commands/entity/MountCommand.java | 36 ++++---- .../commands/entity/RemoveCommand.java | 54 +++++------ .../scripts/commands/entity/SpawnCommand.java | 34 +++---- .../commands/entity/TeleportCommand.java | 14 +-- .../commands/item/DisplayItemCommand.java | 2 +- .../scripts/commands/item/EnchantCommand.java | 14 +-- .../scripts/commands/item/GiveCommand.java | 10 +- .../commands/item/InventoryCommand.java | 62 ++++++------- .../scripts/commands/npc/AnchorCommand.java | 2 +- .../commands/npc/AssignmentCommand.java | 2 +- .../commands/npc/DisengageCommand.java | 8 +- .../scripts/commands/npc/EngageCommand.java | 8 +- .../commands/npc/LookcloseCommand.java | 16 ++-- .../scripts/commands/npc/PauseCommand.java | 20 ++-- .../scripts/commands/npc/PoseCommand.java | 8 +- .../scripts/commands/npc/RenameCommand.java | 2 +- .../scripts/commands/npc/TriggerCommand.java | 6 +- .../scripts/commands/npc/WalkCommand.java | 2 +- .../scripts/commands/player/ChatCommand.java | 10 +- .../commands/player/CompassCommand.java | 1 + .../scripts/commands/player/GroupCommand.java | 8 +- .../commands/player/NarrateCommand.java | 2 +- .../commands/player/ShowFakeCommand.java | 4 +- .../commands/server/ExecuteCommand.java | 12 +-- .../commands/server/ScoreboardCommand.java | 2 +- .../scripts/commands/world/BreakCommand.java | 6 +- .../commands/world/CreateWorldCommand.java | 4 +- .../scripts/commands/world/DropCommand.java | 2 +- .../commands/world/ExplodeCommand.java | 30 +++--- .../commands/world/FireworkCommand.java | 50 +++++----- .../scripts/commands/world/SignCommand.java | 26 +++--- .../scripts/commands/world/ViewerCommand.java | 84 ++++++++--------- 36 files changed, 334 insertions(+), 335 deletions(-) diff --git a/src/main/java/net/aufdemrand/denizen/scripts/commands/entity/FlyCommand.java b/src/main/java/net/aufdemrand/denizen/scripts/commands/entity/FlyCommand.java index 674c0db967..0c8d4a0685 100644 --- a/src/main/java/net/aufdemrand/denizen/scripts/commands/entity/FlyCommand.java +++ b/src/main/java/net/aufdemrand/denizen/scripts/commands/entity/FlyCommand.java @@ -33,90 +33,90 @@ */ public class FlyCommand extends AbstractCommand { - + @Override public void parseArgs(ScriptEntry scriptEntry) throws InvalidArgumentsException { // Initialize necessary fields for (aH.Argument arg : aH.interpret(scriptEntry.getArguments())) { - + if (!scriptEntry.hasObject("cancel") && arg.matches("cancel")) { - + scriptEntry.addObject("cancel", ""); } - + else if (!scriptEntry.hasObject("destinations") && arg.matchesPrefix("destination, destinations, d")) { // Entity arg scriptEntry.addObject("destinations", ((dList) arg.asType(dList.class)).filter(dLocation.class)); } - + else if (!scriptEntry.hasObject("origin") && arg.matchesArgumentType(dLocation.class)) { // Location arg scriptEntry.addObject("origin", arg.asType(dLocation.class).setPrefix("origin")); } - + else if (!scriptEntry.hasObject("entities") && arg.matchesArgumentList(dEntity.class)) { // Entity arg scriptEntry.addObject("entities", ((dList) arg.asType(dList.class)).filter(dEntity.class)); } - + else if (!scriptEntry.hasObject("speed") && arg.matchesPrimitive(aH.PrimitiveType.Double)) { // Add value scriptEntry.addObject("speed", arg.asElement()); } } - + // Use the NPC or player's locations as the location if one is not specified - + scriptEntry.defaultObject("origin", scriptEntry.hasPlayer() ? scriptEntry.getPlayer().getLocation() : null, scriptEntry.hasNPC() ? scriptEntry.getNPC().getLocation() : null); - + // Use a default speed of 1.2 if one is not specified - + scriptEntry.defaultObject("speed", new Element(1.2)); - + // Check to make sure required arguments have been filled - + if (!scriptEntry.hasObject("entities")) throw new InvalidArgumentsException(Messages.ERROR_MISSING_OTHER, "ENTITIES"); if (!scriptEntry.hasObject("origin")) throw new InvalidArgumentsException(Messages.ERROR_MISSING_OTHER, "ORIGIN"); } - + @SuppressWarnings("unchecked") @Override public void execute(final ScriptEntry scriptEntry) throws CommandExecutionException { // Get objects - + dLocation origin = (dLocation) scriptEntry.getObject("origin"); List entities = (List) scriptEntry.getObject("entities"); final List destinations = scriptEntry.hasObject("destinations") ? (List) scriptEntry.getObject("destinations") : new ArrayList(); - + final Element speed = (Element) scriptEntry.getObject("speed"); Boolean cancel = scriptEntry.hasObject("cancel"); - + // Report to dB dB.report(getName(), (cancel == true ? aH.debugObj("cancel", cancel) : "") + aH.debugObj("origin", origin) + aH.debugObj("entities", entities.toString()) + aH.debugObj("speed", speed) + (destinations.size() > 0 ? aH.debugObj("destinations", destinations.toString()) : "")); - + // Mount or dismount all of the entities if (cancel.equals(false)) { - + // Go through all the entities, spawning/teleporting them for (dEntity entity : entities) { - + if (!entity.isSpawned()) { entity.spawnAt(origin); } @@ -124,93 +124,93 @@ public void execute(final ScriptEntry scriptEntry) throws CommandExecutionExcept entity.teleport(origin); } } - + Position.mount(Conversion.convert(entities)); } else { Position.dismount(Conversion.convert(entities)); - + // Go no further if we are dismounting entities return; - + } - + // Get the last entity on the list final Entity entity = entities.get(entities.size() - 1).getBukkitEntity(); - + // Get the attached player final Player player = scriptEntry.getPlayer().getPlayerEntity(); - + // Set freeflight to true only if there are no destinations final boolean freeflight = destinations.size() > 0; - + BukkitRunnable task = new BukkitRunnable() { Location location = null; Boolean flying = true; public void run() { - + if (freeflight) { - + location = player.getEyeLocation() .add(player.getEyeLocation().getDirection() .multiply(30)); } else { - + // If freelight is not on, keep flying only as long // as there are destinations left - + if (destinations.size() > 0) { - + location = destinations.get(0); } else { - + flying = false; } } - + if (flying && entity.isValid() && (!entity.isEmpty())) { - + // To avoid excessive turbulence, only have the entity rotate // when it really needs to if (!Rotation.isFacingLocation(entity, location, 50)) { - + Rotation.faceLocation(entity, location); } - + Vector v1 = entity.getLocation().toVector(); Vector v2 = location.toVector(); Vector v3 = v2.clone().subtract(v1).normalize().multiply(speed.asDouble()); - + entity.setVelocity(v3); - + // If freeflight is off, check if the entity has reached its // destination, and remove the destination if that happens // to be the case - + if (!freeflight) { - + if (Math.abs(v2.getX() - v1.getX()) < 2 && Math.abs(v2.getY() - v1.getY()) < 2 && Math.abs(v2.getZ() - v1.getZ()) < 2) { - + destinations.remove(0); } } } else { - + flying = false; this.cancel(); } } }; - - task.runTaskTimer(denizen, 0, 3); + + task.runTaskTimer(denizen, 0, 3); } -} \ No newline at end of file +} diff --git a/src/main/java/net/aufdemrand/denizen/scripts/commands/entity/HeadCommand.java b/src/main/java/net/aufdemrand/denizen/scripts/commands/entity/HeadCommand.java index 84aca9aab4..c68d12ef2e 100644 --- a/src/main/java/net/aufdemrand/denizen/scripts/commands/entity/HeadCommand.java +++ b/src/main/java/net/aufdemrand/denizen/scripts/commands/entity/HeadCommand.java @@ -26,33 +26,33 @@ public class HeadCommand extends AbstractCommand { private enum TargetType { NPC, PLAYER } - + @Override public void parseArgs(ScriptEntry scriptEntry) throws InvalidArgumentsException { - + TargetType targetType = TargetType.NPC; Integer duration = null; String skin = null; - + for (String arg : scriptEntry.getArguments()) { // If argument is a duration if (aH.matchesDuration(arg)) { duration = aH.getIntegerFrom(arg); dB.echoDebug("...head duration set to '%s'.", arg); } - + else if (aH.matchesArg("PLAYER", arg)) { targetType = TargetType.PLAYER; dB.echoDebug("...will affect the player!"); } - + else if (aH.matchesValueArg("skin", arg, ArgumentType.String)) { skin = aH.getStringFrom(arg); dB.echoDebug("...will have " + skin + "'s head"); } else throw new InvalidArgumentsException(Messages.ERROR_UNKNOWN_ARGUMENT, arg); } - + // If TARGET is NPC/PLAYER and no NPC/PLAYER available, throw exception. if (targetType == TargetType.PLAYER && scriptEntry.getPlayer() == null) throw new InvalidArgumentsException(Messages.ERROR_NO_PLAYER); else if (targetType == TargetType.NPC && scriptEntry.getNPC() == null) throw new InvalidArgumentsException(Messages.ERROR_NO_NPCID); @@ -63,19 +63,19 @@ else if (aH.matchesValueArg("skin", arg, ArgumentType.String)) { @Override public void execute(ScriptEntry scriptEntry) throws CommandExecutionException { - + TargetType target = (TargetType) scriptEntry.getObject("target"); String skin = (String) scriptEntry.getObject("skin"); - + // Create head item with chosen skin ItemStack item = new ItemStack(Material.SKULL_ITEM, 1, (byte) 3); ItemMeta itemMeta = item.getItemMeta(); ((SkullMeta) itemMeta).setOwner(skin); item.setItemMeta(itemMeta); - + if (target.name().equals("NPC")) { NPC npc = scriptEntry.getNPC().getCitizen(); - + if (!npc.hasTrait(Equipment.class)) npc.addTrait(Equipment.class); Equipment trait = npc.getTrait(Equipment.class); trait.set(1, item); @@ -87,4 +87,4 @@ public void execute(ScriptEntry scriptEntry) throws CommandExecutionException { } -} \ No newline at end of file +} diff --git a/src/main/java/net/aufdemrand/denizen/scripts/commands/entity/HealthCommand.java b/src/main/java/net/aufdemrand/denizen/scripts/commands/entity/HealthCommand.java index e82d064e02..c3f6a2006d 100644 --- a/src/main/java/net/aufdemrand/denizen/scripts/commands/entity/HealthCommand.java +++ b/src/main/java/net/aufdemrand/denizen/scripts/commands/entity/HealthCommand.java @@ -85,4 +85,4 @@ else if (action.asString().equalsIgnoreCase("false")) } -} \ No newline at end of file +} diff --git a/src/main/java/net/aufdemrand/denizen/scripts/commands/entity/InvisibleCommand.java b/src/main/java/net/aufdemrand/denizen/scripts/commands/entity/InvisibleCommand.java index 9eadd3991a..38ef65925f 100644 --- a/src/main/java/net/aufdemrand/denizen/scripts/commands/entity/InvisibleCommand.java +++ b/src/main/java/net/aufdemrand/denizen/scripts/commands/entity/InvisibleCommand.java @@ -88,14 +88,14 @@ public void execute(ScriptEntry scriptEntry) throws CommandExecutionException { break; case PLAYER: - + if (scriptEntry.getPlayer() != null) { - + Player player = scriptEntry.getPlayer().getPlayerEntity(); PotionEffect invis = new PotionEffect(PotionEffectType.INVISIBILITY, Integer.MAX_VALUE, 1); - + switch (action) { - + case FALSE: player.removePotionEffect(PotionEffectType.INVISIBILITY); break; @@ -107,7 +107,7 @@ public void execute(ScriptEntry scriptEntry) throws CommandExecutionException { case TOGGLE: if (player.hasPotionEffect(PotionEffectType.INVISIBILITY)) player.removePotionEffect(PotionEffectType.INVISIBILITY); - else + else invis.apply(player); break; @@ -116,4 +116,4 @@ public void execute(ScriptEntry scriptEntry) throws CommandExecutionException { } } -} \ No newline at end of file +} diff --git a/src/main/java/net/aufdemrand/denizen/scripts/commands/entity/MountCommand.java b/src/main/java/net/aufdemrand/denizen/scripts/commands/entity/MountCommand.java index 4956a5be1e..59cd1a1b1d 100644 --- a/src/main/java/net/aufdemrand/denizen/scripts/commands/entity/MountCommand.java +++ b/src/main/java/net/aufdemrand/denizen/scripts/commands/entity/MountCommand.java @@ -23,57 +23,57 @@ */ public class MountCommand extends AbstractCommand { - + @Override public void parseArgs(ScriptEntry scriptEntry) throws InvalidArgumentsException { // Initialize necessary fields for (aH.Argument arg : aH.interpret(scriptEntry.getArguments())) { - + if (!scriptEntry.hasObject("cancel") && arg.matches("cancel")) { - + scriptEntry.addObject("cancel", ""); } - + else if (!scriptEntry.hasObject("location") && arg.matchesArgumentType(dLocation.class)) { // Location arg scriptEntry.addObject("location", arg.asType(dLocation.class)); } - + else if (!scriptEntry.hasObject("entities") && arg.matchesArgumentList(dEntity.class)) { // Entity arg scriptEntry.addObject("entities", ((dList) arg.asType(dList.class)).filter(dEntity.class)); } } - + // Use the NPC or player's locations as the location if one is not specified - + scriptEntry.defaultObject("location", scriptEntry.hasPlayer() ? scriptEntry.getPlayer().getLocation() : null, scriptEntry.hasNPC() ? scriptEntry.getNPC().getLocation() : null); - + // Check to make sure required arguments have been filled - + if (!scriptEntry.hasObject("entities")) throw new InvalidArgumentsException(Messages.ERROR_MISSING_OTHER, "ENTITIES"); - + if (!scriptEntry.hasObject("location")) throw new InvalidArgumentsException(Messages.ERROR_MISSING_OTHER, "LOCATION"); } - + @SuppressWarnings("unchecked") @Override public void execute(final ScriptEntry scriptEntry) throws CommandExecutionException { // Get objects - + dLocation location = (dLocation) scriptEntry.getObject("location"); - List entities = (List) scriptEntry.getObject("entities"); + List entities = (List) scriptEntry.getObject("entities"); Boolean cancel = scriptEntry.hasObject("cancel"); - + // Report to dB dB.report(getName(), (cancel == true ? aH.debugObj("cancel", cancel) : "") + aH.debugObj("location", location) + @@ -81,10 +81,10 @@ public void execute(final ScriptEntry scriptEntry) throws CommandExecutionExcept // Mount or dismount all of the entities if (cancel.equals(false)) { - + // Go through all the entities, spawning/teleporting them for (dEntity entity : entities) { - + if (!entity.isSpawned()) { entity.spawnAt(location); } @@ -92,11 +92,11 @@ public void execute(final ScriptEntry scriptEntry) throws CommandExecutionExcept entity.teleport(location); } } - + Position.mount(Conversion.convert(entities)); } else { Position.dismount(Conversion.convert(entities)); } } -} \ No newline at end of file +} diff --git a/src/main/java/net/aufdemrand/denizen/scripts/commands/entity/RemoveCommand.java b/src/main/java/net/aufdemrand/denizen/scripts/commands/entity/RemoveCommand.java index 342edd7bad..1667807779 100644 --- a/src/main/java/net/aufdemrand/denizen/scripts/commands/entity/RemoveCommand.java +++ b/src/main/java/net/aufdemrand/denizen/scripts/commands/entity/RemoveCommand.java @@ -25,10 +25,10 @@ */ public class RemoveCommand extends AbstractCommand { - + @Override public void parseArgs(ScriptEntry scriptEntry) throws InvalidArgumentsException { - + for (aH.Argument arg : aH.interpret(scriptEntry.getArguments())) { if (!scriptEntry.hasObject("entities") @@ -36,13 +36,13 @@ public void parseArgs(ScriptEntry scriptEntry) throws InvalidArgumentsException // Entity arg scriptEntry.addObject("entities", ((dList) arg.asType(dList.class)).filter(dEntity.class)); } - + else if (!scriptEntry.hasObject("region") && arg.matchesPrefix("region, r")) { // Location arg scriptEntry.addObject("region", arg.asElement()); } - + else if (!scriptEntry.hasObject("world") && arg.matchesArgumentType(dWorld.class)) { // add world @@ -51,19 +51,19 @@ else if (!scriptEntry.hasObject("world") } // Check to make sure required arguments have been filled - + if (!scriptEntry.hasObject("entities")) throw new InvalidArgumentsException(Messages.ERROR_MISSING_OTHER, "ENTITIES"); - + // If the world has not been specified, try to use the NPC's or player's // world, or default to the specified world in the server properties if necessary - + scriptEntry.defaultObject("world", scriptEntry.hasNPC() ? new dWorld(scriptEntry.getNPC().getWorld()) : null, scriptEntry.hasPlayer() ? new dWorld(scriptEntry.getPlayer().getWorld()) : null, new dWorld(Bukkit.getWorlds().get(0))); } - + @SuppressWarnings("unchecked") @Override public void execute(final ScriptEntry scriptEntry) throws CommandExecutionException { @@ -72,32 +72,32 @@ public void execute(final ScriptEntry scriptEntry) throws CommandExecutionExcept List entities = (List) scriptEntry.getObject("entities"); dWorld world = (dWorld) scriptEntry.getObject("world"); Element region = (Element) scriptEntry.getObject("region"); - + // Report to dB dB.report(getName(), aH.debugObj("entities", entities.toString()) + (region != null ? aH.debugObj("region", region) : "")); - + boolean conditionsMet; - + // Go through all of our entities and remove them - + for (dEntity entity : entities) { - + conditionsMet = true; - + // If this is a specific spawned entity, and all // other applicable conditions are met, remove it - + if (!entity.isGeneric()) { - + if (region != null) { conditionsMet = WorldGuardUtilities.inRegion (entity.getBukkitEntity().getLocation(), region.asString()); } - + if (conditionsMet) { - + if (entity.isNPC()) { entity.getNPC().destroy(); } @@ -106,31 +106,31 @@ public void execute(final ScriptEntry scriptEntry) throws CommandExecutionExcept } } } - + // If this is a generic unspawned entity, remove // all entities of this type from the world (as // long as they meet all other conditions) - + else { - + // Note: getting the entities from each loaded chunk // in the world (like in Essentials' /killall) has the // exact same effect as the below - + for (Entity worldEntity : world.getEntities()) { - + // If this entity from the world is of the same type // as our current dEntity, and all other applicable // conditions are met, remove it - + if (entity.getEntityType().equals(worldEntity.getType())) { - + if (region != null) { conditionsMet = WorldGuardUtilities.inRegion (worldEntity.getLocation(), region.asString()); } - + if (conditionsMet) { worldEntity.remove(); } @@ -139,4 +139,4 @@ public void execute(final ScriptEntry scriptEntry) throws CommandExecutionExcept } } } -} \ No newline at end of file +} diff --git a/src/main/java/net/aufdemrand/denizen/scripts/commands/entity/SpawnCommand.java b/src/main/java/net/aufdemrand/denizen/scripts/commands/entity/SpawnCommand.java index 12e5f07dcf..6b2afa018c 100644 --- a/src/main/java/net/aufdemrand/denizen/scripts/commands/entity/SpawnCommand.java +++ b/src/main/java/net/aufdemrand/denizen/scripts/commands/entity/SpawnCommand.java @@ -21,7 +21,7 @@ */ public class SpawnCommand extends AbstractCommand { - + @Override public void parseArgs(ScriptEntry scriptEntry) throws InvalidArgumentsException { @@ -34,13 +34,13 @@ public void parseArgs(ScriptEntry scriptEntry) throws InvalidArgumentsException // Entity arg scriptEntry.addObject("entities", ((dList) arg.asType(dList.class)).filter(dEntity.class)); } - + else if (!scriptEntry.hasObject("location") && arg.matchesArgumentType(dLocation.class)) { // Location arg scriptEntry.addObject("location", arg.asType(dLocation.class)); } - + else if (!scriptEntry.hasObject("target") && arg.matchesArgumentType(dEntity.class) && arg.matchesPrefix("target")) { @@ -48,22 +48,22 @@ else if (!scriptEntry.hasObject("target") scriptEntry.addObject("target", arg.asType(dEntity.class)); } } - + // Use the NPC or player's locations as the location if one is not specified - + scriptEntry.defaultObject("location", scriptEntry.hasNPC() ? scriptEntry.getNPC().getLocation() : null, scriptEntry.hasPlayer() ? scriptEntry.getPlayer().getLocation() : null); // Check to make sure required arguments have been filled - + if (!scriptEntry.hasObject("entities")) throw new InvalidArgumentsException(Messages.ERROR_MISSING_OTHER, "ENTITIES"); - + if (!scriptEntry.hasObject("location")) throw new InvalidArgumentsException(Messages.ERROR_MISSING_OTHER, "LOCATION"); } - + @SuppressWarnings("unchecked") @Override public void execute(final ScriptEntry scriptEntry) throws CommandExecutionException { @@ -72,35 +72,35 @@ public void execute(final ScriptEntry scriptEntry) throws CommandExecutionExcept List entities = (List) scriptEntry.getObject("entities"); dLocation location = (dLocation) scriptEntry.getObject("location"); dEntity target = (dEntity) scriptEntry.getObject("target"); - + // Report to dB dB.report(getName(), aH.debugObj("entities", entities.toString()) + aH.debugObj("location", location) + (target != null ? aH.debugObj("target", target) : "")); - + // Keep a dList of entities that can be called using %entities% // later in the script queue - + dList entityList = new dList(""); // Go through all the entities and spawn them or teleport them, // then set their targets if applicable - + for (dEntity entity : entities) { - + if (!entity.isSpawned()) { entity.spawnAt(location); } else { entity.teleport(location); } - + // Only add to entityList after the entities have been // spawned, otherwise you'll get something like "e@skeleton" // instead of "e@57" on it - + entityList.add(entity.toString()); - + if (target != null && target.isLivingEntity()) { entity.target(target.getLivingEntity()); } @@ -109,4 +109,4 @@ public void execute(final ScriptEntry scriptEntry) throws CommandExecutionExcept } -} \ No newline at end of file +} diff --git a/src/main/java/net/aufdemrand/denizen/scripts/commands/entity/TeleportCommand.java b/src/main/java/net/aufdemrand/denizen/scripts/commands/entity/TeleportCommand.java index f914a61219..086d4db1cf 100644 --- a/src/main/java/net/aufdemrand/denizen/scripts/commands/entity/TeleportCommand.java +++ b/src/main/java/net/aufdemrand/denizen/scripts/commands/entity/TeleportCommand.java @@ -20,7 +20,7 @@ */ public class TeleportCommand extends AbstractCommand { - + @Override public void parseArgs(ScriptEntry scriptEntry) throws InvalidArgumentsException { @@ -46,19 +46,19 @@ else if (arg.matches("npc") && scriptEntry.hasNPC()) { } // Check to make sure required arguments have been filled - scriptEntry.defaultObject("entities", (scriptEntry.hasPlayer() ? Arrays.asList(scriptEntry.getPlayer().getDenizenEntity()) : null), + scriptEntry.defaultObject("entities", (scriptEntry.hasPlayer() ? Arrays.asList(scriptEntry.getPlayer().getDenizenEntity()) : null), (scriptEntry.hasNPC() ? Arrays.asList(scriptEntry.getNPC().getDenizenEntity()) : null)); - + } - + @SuppressWarnings("unchecked") @Override public void execute(final ScriptEntry scriptEntry) throws CommandExecutionException { // Get objects - + dLocation location = (dLocation) scriptEntry.getObject("location"); List entities = (List) scriptEntry.getObject("entities"); - + // Report to dB dB.report(getName(), aH.debugObj("location", location) + aH.debugObj("entities", entities.toString())); @@ -69,4 +69,4 @@ public void execute(final ScriptEntry scriptEntry) throws CommandExecutionExcept } } } -} \ No newline at end of file +} diff --git a/src/main/java/net/aufdemrand/denizen/scripts/commands/item/DisplayItemCommand.java b/src/main/java/net/aufdemrand/denizen/scripts/commands/item/DisplayItemCommand.java index a3433e0871..54e0ed0fe8 100644 --- a/src/main/java/net/aufdemrand/denizen/scripts/commands/item/DisplayItemCommand.java +++ b/src/main/java/net/aufdemrand/denizen/scripts/commands/item/DisplayItemCommand.java @@ -109,4 +109,4 @@ else if (action == Action.REMOVE) { public static Map displayed = new HashMap(); -} \ No newline at end of file +} diff --git a/src/main/java/net/aufdemrand/denizen/scripts/commands/item/EnchantCommand.java b/src/main/java/net/aufdemrand/denizen/scripts/commands/item/EnchantCommand.java index 1c3abfd373..2100a9eb1c 100644 --- a/src/main/java/net/aufdemrand/denizen/scripts/commands/item/EnchantCommand.java +++ b/src/main/java/net/aufdemrand/denizen/scripts/commands/item/EnchantCommand.java @@ -7,12 +7,12 @@ /** * Applies an enchantment on an ItemStack - * - * Arguments: [] - Required, () - Optional - * - * Example Usage: * + * + * Arguments: [] - Required, () - Optional + * + * Example Usage: * * @see org.bukkit.inventory.ItemStack - * + * * @author Jeremy Schroeder */ @@ -24,10 +24,10 @@ public void onEnable() { @Override public void parseArgs(ScriptEntry scriptEntry) throws InvalidArgumentsException { - + } @Override public void execute(ScriptEntry scriptEntry) throws CommandExecutionException { } -} \ No newline at end of file +} diff --git a/src/main/java/net/aufdemrand/denizen/scripts/commands/item/GiveCommand.java b/src/main/java/net/aufdemrand/denizen/scripts/commands/item/GiveCommand.java index f8e6b6501f..9d8939115e 100644 --- a/src/main/java/net/aufdemrand/denizen/scripts/commands/item/GiveCommand.java +++ b/src/main/java/net/aufdemrand/denizen/scripts/commands/item/GiveCommand.java @@ -17,8 +17,8 @@ /* GIVE [MONEY|#(:#)|MATERIAL_TYPE(:#)] (QTY:#) */ -/* - * Arguments: [] - Required, () - Optional +/* + * Arguments: [] - Required, () - Optional * [MONEY|[#](:#)|[MATERIAL_TYPE](:#)] specifies what to give. * [MONEY] gives money using your economy. * [#](:#) gives the item with the specified item ID. Optional @@ -26,8 +26,8 @@ * [MATERIAL_TYPE](:#) gives the item with the specified * bukkit MaterialType. Optional argument (:#) can specify * a specific data value. - * (QTY:#) specifies quantity. If not specified, assumed 'QTY:1' - * + * (QTY:#) specifies quantity. If not specified, assumed 'QTY:1' + * */ public class GiveCommand extends AbstractCommand { @@ -121,4 +121,4 @@ public void execute(ScriptEntry scriptEntry) throws CommandExecutionException { break; } } -} \ No newline at end of file +} diff --git a/src/main/java/net/aufdemrand/denizen/scripts/commands/item/InventoryCommand.java b/src/main/java/net/aufdemrand/denizen/scripts/commands/item/InventoryCommand.java index 4503cf8d64..4863422ded 100644 --- a/src/main/java/net/aufdemrand/denizen/scripts/commands/item/InventoryCommand.java +++ b/src/main/java/net/aufdemrand/denizen/scripts/commands/item/InventoryCommand.java @@ -17,12 +17,12 @@ */ public class InventoryCommand extends AbstractCommand { - + private enum Action { OPEN, COPY, MOVE, SWAP, ADD, REMOVE, KEEP, EXCLUDE, FILL, CLEAR } - + @Override public void parseArgs(ScriptEntry scriptEntry) throws InvalidArgumentsException { - + for (aH.Argument arg : aH.interpret(scriptEntry.getArguments())) { if (!scriptEntry.hasObject("action") @@ -30,12 +30,12 @@ public void parseArgs(ScriptEntry scriptEntry) throws InvalidArgumentsException // add Action scriptEntry.addObject("action", Action.valueOf(arg.getValue().toUpperCase())); } - + else if (!scriptEntry.hasObject("originEntity") && !scriptEntry.hasObject("originLocation") && !scriptEntry.hasObject("originInventory") && arg.matchesPrefix("origin, o, source, s, items, i, from, f")) { - + // Is entity if (arg.matchesArgumentType(dEntity.class)) scriptEntry.addObject("originEntity", arg.asType(dEntity.class)); @@ -46,12 +46,12 @@ else if (arg.matchesArgumentType(dLocation.class)) else if (arg.matchesArgumentType(dInventory.class)) scriptEntry.addObject("originInventory", arg.asType(dInventory.class)); } - + else if (!scriptEntry.hasObject("destinationEntity") && !scriptEntry.hasObject("destinationLocation") && !scriptEntry.hasObject("destinationInventory") && arg.matchesPrefix("destination, d, target, to, t")) { - + // Is entity if (arg.matchesArgumentType(dEntity.class)) scriptEntry.addObject("destinationEntity", arg.asType(dEntity.class)); @@ -65,31 +65,31 @@ else if (arg.matchesArgumentType(dInventory.class)) } // Check to make sure required arguments have been filled - + if (!scriptEntry.hasObject("action")) throw new InvalidArgumentsException("Must specify an Inventory action!"); - + if (!scriptEntry.hasObject("destinationEntity") && !scriptEntry.hasObject("destinationLocation") && !scriptEntry.hasObject("destinationInventory")) throw new InvalidArgumentsException(Messages.ERROR_MISSING_OTHER, "DESTINATION"); } - + @Override public void execute(final ScriptEntry scriptEntry) throws CommandExecutionException { // Get objects Action action = (Action) scriptEntry.getObject("action"); - + dEntity originEntity = (dEntity) scriptEntry.getObject("originEntity"); dLocation originLocation = (dLocation) scriptEntry.getObject("originLocation"); - + dEntity destinationEntity = (dEntity) scriptEntry.getObject("destinationEntity"); dLocation destinationLocation = (dLocation) scriptEntry.getObject("destinationLocation"); - + dInventory origin = (dInventory) scriptEntry.getObject("originInventory"); dInventory destination = (dInventory) scriptEntry.getObject("destinationInventory"); - + if (origin == null) { if (originLocation != null) { origin = new dInventory(originLocation.getBlock().getState()); @@ -98,7 +98,7 @@ else if (originEntity != null) { origin = new dInventory(originEntity.getLivingEntity()); } } - + if (destination == null) { if (destinationLocation != null) { destination = new dInventory(destinationLocation.getBlock().getState()); @@ -107,25 +107,25 @@ else if (destinationEntity != null) { destination = new dInventory(destinationEntity.getLivingEntity()); } } - + switch (action) { // Make the attached player open the destination inventory case OPEN: scriptEntry.getPlayer().getPlayerEntity().openInventory(destination.getInventory()); return; - + // Turn destination's contents into a copy of origin's case COPY: origin.replace(destination); return; - + // Copy origin's contents to destination, then empty origin case MOVE: origin.replace(destination); origin.clear(); return; - + // Swap the contents of the two inventories case SWAP: dInventory temp = new dInventory(destination.getInventoryType()) @@ -133,46 +133,46 @@ else if (destinationEntity != null) { origin.replace(destination); temp.replace(origin); return; - + // Add origin's contents to destination case ADD: destination.add(origin.getContents()); return; - + // Remove origin's contents from destination case REMOVE: destination.remove(origin.getContents()); return; - + // Keep only items from the origin's contents in the // destination case KEEP: destination.keep(origin.getContents()); return; - + // Exclude all items from the origin's contents in the // destination case EXCLUDE: destination.exclude(origin.getContents()); return; - + // Add origin's contents over and over to destination // until it is full case FILL: destination.fill(origin.getContents()); return; - + // Clear the content of the destination inventory case CLEAR: destination.clear(); return; - + default: return; - + } - - - + + + } -} \ No newline at end of file +} diff --git a/src/main/java/net/aufdemrand/denizen/scripts/commands/npc/AnchorCommand.java b/src/main/java/net/aufdemrand/denizen/scripts/commands/npc/AnchorCommand.java index 9d47fb58a5..40966c0db4 100644 --- a/src/main/java/net/aufdemrand/denizen/scripts/commands/npc/AnchorCommand.java +++ b/src/main/java/net/aufdemrand/denizen/scripts/commands/npc/AnchorCommand.java @@ -137,4 +137,4 @@ public void execute(ScriptEntry scriptEntry) throws CommandExecutionException { } -} \ No newline at end of file +} diff --git a/src/main/java/net/aufdemrand/denizen/scripts/commands/npc/AssignmentCommand.java b/src/main/java/net/aufdemrand/denizen/scripts/commands/npc/AssignmentCommand.java index 96b2659cf6..6b1572f455 100644 --- a/src/main/java/net/aufdemrand/denizen/scripts/commands/npc/AssignmentCommand.java +++ b/src/main/java/net/aufdemrand/denizen/scripts/commands/npc/AssignmentCommand.java @@ -80,4 +80,4 @@ public void execute(ScriptEntry scriptEntry) throws CommandExecutionException { .removeAssignment(scriptEntry.getPlayer()); } -} \ No newline at end of file +} diff --git a/src/main/java/net/aufdemrand/denizen/scripts/commands/npc/DisengageCommand.java b/src/main/java/net/aufdemrand/denizen/scripts/commands/npc/DisengageCommand.java index 2067cc53c6..a1e30f1dae 100644 --- a/src/main/java/net/aufdemrand/denizen/scripts/commands/npc/DisengageCommand.java +++ b/src/main/java/net/aufdemrand/denizen/scripts/commands/npc/DisengageCommand.java @@ -10,9 +10,9 @@ import net.aufdemrand.denizen.utilities.debugging.dB.Messages; /** - * Unsets the Denizen from the Engage List. + * Unsets the Denizen from the Engage List. * When ENGAGEd, a Denizen will not interact with a Player until DISENGAGEd (or timed out). - * + * * @author aufdemrand */ @@ -22,7 +22,7 @@ public class DisengageCommand extends AbstractCommand { /* Arguments: [] - Required, () - Optional * (NPCID:#) Changes the Denizen affected to the Citizens2 NPCID specified - * + * */ @Override @@ -45,4 +45,4 @@ public void execute(ScriptEntry scriptEntry) throws CommandExecutionException { EngageCommand.setEngaged(scriptEntry.getNPC().getCitizen(), false); } -} \ No newline at end of file +} diff --git a/src/main/java/net/aufdemrand/denizen/scripts/commands/npc/EngageCommand.java b/src/main/java/net/aufdemrand/denizen/scripts/commands/npc/EngageCommand.java index 6f8a0f55be..92eb63d0e4 100644 --- a/src/main/java/net/aufdemrand/denizen/scripts/commands/npc/EngageCommand.java +++ b/src/main/java/net/aufdemrand/denizen/scripts/commands/npc/EngageCommand.java @@ -15,7 +15,7 @@ import java.util.Map; /** - * Sets an NPC to ENGAGED in the Denizen Engage List. + * Sets an NPC to ENGAGED in the Denizen Engage List. * When ENGAGEd, a Denizen will not interact with a Player until DISENGAGEd (or timed out). * * @author Jeremy Schroeder @@ -25,10 +25,10 @@ public class EngageCommand extends AbstractCommand { /* ENGAGE (# of Seconds) (NPCID:#)*/ - /* Arguments: [] - Required, () - Optional + /* Arguments: [] - Required, () - Optional * (DURATION:#) Will automatically DISENGAGE after specified amount of seconds. * If not set, the Denizen will remain ENGAGEd until a DISENGAGE command is - * used, or the Denizen config.yml engage_timeout_in_seconds setting. + * used, or the Denizen config.yml engage_timeout_in_seconds setting. * (NPCID:#) Changes the Denizen affected to the Citizens2 NPCID specified */ @@ -122,4 +122,4 @@ public static void setEngaged(NPC npc, int duration) { currentlyEngaged.put(npc, System.currentTimeMillis() + duration * 1000 ); } -} \ No newline at end of file +} diff --git a/src/main/java/net/aufdemrand/denizen/scripts/commands/npc/LookcloseCommand.java b/src/main/java/net/aufdemrand/denizen/scripts/commands/npc/LookcloseCommand.java index 504b33cc75..489ba0ff3b 100644 --- a/src/main/java/net/aufdemrand/denizen/scripts/commands/npc/LookcloseCommand.java +++ b/src/main/java/net/aufdemrand/denizen/scripts/commands/npc/LookcloseCommand.java @@ -13,7 +13,7 @@ /** * Configures the LookClose Trait for a NPC. - * + * * @author Jeremy Schroeder */ @@ -21,9 +21,9 @@ public class LookcloseCommand extends AbstractCommand { /* LOOKCLOSE [TOGGLE:TRUE|FALSE] (RANGE:#.#) (REALISTIC) */ - /* + /* * Arguments: [] - Required, () - Optional - * + * */ boolean toggle; @@ -40,7 +40,7 @@ public void parseArgs(ScriptEntry scriptEntry) throws InvalidArgumentsException realistic = false; toggle = true; if (scriptEntry.getNPC() != null) npc = scriptEntry.getNPC().getCitizen(); - + // Parse Arguments for (String arg : scriptEntry.getArguments()) { @@ -67,7 +67,7 @@ public void parseArgs(ScriptEntry scriptEntry) throws InvalidArgumentsException .addObject("range", range) .addObject("toggle", toggle); } - + @Override public void execute(ScriptEntry scriptEntry) throws CommandExecutionException { @@ -84,9 +84,9 @@ public void execute(ScriptEntry scriptEntry) throws CommandExecutionException { trait.setRange(range.intValue()); } } - + @Override public void onEnable() { - + } -} \ No newline at end of file +} diff --git a/src/main/java/net/aufdemrand/denizen/scripts/commands/npc/PauseCommand.java b/src/main/java/net/aufdemrand/denizen/scripts/commands/npc/PauseCommand.java index 754bd80e44..9c5bb56290 100644 --- a/src/main/java/net/aufdemrand/denizen/scripts/commands/npc/PauseCommand.java +++ b/src/main/java/net/aufdemrand/denizen/scripts/commands/npc/PauseCommand.java @@ -16,7 +16,7 @@ /** * Pauses/Resumes a NPC's various parts. - * + * * @author Jeremy Schroeder */ @@ -24,14 +24,14 @@ public class PauseCommand extends AbstractCommand { /* PAUSE (DURATION:#) (NPCID:#) */ - /* - * Arguments: [] - Required, () - Optional - * + /* + * Arguments: [] - Required, () - Optional + * */ private Map durations = new ConcurrentHashMap(8, 0.9f, 1); enum PauseType { ACTIVITY, WAYPOINTS, NAVIGATION } - + int duration; PauseType pauseType; dNPC dNPC; @@ -57,12 +57,12 @@ public void parseArgs(ScriptEntry scriptEntry) throws InvalidArgumentsException } else if (aH.matchesArg("WAYPOINTS", arg) || aH.matchesArg("NAVIGATION", arg) || aH.matchesArg("ACTIVITY", arg) || aH.matchesArg("WAYPOINTS", arg)) { - // Could also maybe do for( ... : PauseType.values()) ... not sure which is faster. + // Could also maybe do for( ... : PauseType.values()) ... not sure which is faster. pauseType = PauseType.valueOf(arg.toUpperCase()); dB.echoDebug(Messages.DEBUG_SET_TYPE, arg); } else throw new InvalidArgumentsException(Messages.ERROR_UNKNOWN_ARGUMENT, arg); - } + } } @Override @@ -75,7 +75,7 @@ public void execute(ScriptEntry scriptEntry) throws CommandExecutionException { if (durations.containsKey(dNPC.getCitizen().getId() + pauseType.name())) { try { denizen.getServer().getScheduler().cancelTask(durations.get(dNPC.getCitizen().getId() + pauseType.name())); } catch (Exception e) { dB.echoError(Messages.ERROR_CANCELLING_DELAYED_TASK); } - + } dB.echoDebug(Messages.DEBUG_SETTING_DELAYED_TASK, "UNPAUSE " + pauseType); durations.put(dNPC.getId() + pauseType.name(), denizen.getServer().getScheduler().scheduleSyncDelayedTask(denizen, @@ -110,7 +110,7 @@ public void pause(dNPC denizen, PauseType pauseType, boolean pause) { @Override public void onEnable() { // TODO Auto-generated method stub - + } -} \ No newline at end of file +} diff --git a/src/main/java/net/aufdemrand/denizen/scripts/commands/npc/PoseCommand.java b/src/main/java/net/aufdemrand/denizen/scripts/commands/npc/PoseCommand.java index 87bd7b8f35..f2d5af8637 100644 --- a/src/main/java/net/aufdemrand/denizen/scripts/commands/npc/PoseCommand.java +++ b/src/main/java/net/aufdemrand/denizen/scripts/commands/npc/PoseCommand.java @@ -41,7 +41,7 @@ public void parseArgs(ScriptEntry scriptEntry) throws InvalidArgumentsException } else if (aH.matchesValueArg("ID", arg, aH.ArgumentType.String)) { id = aH.getStringFrom(arg); - + } else if (aH.matchesArg("PLAYER", arg)) { targetType = TargetType.PLAYER; dB.echoDebug("Setting pose on PLAYER!"); @@ -76,7 +76,7 @@ public void execute(ScriptEntry scriptEntry) throws CommandExecutionException { switch (action) { case ASSUME: - + if (target.name().equals("NPC")) npc.getCitizen().getTrait(Poses.class).assumePose(id); else { @@ -84,7 +84,7 @@ public void execute(ScriptEntry scriptEntry) throws CommandExecutionException { Location location = player.getLocation(); location.setYaw(npc.getCitizen().getTrait(Poses.class).getPose(id).getYaw()); location.setPitch(npc.getCitizen().getTrait(Poses.class).getPose(id).getPitch()); - + // The only way to change a player's yaw and pitch in Bukkit // is to use teleport on him/her player.teleport(location); @@ -94,4 +94,4 @@ public void execute(ScriptEntry scriptEntry) throws CommandExecutionException { // TODO: ADD ADD/REMOVE } -} \ No newline at end of file +} diff --git a/src/main/java/net/aufdemrand/denizen/scripts/commands/npc/RenameCommand.java b/src/main/java/net/aufdemrand/denizen/scripts/commands/npc/RenameCommand.java index e0b1a634a2..8c1f043765 100644 --- a/src/main/java/net/aufdemrand/denizen/scripts/commands/npc/RenameCommand.java +++ b/src/main/java/net/aufdemrand/denizen/scripts/commands/npc/RenameCommand.java @@ -53,4 +53,4 @@ public void execute(final ScriptEntry scriptEntry) throws CommandExecutionExcept } -} \ No newline at end of file +} diff --git a/src/main/java/net/aufdemrand/denizen/scripts/commands/npc/TriggerCommand.java b/src/main/java/net/aufdemrand/denizen/scripts/commands/npc/TriggerCommand.java index c8bb789701..1d02a6dae9 100644 --- a/src/main/java/net/aufdemrand/denizen/scripts/commands/npc/TriggerCommand.java +++ b/src/main/java/net/aufdemrand/denizen/scripts/commands/npc/TriggerCommand.java @@ -14,7 +14,7 @@ /** * Configures the TriggerTrait for a NPC. - * + * * @author Jeremy Schroeder */ @@ -94,9 +94,9 @@ else if (toggle == Toggle.TRUE) if (radius > 0) trait.setLocalRadius(trigger, radius); - + if (cooldown.getSeconds() > 0) trait.setLocalCooldown(trigger, cooldown.getSeconds()); } -} \ No newline at end of file +} diff --git a/src/main/java/net/aufdemrand/denizen/scripts/commands/npc/WalkCommand.java b/src/main/java/net/aufdemrand/denizen/scripts/commands/npc/WalkCommand.java index 9304db47aa..99aeb0edf6 100644 --- a/src/main/java/net/aufdemrand/denizen/scripts/commands/npc/WalkCommand.java +++ b/src/main/java/net/aufdemrand/denizen/scripts/commands/npc/WalkCommand.java @@ -88,4 +88,4 @@ public void execute(ScriptEntry scriptEntry) throws CommandExecutionException { } -} \ No newline at end of file +} diff --git a/src/main/java/net/aufdemrand/denizen/scripts/commands/player/ChatCommand.java b/src/main/java/net/aufdemrand/denizen/scripts/commands/player/ChatCommand.java index 227cdf616d..dd720ffc48 100644 --- a/src/main/java/net/aufdemrand/denizen/scripts/commands/player/ChatCommand.java +++ b/src/main/java/net/aufdemrand/denizen/scripts/commands/player/ChatCommand.java @@ -19,16 +19,16 @@ * *
    Arguments: [] - Required
* - *
    ['message to chat']
    + *
      ['message to chat']
      * The chat message the Talker will use. This will be seen by all entities within range.
    * - *
      (TARGET(S):NONE|List of LivingEntities{Interact Player})
      + *
        (TARGET(S):NONE|List of LivingEntities{Interact Player})
        * The LivingEntities that the message is addressed to. Uses the dScript List format * (item1|item2|etc). Valid entities are: PLAYER.player_name, NPC.npcid, or ENTITY.entity_name. - * If NONE is specified, the NPC speaking will have no target. Default target is set to + * If NONE is specified, the NPC speaking will have no target. Default target is set to * the Player doing the interaction (if that information is available to the command).
      * - *
        (TALKER:NPC.npcid{Interact NPC})
        + *
          (TALKER:NPC.npcid{Interact NPC})
          * The NPC that will be doing the chatting. Defaults to the NPC interacted with (if that information is * available to the command), but can be changed by using the NPC LivingEntity format (NPC.npcid).
        * @@ -126,4 +126,4 @@ public void execute(ScriptEntry scriptEntry) throws CommandExecutionException { } -} \ No newline at end of file +} diff --git a/src/main/java/net/aufdemrand/denizen/scripts/commands/player/CompassCommand.java b/src/main/java/net/aufdemrand/denizen/scripts/commands/player/CompassCommand.java index 24b7b6d117..27f9b883e8 100644 --- a/src/main/java/net/aufdemrand/denizen/scripts/commands/player/CompassCommand.java +++ b/src/main/java/net/aufdemrand/denizen/scripts/commands/player/CompassCommand.java @@ -53,3 +53,4 @@ public void execute(ScriptEntry scriptEntry) throws CommandExecutionException { } } + diff --git a/src/main/java/net/aufdemrand/denizen/scripts/commands/player/GroupCommand.java b/src/main/java/net/aufdemrand/denizen/scripts/commands/player/GroupCommand.java index 31c3adef8a..b6113c3b3f 100644 --- a/src/main/java/net/aufdemrand/denizen/scripts/commands/player/GroupCommand.java +++ b/src/main/java/net/aufdemrand/denizen/scripts/commands/player/GroupCommand.java @@ -54,16 +54,16 @@ public void execute(ScriptEntry scriptEntry) throws CommandExecutionException { switch (action) { case ADD: if(Depends.permissions.playerInGroup(world, player.getName(), group)) { - dB.echoDebug("Player " + player.getName() + " is already in group " + group); + dB.echoDebug("Player " + player.getName() + " is already in group " + group); } else { Depends.permissions.playerAddGroup(world, player.getName(), group); dB.echoDebug("Added " + player.getName() + " to group " + group); } return; - case REMOVE: + case REMOVE: if(!Depends.permissions.playerInGroup(world, player.getName(), group)) { - dB.echoDebug("Player " + player.getName() + " is not in group " + group); + dB.echoDebug("Player " + player.getName() + " is not in group " + group); } else { Depends.permissions.playerRemoveGroup(world, player.getName(), group); @@ -72,4 +72,4 @@ public void execute(ScriptEntry scriptEntry) throws CommandExecutionException { } } -} \ No newline at end of file +} diff --git a/src/main/java/net/aufdemrand/denizen/scripts/commands/player/NarrateCommand.java b/src/main/java/net/aufdemrand/denizen/scripts/commands/player/NarrateCommand.java index c1dee28104..0dd2d1a495 100644 --- a/src/main/java/net/aufdemrand/denizen/scripts/commands/player/NarrateCommand.java +++ b/src/main/java/net/aufdemrand/denizen/scripts/commands/player/NarrateCommand.java @@ -91,4 +91,4 @@ public void execute(ScriptEntry scriptEntry) throws CommandExecutionException { } } -} \ No newline at end of file +} diff --git a/src/main/java/net/aufdemrand/denizen/scripts/commands/player/ShowFakeCommand.java b/src/main/java/net/aufdemrand/denizen/scripts/commands/player/ShowFakeCommand.java index 02568fc130..d8ea4cc154 100644 --- a/src/main/java/net/aufdemrand/denizen/scripts/commands/player/ShowFakeCommand.java +++ b/src/main/java/net/aufdemrand/denizen/scripts/commands/player/ShowFakeCommand.java @@ -72,6 +72,4 @@ public void execute(ScriptEntry scriptEntry) throws CommandExecutionException { } } - - -} \ No newline at end of file +} diff --git a/src/main/java/net/aufdemrand/denizen/scripts/commands/server/ExecuteCommand.java b/src/main/java/net/aufdemrand/denizen/scripts/commands/server/ExecuteCommand.java index f0006d273f..acc3cae2f1 100644 --- a/src/main/java/net/aufdemrand/denizen/scripts/commands/server/ExecuteCommand.java +++ b/src/main/java/net/aufdemrand/denizen/scripts/commands/server/ExecuteCommand.java @@ -39,7 +39,7 @@ else if (aH.matchesArg("ASSERVER, AS_SERVER", arg)) executeType = Type.AS_SERVER; else command = arg; - } + } if (executeType == null) throw new InvalidArgumentsException(Messages.ERROR_MISSING_OTHER, "EXECUTE_TYPE"); @@ -75,7 +75,7 @@ public void execute(ScriptEntry scriptEntry) throws CommandExecutionException { case AS_PLAYER: scriptEntry.getPlayer().getPlayerEntity().performCommand(command); return; - + case AS_OP: boolean isOp = false; if (scriptEntry.getPlayer().getPlayerEntity().isOp()) isOp = true; @@ -83,7 +83,7 @@ public void execute(ScriptEntry scriptEntry) throws CommandExecutionException { scriptEntry.getPlayer().getPlayerEntity().performCommand(command); if (!isOp) scriptEntry.getPlayer().getPlayerEntity().setOp(false); return; - + case AS_NPC: boolean should_despawn = false; if (!scriptEntry.getNPC().isSpawned()) { @@ -99,10 +99,10 @@ public void execute(ScriptEntry scriptEntry) throws CommandExecutionException { ((Player) scriptEntry.getNPC().getEntity()).setOp(false); if (should_despawn) scriptEntry.getNPC().getCitizen().despawn(DespawnReason.PLUGIN); return; - + case AS_SERVER: denizen.getServer().dispatchCommand(denizen.getServer().getConsoleSender(), command); } } - -} \ No newline at end of file + +} diff --git a/src/main/java/net/aufdemrand/denizen/scripts/commands/server/ScoreboardCommand.java b/src/main/java/net/aufdemrand/denizen/scripts/commands/server/ScoreboardCommand.java index b531c2e95b..ebea1c19ab 100644 --- a/src/main/java/net/aufdemrand/denizen/scripts/commands/server/ScoreboardCommand.java +++ b/src/main/java/net/aufdemrand/denizen/scripts/commands/server/ScoreboardCommand.java @@ -127,4 +127,4 @@ public void execute(ScriptEntry scriptEntry) throws CommandExecutionException { } } -} \ No newline at end of file +} diff --git a/src/main/java/net/aufdemrand/denizen/scripts/commands/world/BreakCommand.java b/src/main/java/net/aufdemrand/denizen/scripts/commands/world/BreakCommand.java index 128455f65e..c84e640456 100644 --- a/src/main/java/net/aufdemrand/denizen/scripts/commands/world/BreakCommand.java +++ b/src/main/java/net/aufdemrand/denizen/scripts/commands/world/BreakCommand.java @@ -20,7 +20,7 @@ */ public class BreakCommand extends AbstractCommand { - + @Override public void parseArgs(ScriptEntry scriptEntry) throws InvalidArgumentsException { @@ -55,7 +55,7 @@ else if (scriptEntry.getNPC() != null && scriptEntry.getNPC().isSpawned()) } } - + @Override public void execute(ScriptEntry scriptEntry) throws CommandExecutionException { @@ -82,4 +82,4 @@ public void run() { breaker.run(); } -} \ No newline at end of file +} diff --git a/src/main/java/net/aufdemrand/denizen/scripts/commands/world/CreateWorldCommand.java b/src/main/java/net/aufdemrand/denizen/scripts/commands/world/CreateWorldCommand.java index 3f9099ccdf..87dae79990 100644 --- a/src/main/java/net/aufdemrand/denizen/scripts/commands/world/CreateWorldCommand.java +++ b/src/main/java/net/aufdemrand/denizen/scripts/commands/world/CreateWorldCommand.java @@ -11,7 +11,7 @@ import org.bukkit.WorldCreator; /** - * Your command! + * Your command! * This class is a template for a Command in Denizen. * * If loading externally, implement dExternal and its load() method. @@ -82,4 +82,4 @@ public void execute(ScriptEntry scriptEntry) throws CommandExecutionException { } -} \ No newline at end of file +} diff --git a/src/main/java/net/aufdemrand/denizen/scripts/commands/world/DropCommand.java b/src/main/java/net/aufdemrand/denizen/scripts/commands/world/DropCommand.java index ba77f22c28..72dee0f0b3 100644 --- a/src/main/java/net/aufdemrand/denizen/scripts/commands/world/DropCommand.java +++ b/src/main/java/net/aufdemrand/denizen/scripts/commands/world/DropCommand.java @@ -144,4 +144,4 @@ public void execute(ScriptEntry scriptEntry) throws CommandExecutionException { // Okay! } -} \ No newline at end of file +} diff --git a/src/main/java/net/aufdemrand/denizen/scripts/commands/world/ExplodeCommand.java b/src/main/java/net/aufdemrand/denizen/scripts/commands/world/ExplodeCommand.java index a3fd66b4f7..3d5338a314 100644 --- a/src/main/java/net/aufdemrand/denizen/scripts/commands/world/ExplodeCommand.java +++ b/src/main/java/net/aufdemrand/denizen/scripts/commands/world/ExplodeCommand.java @@ -18,69 +18,69 @@ */ public class ExplodeCommand extends AbstractCommand { - + @Override public void parseArgs(ScriptEntry scriptEntry) throws InvalidArgumentsException { // Iterate through arguments for (aH.Argument arg : aH.interpret(scriptEntry.getArguments())) { - + if (!scriptEntry.hasObject("location") && arg.matchesArgumentType(dLocation.class)) { // Location arg scriptEntry.addObject("location", arg.asType(dLocation.class)); } - + else if (!scriptEntry.hasObject("power") && arg.matchesPrimitive(aH.PrimitiveType.Float) && arg.matchesPrefix("power, p")) { // Add value scriptEntry.addObject("power", arg.asElement()); } - + else if (!scriptEntry.hasObject("breakblocks") && arg.matches("breakblocks")) { - + scriptEntry.addObject("breakblocks", ""); } - + else if (!scriptEntry.hasObject("fire") && arg.matches("fire")) { - + scriptEntry.addObject("fire", ""); } } - + // Use default values if necessary - + scriptEntry.defaultObject("power", new Element(1.0)); scriptEntry.defaultObject("location", scriptEntry.hasNPC() ? scriptEntry.getNPC().getLocation() : null, scriptEntry.hasPlayer() ? scriptEntry.getPlayer().getLocation() : null); - + if (!scriptEntry.hasObject("location")) { throw new InvalidArgumentsException(Messages.ERROR_MISSING_OTHER, "LOCATION"); } } - + @Override public void execute(final ScriptEntry scriptEntry) throws CommandExecutionException { // Get objects - + final dLocation location = (dLocation) scriptEntry.getObject("location"); Element power = (Element) scriptEntry.getObject("power"); Boolean breakblocks = scriptEntry.hasObject("breakblocks"); Boolean fire = scriptEntry.hasObject("fire"); - + // Report to dB dB.report(getName(), (aH.debugObj("location", location.toString()) + aH.debugObj("power", power) + aH.debugObj("breakblocks", breakblocks) + aH.debugObj("fire", fire))); - + location.getWorld().createExplosion (location.getX(), location.getY(), location.getZ(), power.asFloat(), fire, breakblocks); } -} \ No newline at end of file +} diff --git a/src/main/java/net/aufdemrand/denizen/scripts/commands/world/FireworkCommand.java b/src/main/java/net/aufdemrand/denizen/scripts/commands/world/FireworkCommand.java index cba9d24f64..27a80a9e7e 100644 --- a/src/main/java/net/aufdemrand/denizen/scripts/commands/world/FireworkCommand.java +++ b/src/main/java/net/aufdemrand/denizen/scripts/commands/world/FireworkCommand.java @@ -31,7 +31,7 @@ */ public class FireworkCommand extends AbstractCommand { - + @Override public void parseArgs(ScriptEntry scriptEntry) throws InvalidArgumentsException { @@ -51,48 +51,48 @@ public void parseArgs(ScriptEntry scriptEntry) throws InvalidArgumentsException } else if (aH.matchesValueArg("type", arg, ArgumentType.String)) { - + String typeArg = arg.split(":", 2)[1].toUpperCase(); - + if (typeArg.matches("RANDOM")) { - + type = FireworkEffect.Type.values()[Utilities.getRandom().nextInt(FireworkEffect.Type.values().length)]; } else { - + for (FireworkEffect.Type typeValue : FireworkEffect.Type.values()) { - + if (typeArg.matches(typeValue.name())) { - + type = typeValue; break; } } } - + dB.echoDebug("...will be of type " + type); - + } else if (aH.matchesValueArg("power", arg, ArgumentType.Integer)) { power = aH.getIntegerFrom(arg); dB.echoDebug("...will have a power of " + power); - + } else if (aH.matchesArg("flicker", arg)) { flicker = true; dB.echoDebug("...will flicker."); - + } else if (aH.matchesArg("trail", arg)) { trail = true; dB.echoDebug("...will have a trail."); - + } else if (aH.matchesValueArg("PRIMARY", arg, ArgumentType.String)) { // May be multiple colors, so let's treat this as a potential list. // dScript list entries are separated by pipes ('|') for (String element : aH.getListFrom(arg)) { - + if (dColor.matches(element)) { primary.add(dColor.valueOf(element).getColor()); } @@ -103,7 +103,7 @@ else if (aH.matchesValueArg("PRIMARY", arg, ArgumentType.String)) { } else if (aH.matchesValueArg("FADE", arg, ArgumentType.String)) { // Same as above for (String element : aH.getListFrom(arg)) { - + if (dColor.matches(element)) { fade.add(dColor.valueOf(element).getColor()); } @@ -124,12 +124,12 @@ else if (aH.matchesValueArg("PRIMARY", arg, ArgumentType.String)) { scriptEntry.addObject("flicker", flicker); scriptEntry.addObject("trail", trail); } - + @SuppressWarnings("unchecked") @Override public void execute(final ScriptEntry scriptEntry) throws CommandExecutionException { // Get objects - + final dLocation location = scriptEntry.hasObject("location") ? (dLocation) scriptEntry.getObject("location") : (dLocation) scriptEntry.getNPC().getLocation(); @@ -139,30 +139,30 @@ public void execute(final ScriptEntry scriptEntry) throws CommandExecutionExcept Type type = (Type) scriptEntry.getObject("type"); List primary = (List) scriptEntry.getObject("primary"); List fade = (List) scriptEntry.getObject("fade"); - + Firework firework = location.getWorld().spawn(location, Firework.class); FireworkMeta fireworkMeta = (FireworkMeta) firework.getFireworkMeta(); fireworkMeta.setPower(power); - + Builder fireworkBuilder = FireworkEffect.builder(); - + fireworkBuilder.with(type); - + // If there are no primary colors, there will be an error, so add one if (primary.size() == 0) { - + primary.add(dColor.valueOf("yellow").getColor()); } - + fireworkBuilder.withColor(primary); fireworkBuilder.withFade(fade); - + if (flicker) { fireworkBuilder.withFlicker(); } if (trail) { fireworkBuilder.withTrail(); } - + fireworkMeta.addEffects(fireworkBuilder.build()); firework.setFireworkMeta(fireworkMeta); } -} \ No newline at end of file +} diff --git a/src/main/java/net/aufdemrand/denizen/scripts/commands/world/SignCommand.java b/src/main/java/net/aufdemrand/denizen/scripts/commands/world/SignCommand.java index 3f48b11bd6..5a525d711c 100644 --- a/src/main/java/net/aufdemrand/denizen/scripts/commands/world/SignCommand.java +++ b/src/main/java/net/aufdemrand/denizen/scripts/commands/world/SignCommand.java @@ -25,43 +25,43 @@ public class SignCommand extends AbstractCommand { private enum Type { SIGN_POST, WALL_SIGN } - + @Override public void parseArgs(ScriptEntry scriptEntry) throws InvalidArgumentsException { - + for (aH.Argument arg : aH.interpret(scriptEntry.getArguments())) { if (!scriptEntry.hasObject("type") && arg.matchesEnum(Type.values())) // add Type scriptEntry.addObject("type", Type.valueOf(arg.getValue().toUpperCase())); - + else if (!scriptEntry.hasObject("location") && arg.matchesArgumentType(dLocation.class)) // Location arg scriptEntry.addObject("location", arg.asType(dLocation.class).setPrefix("location")); - + else if (!scriptEntry.hasObject("text") && arg.matchesArgumentType(dList.class)) // add text scriptEntry.addObject("text", arg.asType(dList.class)); - + else if (!scriptEntry.hasObject("direction") && arg.matchesPrefix("direction, dir")) scriptEntry.addObject("direction", arg.asElement()); } // Check to make sure required arguments have been filled - + if (!scriptEntry.hasObject("location")) throw new InvalidArgumentsException("Must specify a Sign location!"); - + // Default to SIGN_POST type - + if (!scriptEntry.hasObject("type")) scriptEntry.addObject("type", Type.SIGN_POST); } - + @SuppressWarnings("unchecked") @Override public void execute(final ScriptEntry scriptEntry) throws CommandExecutionException { @@ -71,20 +71,20 @@ public void execute(final ScriptEntry scriptEntry) throws CommandExecutionExcept Type type = (Type) scriptEntry.getObject("type"); dList text = (dList) scriptEntry.getObject("text"); dLocation location = (dLocation) scriptEntry.getObject("location"); - + // Report to dB dB.report(getName(), type.name() + ", " + aH.debugObj("location", location) + aH.debugObj("text", text)); - + Block sign = location.getBlock(); sign.setType(Material.valueOf(type.name())); BlockState signState = sign.getState(); - + Utilities.setSignLines((Sign) signState, text.toArray()); if (direction != null) Utilities.setSignRotation(signState, direction); else Utilities.setSignRotation(signState); } -} \ No newline at end of file +} diff --git a/src/main/java/net/aufdemrand/denizen/scripts/commands/world/ViewerCommand.java b/src/main/java/net/aufdemrand/denizen/scripts/commands/world/ViewerCommand.java index 23083cc3c5..6ea336a5b6 100644 --- a/src/main/java/net/aufdemrand/denizen/scripts/commands/world/ViewerCommand.java +++ b/src/main/java/net/aufdemrand/denizen/scripts/commands/world/ViewerCommand.java @@ -37,7 +37,7 @@ public class ViewerCommand extends AbstractCommand implements Listener { private enum Action { CREATE, MODIFY, REMOVE } private enum Type { SIGN_POST, WALL_SIGN } private enum Display { LOCATION, SCORE } - + static Map viewers = new ConcurrentHashMap(); @Override @@ -49,44 +49,44 @@ public void parseArgs(ScriptEntry scriptEntry) throws InvalidArgumentsException && arg.matchesEnum(Action.values())) // add Action scriptEntry.addObject("action", Action.valueOf(arg.getValue().toUpperCase())); - + else if (!scriptEntry.hasObject("type") && arg.matchesEnum(Type.values())) // add Action scriptEntry.addObject("type", Type.valueOf(arg.getValue().toUpperCase())); - + else if (!scriptEntry.hasObject("display") && arg.matchesEnum(Display.values())) // add Action scriptEntry.addObject("display, d", Display.valueOf(arg.getValue().toUpperCase())); - + else if (arg.matchesPrefix("i, id")) scriptEntry.addObject("id", arg.asElement()); - + else if (!scriptEntry.hasObject("location") && arg.matchesArgumentType(dLocation.class)) // Location arg scriptEntry.addObject("location", arg.asType(dLocation.class).setPrefix("location")); - + else if (!scriptEntry.hasObject("direction") && arg.matchesPrefix("direction, dir")) scriptEntry.addObject("direction", arg.asElement()); - + } if (!scriptEntry.hasObject("action")) scriptEntry.addObject("action", Action.CREATE); - + if (!scriptEntry.hasObject("display") && scriptEntry.getObject("action").equals(Action.CREATE)) scriptEntry.addObject("display", Display.LOCATION); - + if (!scriptEntry.hasObject("id")) throw new InvalidArgumentsException("Must specify a Viewer ID!"); - + if (!scriptEntry.hasObject("location") && scriptEntry.getObject("action").equals(Action.CREATE)) throw new InvalidArgumentsException("Must specify a Sign location!"); - + if (!scriptEntry.hasObject("type") && scriptEntry.getObject("action").equals(Action.CREATE)) scriptEntry.addObject("type", Type.SIGN_POST); } @@ -104,26 +104,26 @@ public void execute(final ScriptEntry scriptEntry) throws CommandExecutionExcept if (viewers.containsKey(id)) scriptEntry.setPlayer(dPlayer.valueOf(viewers.get(id).getContent().split("; ")[1])); dLocation location = scriptEntry.hasObject("location") ? (dLocation) scriptEntry.getObject("location") : null; String content = scriptEntry.hasObject("display") ? display.toString() + "; " + scriptEntry.getPlayer().getName() : null; - + switch (action) { - + case CREATE: if (viewers.containsKey(id)) { dB.echoDebug("Viewer ID " + id + " already exists!"); return; } - + Viewer viewer = new Viewer(id, content, location); viewers.put(id, viewer); - + final Block sign = location.getBlock(); sign.setType(Material.valueOf(type.name())); - + if (direction != null) Utilities.setSignRotation(sign.getState(), direction); else Utilities.setSignRotation(sign.getState()); - + int task = Bukkit.getScheduler().scheduleSyncRepeatingTask(DenizenAPI.getCurrentInstance(), new Runnable() { public void run() { Player player = Bukkit.getPlayerExact(viewers.get(id).getContent().split("; ")[1]); @@ -131,16 +131,16 @@ public void run() { Utilities.setSignLines((Sign) viewers.get(id).getLocation().getBlock().getState(), new String[]{"", viewers.get(id).getContent().split("; ")[1], "is offline.", ""}); else Utilities.setSignLines((Sign) viewers.get(id).getLocation().getBlock().getState(), new String[]{String.valueOf((int) player.getLocation().getX()), String.valueOf((int) player.getLocation().getY()), String.valueOf((int) player.getLocation().getZ()), player.getWorld().getName()}); - + } }, 0, 20); - + viewer.setTask(task); viewer.save(); - + break; - - + + case MODIFY: if (!viewers.containsKey(id)) { dB.echoDebug("Viewer ID " + id + " doesn't exist!"); @@ -157,7 +157,7 @@ public void run() { Utilities.setSignLines((Sign) viewers.get(id).getLocation().getBlock().getState(), new String[]{"", viewers.get(id).getContent().split("; ")[1], "is offline.", ""}); else Utilities.setSignLines((Sign) viewers.get(id).getLocation().getBlock().getState(), new String[]{String.valueOf((int) player.getLocation().getX()), String.valueOf((int) player.getLocation().getY()), String.valueOf((int) player.getLocation().getZ()), player.getWorld().getName()}); - + } }, 0, 20); viewers.get(id).getLocation().getBlock().setType(Material.AIR); @@ -165,18 +165,18 @@ public void run() { viewers.get(id).setTask(newTask); location.getBlock().setType(Material.valueOf(type.name())); } - + break; - + case REMOVE: if (!viewers.containsKey(id)) { dB.echoDebug("Viewer ID " + id + " doesn't exist!"); return; } - + Block block = viewers.get(id).getLocation().getBlock(); block.setType(Material.AIR); - + Bukkit.getScheduler().cancelTask(viewers.get(id).getTask()); viewers.get(id).remove(); viewers.remove(id); @@ -192,7 +192,7 @@ private static class Viewer { private Viewer(String id) { this.id = id; } - + private Viewer(String id, String content, dLocation location) { this.id = id; this.content = content; @@ -206,19 +206,19 @@ void setContent(String content) { void setLocation(dLocation location) { this.location = location; } - + void setTask(int task) { this.task = task; } - + private String getContent() { return this.content; } - + private dLocation getLocation() { return this.location; } - + private int getTask() { return this.task; } @@ -231,10 +231,10 @@ void save() { // Save location saves.set("Viewers." + id.toLowerCase() + ".location", location.identify()); } - + void remove() { FileConfiguration saves = DenizenAPI.getCurrentInstance().getSaves(); - + saves.set("Viewers." + id.toLowerCase(), null); } @@ -242,15 +242,15 @@ void remove() { @EventHandler public static void reloadViewers(SavesReloadEvent event) { - + for (Viewer viewer : viewers.values()) { Bukkit.getScheduler().cancelTask(viewer.getTask()); } - + viewers.clear(); FileConfiguration saves = DenizenAPI.getCurrentInstance().getSaves(); - + if (saves.contains("Viewers")) for (final String id : saves.getConfigurationSection("Viewers").getKeys(false)) { Viewer viewer = new Viewer(id, saves.getString("Viewers." + id.toLowerCase() + ".content"), dLocation.valueOf(saves.getString("Viewers." + id.toLowerCase() + ".location"))); @@ -263,14 +263,14 @@ public void run() { Utilities.setSignLines((Sign) viewers.get(id).getLocation().getBlock().getState(), new String[]{"", viewers.get(id).getContent().split("; ")[1], "is offline.", ""}); else Utilities.setSignLines((Sign) viewers.get(id).getLocation().getBlock().getState(), new String[]{String.valueOf((int) player.getLocation().getX()), String.valueOf((int) player.getLocation().getY()), String.valueOf((int) player.getLocation().getZ()), player.getWorld().getName()}); - + } }, 0, 20); viewer.setTask(task); } } } - + @EventHandler public static void blockBreak(BlockBreakEvent event) { dLocation location = new dLocation(event.getBlock().getLocation()); @@ -280,17 +280,17 @@ public static void blockBreak(BlockBreakEvent event) { event.setCancelled(true); } } - + @Override public void onEnable() { DenizenAPI.getCurrentInstance().getServer().getPluginManager() .registerEvents(this, DenizenAPI.getCurrentInstance()); } - + @Override public void onDisable() { for (Viewer viewer : viewers.values()) viewer.save(); } -} \ No newline at end of file +}