From 9dad4925541fec8cb521c55e5fcf1e67dedd4beb Mon Sep 17 00:00:00 2001 From: boy0001 Date: Fri, 31 Jul 2015 04:46:06 +1000 Subject: [PATCH] Fix plot merging arguments --- pom.xml | 15 ++++++++ .../plot/commands/MainCommand.java | 7 ++-- .../plot/commands/Merge.java | 37 +++++++++++-------- .../plotsquared/bukkit/util/BukkitUtil.java | 3 +- 4 files changed, 43 insertions(+), 19 deletions(-) diff --git a/pom.xml b/pom.xml index 1d0607571..42c18431f 100644 --- a/pom.xml +++ b/pom.xml @@ -67,6 +67,21 @@ + + api + + jar + + package + + PlotSquared-Null + + **/com/plotsquared/bukkit/** + **/com/intellectualcrafters/plot/api/* + **/com/plotsquared/sponge/** + + + diff --git a/src/main/java/com/intellectualcrafters/plot/commands/MainCommand.java b/src/main/java/com/intellectualcrafters/plot/commands/MainCommand.java index a19264eb4..027341746 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/MainCommand.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/MainCommand.java @@ -369,9 +369,10 @@ public class MainCommand extends CommandManager { boolean result = cmd.onCommand(plr, args); if (!result) { String usage = cmd.getUsage(); - if (usage != null && !usage.isEmpty()) { - MainUtil.sendMessage(plr, usage); - } + // Unecessary! +// if (usage != null && !usage.isEmpty()) { +// MainUtil.sendMessage(plr, usage); +// } return CommandHandlingOutput.WRONG_USAGE; } } catch (final Throwable t) { diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Merge.java b/src/main/java/com/intellectualcrafters/plot/commands/Merge.java index 62eb9b6c2..5ab29e137 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/Merge.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/Merge.java @@ -54,12 +54,6 @@ public class Merge extends SubCommand { public final static String[] values = new String[] { "north", "east", "south", "west" }; public final static String[] aliases = new String[] { "n", "e", "s", "w" }; - public Merge() { - requiredArguments = new Argument[] { - Argument.String - }; - } - public static String direction(float yaw) { yaw = yaw / 90; final int i = Math.round(yaw); @@ -99,16 +93,29 @@ public class Merge extends SubCommand { MainUtil.sendMessage(plr, C.NO_PLOT_PERMS); return false; } - if (args.length < 1) { - MainUtil.sendMessage(plr, C.SUBCOMMAND_SET_OPTIONS_HEADER.s() + StringMan.join(values, C.BLOCK_LIST_SEPARATER.s())); - MainUtil.sendMessage(plr, C.DIRECTION.s().replaceAll("%dir%", direction(loc.getYaw()))); - return false; - } int direction = -1; - for (int i = 0; i < values.length; i++) { - if (args[0].equalsIgnoreCase(values[i]) || args[0].equalsIgnoreCase(aliases[i])) { - direction = i; - break; + if (args.length == 0) { + switch (direction(plr.getLocationFull().getYaw())) { + case "NORTH": + direction = 0; + break; + case "EAST": + direction = 1; + break; + case "SOUTH": + direction = 2; + break; + case "WEST": + direction = 3; + break; + } + } + else { + for (int i = 0; i < values.length; i++) { + if (args[0].equalsIgnoreCase(values[i]) || args[0].equalsIgnoreCase(aliases[i])) { + direction = i; + break; + } } } if (direction == -1) { diff --git a/src/main/java/com/plotsquared/bukkit/util/BukkitUtil.java b/src/main/java/com/plotsquared/bukkit/util/BukkitUtil.java index 4306b0154..b60024edc 100644 --- a/src/main/java/com/plotsquared/bukkit/util/BukkitUtil.java +++ b/src/main/java/com/plotsquared/bukkit/util/BukkitUtil.java @@ -171,7 +171,8 @@ public class BukkitUtil extends BlockManager { } public static Location getLocationFull(final Entity entity) { - return getLocation(entity.getLocation()); + org.bukkit.Location loc = entity.getLocation(); + return new Location(loc.getWorld().getName(), (int) loc.getX(), (int) loc.getY(), (int) loc.getZ(), loc.getYaw(), loc.getPitch()); } ////////////////////////////////////////////////////////////////////////