Fixed no argument feedback for move/copy/swap

This commit is contained in:
Jesse Boyd 2015-10-18 23:18:45 +11:00
parent 26c0e3fa85
commit f75822f56c
5 changed files with 23 additions and 14 deletions

View File

@ -8,7 +8,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties> </properties>
<artifactId>PlotSquared</artifactId> <artifactId>PlotSquared</artifactId>
<version>3.2.10</version> <version>3.2.12</version>
<name>PlotSquared</name> <name>PlotSquared</name>
<packaging>jar</packaging> <packaging>jar</packaging>
<build> <build>

View File

@ -54,13 +54,17 @@ public class Copy extends SubCommand {
MainUtil.sendMessage(plr, C.NO_PLOT_PERMS); MainUtil.sendMessage(plr, C.NO_PLOT_PERMS);
return false; return false;
} }
if (args.length != 1) {
C.COMMAND_SYNTAX.send(plr, getUsage());
return false;
}
final Plot plot2 = MainUtil.getPlotFromString(plr, args[0], true); final Plot plot2 = MainUtil.getPlotFromString(plr, args[0], true);
if ((plot2 == null)) { if ((plot2 == null)) {
return false; return false;
} }
if (plot1.equals(plot2)) { if (plot1.equals(plot2)) {
MainUtil.sendMessage(plr, C.NOT_VALID_PLOT_ID); MainUtil.sendMessage(plr, C.NOT_VALID_PLOT_ID);
MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot copy <X;Z>"); C.COMMAND_SYNTAX.send(plr, getUsage());
return false; return false;
} }
if (!plot1.getWorld().equals(plot2.getWorld())) { if (!plot1.getWorld().equals(plot2.getWorld())) {

View File

@ -20,19 +20,23 @@
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands; package com.intellectualcrafters.plot.commands;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.object.Location; import com.intellectualcrafters.plot.object.Location;
import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotId;
import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.object.PlotWorld;
import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.Permissions; import com.intellectualcrafters.plot.util.Permissions;
import com.plotsquared.general.commands.Argument; import com.plotsquared.general.commands.Argument;
import com.plotsquared.general.commands.CommandDeclaration; import com.plotsquared.general.commands.CommandDeclaration;
@CommandDeclaration(command = "move", description = "Move a plot", aliases = { "debugmove" }, permission = "plots.move", category = CommandCategory.ACTIONS, requiredType = RequiredType.NONE) @CommandDeclaration(
usage = "/plot move <X;Z>",
command = "move",
description = "Move a plot",
aliases = { "debugmove" },
permission = "plots.move",
category = CommandCategory.ACTIONS,
requiredType = RequiredType.NONE)
public class Move extends SubCommand { public class Move extends SubCommand {
public Move() { public Move() {
@ -50,6 +54,10 @@ public class Move extends SubCommand {
MainUtil.sendMessage(plr, C.NO_PLOT_PERMS); MainUtil.sendMessage(plr, C.NO_PLOT_PERMS);
return false; return false;
} }
if (args.length != 1) {
C.COMMAND_SYNTAX.send(plr, getUsage());
return false;
}
final Plot plot2 = MainUtil.getPlotFromString(plr, args[0], true); final Plot plot2 = MainUtil.getPlotFromString(plr, args[0], true);
if ((plot2 == null)) { if ((plot2 == null)) {
return false; return false;

View File

@ -20,22 +20,15 @@
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands; package com.intellectualcrafters.plot.commands;
import java.util.ArrayList;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.object.Location; import com.intellectualcrafters.plot.object.Location;
import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotCluster;
import com.intellectualcrafters.plot.object.PlotClusterId;
import com.intellectualcrafters.plot.object.PlotId;
import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.util.ChunkManager;
import com.intellectualcrafters.plot.util.ClusterManager;
import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.Permissions; import com.intellectualcrafters.plot.util.Permissions;
import com.plotsquared.general.commands.CommandDeclaration; import com.plotsquared.general.commands.CommandDeclaration;
@CommandDeclaration(command = "swap", description = "Swap two plots", aliases = { "switch" }, category = CommandCategory.ACTIONS, requiredType = RequiredType.NONE) @CommandDeclaration(usage = "/plot swap <X;Z>", command = "swap", description = "Swap two plots", aliases = { "switch" }, category = CommandCategory.ACTIONS, requiredType = RequiredType.NONE)
public class Swap extends SubCommand { public class Swap extends SubCommand {
@Override @Override
@ -49,6 +42,10 @@ public class Swap extends SubCommand {
MainUtil.sendMessage(plr, C.NO_PLOT_PERMS); MainUtil.sendMessage(plr, C.NO_PLOT_PERMS);
return false; return false;
} }
if (args.length != 1) {
C.COMMAND_SYNTAX.send(plr, getUsage());
return false;
}
final Plot plot2 = MainUtil.getPlotFromString(plr, args[0], true); final Plot plot2 = MainUtil.getPlotFromString(plr, args[0], true);
if ((plot2 == null)) { if ((plot2 == null)) {
return false; return false;

Binary file not shown.