From f4fe762135e1aa3d44ca5666c6c3680d6e19c3f7 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Tue, 28 Jun 2016 20:21:50 +1000 Subject: [PATCH] * --- .../bukkit/listeners/ChunkListener.java | 2 +- .../plot/commands/Visit.java | 2 +- .../plot/util/StringMan.java | 2 +- .../plotsquared/general/commands/Command.java | 30 ++++++++++--------- 4 files changed, 19 insertions(+), 17 deletions(-) diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/ChunkListener.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/ChunkListener.java index 4e5ab09da..ef9efb221 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/ChunkListener.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/ChunkListener.java @@ -108,7 +108,7 @@ public class ChunkListener implements Listener { } Object c = this.methodGetHandleChunk.of(chunk).call(); RefField.RefExecutor field = this.mustSave.of(c); - if (field.get() == true) { + if ((Boolean) field.get() == true) { field.set(false); if (chunk.isLoaded()) { ignoreUnload = true; diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Visit.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Visit.java index b09662e77..4e1a73e60 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Visit.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Visit.java @@ -122,7 +122,7 @@ public class Visit extends Command { if (plot.teleportPlayer(player)) { whenDone.run(Visit.this, CommandResult.SUCCESS); } else { - whenDone.run(Visit.this, CommandResult.SUCCESS); + whenDone.run(Visit.this, CommandResult.FAILURE); } } }, new Runnable() { diff --git a/Core/src/main/java/com/intellectualcrafters/plot/util/StringMan.java b/Core/src/main/java/com/intellectualcrafters/plot/util/StringMan.java index d9fc43834..7a0d857ae 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/util/StringMan.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/util/StringMan.java @@ -265,7 +265,7 @@ public class StringMan { return sb.toString(); } - public Collection match(Collection col, String startsWith) { + public Collection match(Collection col, String startsWith) { if (col == null) { return null; } diff --git a/Core/src/main/java/com/plotsquared/general/commands/Command.java b/Core/src/main/java/com/plotsquared/general/commands/Command.java index 731f4102b..de19e75a1 100644 --- a/Core/src/main/java/com/plotsquared/general/commands/Command.java +++ b/Core/src/main/java/com/plotsquared/general/commands/Command.java @@ -485,20 +485,22 @@ public abstract class Command { } public Collection tabOf(PlotPlayer player, String[] input, boolean space, String... args) { - /* - - - - - <#> - */ -// int index = input.length - (space ? 0 : 1); -// List result = new ArrayList<>(); -// for (String arg : args) { -// String[] split = arg.split(" "); -// } - // TODO - return new ArrayList<>(); + if (!space) { + return null; + } + List result = new ArrayList<>(); + int index = input.length - (space ? 0 : 1); + for (String arg : args) { + arg = arg.replace(getCommandString() + " ", ""); + String[] split = arg.split(" "); + if (split.length <= index) { + continue; + } + arg = StringMan.join(Arrays.copyOfRange(split, index, split.length), " "); + Command cmd = new Command(null, false, arg, getPermission(), getRequiredType(), null) {}; + result.add(cmd); + } + return result; } public Collection tab(PlotPlayer player, String[] args, boolean space) {