diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java index 66ba7b39d..7bcb70867 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java @@ -542,7 +542,7 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen if (area == null || (!area.PLOT_CHAT && !plr.getAttribute("chat"))) { return; } - Plot plot = area.getPlotAbs(loc); + Plot plot = area.getPlot(loc); if (plot == null) { return; } @@ -559,8 +559,11 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen String spy = event.getFormat(); spy = String.format(spy, sender, message); pp.sendMessage(spy); - } else if (plot.equals(pp.getCurrentPlot())) { - recipients.add(((BukkitPlayer) pp).player); + } else { + Plot current = pp.getCurrentPlot(); + if (current != null && current.getBasePlot(false).equals(plot)) { + recipients.add(((BukkitPlayer) pp).player); + } } } String full = format.replaceAll("%plot_id%", id.x + ";" + id.y).replaceAll("%sender%", sender).replaceAll("%msg%", message); diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitCommand.java b/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitCommand.java index f5c8bea56..00eee940c 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitCommand.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitCommand.java @@ -71,6 +71,6 @@ public class BukkitCommand implements CommandExecutor, TabCompleter { for (Object o : objects) { result.add(o.toString()); } - return result; + return result.size() == 0 ? null : result; } } 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 899adca9e..37253c085 100644 --- a/Core/src/main/java/com/plotsquared/general/commands/Command.java +++ b/Core/src/main/java/com/plotsquared/general/commands/Command.java @@ -394,6 +394,28 @@ public abstract class Command { return cmd; } + public Command getCommand(Class clazz) { + for (Command cmd : allCommands) { + if (cmd.getClass() == clazz) { + return cmd; + } + } + return null; + } + + public Command getCommandById(String id) { + Command exact = staticCommands.get(id); + if (exact != null) { + return exact; + } + for (Command cmd : allCommands) { + if (cmd.getId().equals(id)) { + return cmd; + } + } + return null; + } + public boolean canExecute(PlotPlayer player, boolean message) { if (!required.allows(player)) { if (message) { diff --git a/Sponge/src/main/java/com/plotsquared/sponge/util/SpongeCommand.java b/Sponge/src/main/java/com/plotsquared/sponge/util/SpongeCommand.java index fe4a9111a..73c88cf6f 100644 --- a/Sponge/src/main/java/com/plotsquared/sponge/util/SpongeCommand.java +++ b/Sponge/src/main/java/com/plotsquared/sponge/util/SpongeCommand.java @@ -55,7 +55,7 @@ public class SpongeCommand implements CommandCallable { for (Object o : objects) { result.add(o.toString()); } - return result; + return result.size() == 0 ? null : result; } @Override