diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Delete.java b/src/main/java/com/intellectualcrafters/plot/commands/Delete.java index 3f074685b..8c54d5dd5 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/Delete.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/Delete.java @@ -40,6 +40,7 @@ import com.plotsquared.general.commands.CommandDeclaration; permission = "plots.delete", description = "Delete a plot", usage = "/plot delete", + aliases = "dispose", category = CommandCategory.ACTIONS, requiredType = RequiredType.NONE ) diff --git a/src/main/java/com/intellectualcrafters/plot/commands/MainCommand.java b/src/main/java/com/intellectualcrafters/plot/commands/MainCommand.java index a51c8f274..2ca5340a5 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/MainCommand.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/MainCommand.java @@ -124,14 +124,6 @@ public class MainCommand extends CommandManager { createCommand(new Copy()); createCommand(new Chat()); createCommand(new Trim()); - - if (Settings.ENABLE_CLUSTERS) { - createCommand(new Cluster()); - } - - // Broken -// createCommand(new DebugUUID()); - } public static boolean no_permission(final PlotPlayer player, final String permission) { @@ -141,7 +133,7 @@ public class MainCommand extends CommandManager { public static List> getCommands(final CommandCategory category, final PlotPlayer player) { List> commands = new ArrayList<>(); - for (Command command : instance.getCommands()) { + for (Command command : getInstance().getCommands()) { if (category != null && !command.getCategory().equals(category)) { continue; } @@ -330,14 +322,18 @@ public class MainCommand extends CommandManager { args = new String[parts.length - 2]; System.arraycopy(parts, 2, args, 0, args.length); } - Command cmd = null; - cmd = this.commands.get(label); + Command cmd; + if (label != null) { + cmd = getInstance().commands.get(label); + } + else { + cmd = null; + } if (cmd == null) { MainUtil.sendMessage(plr, C.NOT_VALID_SUBCOMMAND); { List> cmds = getCommands(null, plr); - cmd = new StringComparison<>(label, cmds).getMatchObject(); - if (cmd == null) { + if (label == null || (cmd = new StringComparison<>(label, cmds).getMatchObject()) == null) { MainUtil.sendMessage(plr, C.DID_YOU_MEAN, "/plot help"); } else { diff --git a/src/main/java/com/intellectualcrafters/plot/commands/plugin.java b/src/main/java/com/intellectualcrafters/plot/commands/plugin.java index fd6843d75..3ae1d0d79 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/plugin.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/plugin.java @@ -78,7 +78,7 @@ public class plugin extends SubCommand { add(String.format("$2>> $1&lAuthors$2: $1Citymonstret $2& $1Empire92")); add(String.format("$2>> $1&lWiki$2: $1https://github.com/IntellectualCrafters/PlotSquared/wiki")); add(String.format("$2>> $1&lWebsite$2: $1http://plotsquared.com")); - add(String.format("$2>> $1&lNewest Version$2: $1" + (PS.get().update == null ? PS.get().IMP.getPluginVersion() : PS.get().update))); + add(String.format("$2>> $1&lNewest Version$2: $1" + (PS.get().update == null ? StringMan.join(PS.get().IMP.getPluginVersion(), ".") : PS.get().update))); } }; for (final String s : strings) { diff --git a/src/main/java/com/intellectualcrafters/plot/config/Settings.java b/src/main/java/com/intellectualcrafters/plot/config/Settings.java index fdd96da12..044d53b7c 100644 --- a/src/main/java/com/intellectualcrafters/plot/config/Settings.java +++ b/src/main/java/com/intellectualcrafters/plot/config/Settings.java @@ -96,6 +96,7 @@ public class Settings { * Default kill road mobs: true */ public final static boolean KILL_ROAD_MOBS_DEFAULT = false; + public final static boolean KILL_ROAD_VEHICLES_DEFAULT = false; /** * Default mob pathfinding: true */ @@ -132,6 +133,7 @@ public class Settings { * Kill road mobs? */ public static boolean KILL_ROAD_MOBS; + public static boolean KILL_ROAD_VEHICLES; /** * mob pathfinding? */ diff --git a/src/main/java/com/plotsquared/bukkit/BukkitMain.java b/src/main/java/com/plotsquared/bukkit/BukkitMain.java index eed6eda2b..b41fa3aa7 100644 --- a/src/main/java/com/plotsquared/bukkit/BukkitMain.java +++ b/src/main/java/com/plotsquared/bukkit/BukkitMain.java @@ -14,6 +14,8 @@ import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import org.bukkit.event.Listener; import org.bukkit.generator.ChunkGenerator; +import org.bukkit.metadata.MetadataValue; +import org.bukkit.metadata.MetadataValueAdapter; import org.bukkit.plugin.Plugin; import org.bukkit.plugin.java.JavaPlugin; diff --git a/src/main/java/com/plotsquared/bukkit/util/BukkitCommand.java b/src/main/java/com/plotsquared/bukkit/util/BukkitCommand.java index d04f5d680..37970df66 100644 --- a/src/main/java/com/plotsquared/bukkit/util/BukkitCommand.java +++ b/src/main/java/com/plotsquared/bukkit/util/BukkitCommand.java @@ -11,8 +11,10 @@ import org.bukkit.command.CommandSender; import org.bukkit.command.TabCompleter; import org.bukkit.entity.Player; +import com.intellectualcrafters.plot.commands.Cluster; import com.intellectualcrafters.plot.commands.DebugUUID; import com.intellectualcrafters.plot.commands.MainCommand; +import com.intellectualcrafters.plot.config.Settings; import com.intellectualcrafters.plot.object.ConsolePlayer; import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.util.StringComparison; @@ -27,6 +29,9 @@ public class BukkitCommand implements CommandExecutor, TabCompleter { public BukkitCommand() { MainCommand.getInstance().addCommand(new DebugUUID()); + if (Settings.ENABLE_CLUSTERS) { + MainCommand.getInstance().addCommand(new Cluster()); + } } @Override @@ -55,6 +60,8 @@ public class BukkitCommand implements CommandExecutor, TabCompleter { return null; } final Set tabOptions = new HashSet<>(); + System.out.print(MainCommand.getInstance() + " mc"); + System.out.print(MainCommand.getInstance().getCommands() + " gc"); ArrayList> commands = MainCommand.getInstance().getCommands(); String best = new StringComparison(strings[0], commands).getBestMatch(); tabOptions.add(best); diff --git a/src/main/java/com/plotsquared/general/commands/CommandManager.java b/src/main/java/com/plotsquared/general/commands/CommandManager.java index 9700f6be4..eaa04361e 100644 --- a/src/main/java/com/plotsquared/general/commands/CommandManager.java +++ b/src/main/java/com/plotsquared/general/commands/CommandManager.java @@ -3,6 +3,7 @@ package com.plotsquared.general.commands; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; +import java.util.HashSet; import java.util.List; import java.util.concurrent.ConcurrentHashMap; @@ -51,7 +52,8 @@ public class CommandManager { } final public ArrayList> getCommands() { - ArrayList> result = new ArrayList<>(this.commands.values()); + HashSet> set = new HashSet<>(this.commands.values()); + ArrayList> result = new ArrayList<>(set); Collections.sort(result, new Comparator>() { @Override public int compare(Command a, Command b) { diff --git a/src/main/java/com/plotsquared/sponge/util/SpongeCommand.java b/src/main/java/com/plotsquared/sponge/util/SpongeCommand.java index 2a4bb47a9..81f67345e 100644 --- a/src/main/java/com/plotsquared/sponge/util/SpongeCommand.java +++ b/src/main/java/com/plotsquared/sponge/util/SpongeCommand.java @@ -33,7 +33,7 @@ public class SpongeCommand implements CommandCallable { catch (Exception e) { pp = ConsolePlayer.getConsole(); } - if (MainCommand.onCommand(pp, cmd.getName(), string.split(" "))) { + if (MainCommand.onCommand(pp, cmd.getName(), string.length() == 0 ? new String[] {} : string.split(" "))) { return CommandResult.success(); } else {