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

View File

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

View File

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