Fix plot merging arguments

This commit is contained in:
boy0001 2015-07-31 04:46:06 +10:00
parent 4eae78590f
commit 9dad492554
4 changed files with 43 additions and 19 deletions

15
pom.xml
View File

@ -67,6 +67,21 @@
</excludes> </excludes>
</configuration> </configuration>
</execution> </execution>
<execution>
<id>api</id>
<goals>
<goal>jar</goal>
</goals>
<phase>package</phase>
<configuration>
<finalName>PlotSquared-Null</finalName>
<excludes>
<exclude>**/com/plotsquared/bukkit/**</exclude>
<exclude>**/com/intellectualcrafters/plot/api/*</exclude>
<exclude>**/com/plotsquared/sponge/**</exclude>
</excludes>
</configuration>
</execution>
</executions> </executions>
</plugin> </plugin>
<plugin> <plugin>

View File

@ -369,9 +369,10 @@ public class MainCommand extends CommandManager<PlotPlayer> {
boolean result = cmd.onCommand(plr, args); boolean result = cmd.onCommand(plr, args);
if (!result) { if (!result) {
String usage = cmd.getUsage(); String usage = cmd.getUsage();
if (usage != null && !usage.isEmpty()) { // Unecessary!
MainUtil.sendMessage(plr, usage); // if (usage != null && !usage.isEmpty()) {
} // MainUtil.sendMessage(plr, usage);
// }
return CommandHandlingOutput.WRONG_USAGE; return CommandHandlingOutput.WRONG_USAGE;
} }
} catch (final Throwable t) { } catch (final Throwable t) {

View File

@ -54,12 +54,6 @@ public class Merge extends SubCommand {
public final static String[] values = new String[] { "north", "east", "south", "west" }; public final static String[] values = new String[] { "north", "east", "south", "west" };
public final static String[] aliases = new String[] { "n", "e", "s", "w" }; public final static String[] aliases = new String[] { "n", "e", "s", "w" };
public Merge() {
requiredArguments = new Argument[] {
Argument.String
};
}
public static String direction(float yaw) { public static String direction(float yaw) {
yaw = yaw / 90; yaw = yaw / 90;
final int i = Math.round(yaw); final int i = Math.round(yaw);
@ -99,16 +93,29 @@ public class Merge extends SubCommand {
MainUtil.sendMessage(plr, C.NO_PLOT_PERMS); MainUtil.sendMessage(plr, C.NO_PLOT_PERMS);
return false; 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; int direction = -1;
for (int i = 0; i < values.length; i++) { if (args.length == 0) {
if (args[0].equalsIgnoreCase(values[i]) || args[0].equalsIgnoreCase(aliases[i])) { switch (direction(plr.getLocationFull().getYaw())) {
direction = i; case "NORTH":
break; 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) { if (direction == -1) {

View File

@ -171,7 +171,8 @@ public class BukkitUtil extends BlockManager {
} }
public static Location getLocationFull(final Entity entity) { 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());
} }
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////