Fix some issues with console commandas

This commit is contained in:
boy0001 2015-07-28 04:25:21 +10:00
parent dd2cbeaaf8
commit 4939f997dc
3 changed files with 9 additions and 6 deletions

View File

@ -235,7 +235,6 @@ public class MainCommand extends CommandManager<PlotPlayer> {
catch (NumberFormatException e) {} catch (NumberFormatException e) {}
} }
else if (ConsolePlayer.isConsole(player) && args.length >= 2) { else if (ConsolePlayer.isConsole(player) && args.length >= 2) {
System.out.print(1);
String[] split = args[0].split(";"); String[] split = args[0].split(";");
String world; String world;
PlotId id; PlotId id;
@ -252,10 +251,8 @@ public class MainCommand extends CommandManager<PlotPlayer> {
world = null; world = null;
} }
if (id != null && PS.get().isPlotWorld(world)) { if (id != null && PS.get().isPlotWorld(world)) {
System.out.print(2 + " | " + id + " | " + world);
Plot plot = MainUtil.getPlot(world, id); Plot plot = MainUtil.getPlot(world, id);
if (plot != null) { if (plot != null) {
System.out.print(3 + " | " + plot);
player.teleport(MainUtil.getPlotCenter(plot)); player.teleport(MainUtil.getPlotCenter(plot));
args = Arrays.copyOfRange(args, 1, args.length); args = Arrays.copyOfRange(args, 1, args.length);
} }
@ -298,8 +295,13 @@ public class MainCommand extends CommandManager<PlotPlayer> {
{ {
ArrayList<Command<PlotPlayer>> cmds = getCommands(); ArrayList<Command<PlotPlayer>> cmds = getCommands();
cmd = new StringComparison<Command<PlotPlayer>>(label, cmds).getMatchObject(); cmd = new StringComparison<Command<PlotPlayer>>(label, cmds).getMatchObject();
if (cmd == null) {
MainUtil.sendMessage(plr, C.DID_YOU_MEAN, "/plot help");
}
else {
MainUtil.sendMessage(plr, C.DID_YOU_MEAN, cmd.getUsage().replaceAll("{label}", label)); MainUtil.sendMessage(plr, C.DID_YOU_MEAN, cmd.getUsage().replaceAll("{label}", label));
} }
}
return CommandHandlingOutput.NOT_FOUND; return CommandHandlingOutput.NOT_FOUND;
} }
if (!cmd.getRequiredType().allows(plr)) { if (!cmd.getRequiredType().allows(plr)) {

View File

@ -25,6 +25,7 @@ import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.Settings; import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.flag.Flag; import com.intellectualcrafters.plot.flag.Flag;
import com.intellectualcrafters.plot.flag.FlagManager; import com.intellectualcrafters.plot.flag.FlagManager;
import com.intellectualcrafters.plot.object.ConsolePlayer;
import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.object.Rating; import com.intellectualcrafters.plot.object.Rating;
@ -32,6 +33,7 @@ import com.intellectualcrafters.plot.util.*;
import com.plotsquared.bukkit.object.BukkitPlayer; import com.plotsquared.bukkit.object.BukkitPlayer;
import com.plotsquared.bukkit.util.bukkit.chat.FancyMessage; import com.plotsquared.bukkit.util.bukkit.chat.FancyMessage;
import com.plotsquared.general.commands.CommandDeclaration; import com.plotsquared.general.commands.CommandDeclaration;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
@ -325,7 +327,7 @@ public class list extends SubCommand {
} }
} }
i++; i++;
if (player != null && Settings.FANCY_CHAT) { if (!ConsolePlayer.isConsole(player) && Settings.FANCY_CHAT) {
ChatColor color; ChatColor color;
if (plot.owner == null) { if (plot.owner == null) {
color = ChatColor.GOLD; color = ChatColor.GOLD;

View File

@ -47,7 +47,6 @@ public class ConsolePlayer implements PlotPlayer {
@Override @Override
public Location getLocation() { public Location getLocation() {
System.out.print(loc);
return loc; return loc;
} }