From 5bcac17f1cd29b8ebfb013a927cb645bfa85543b Mon Sep 17 00:00:00 2001 From: TomyLobo Date: Thu, 8 Dec 2011 02:31:06 +0100 Subject: [PATCH] Fixed compilation with Bukkit >= CB1564. Sorry, this breaks compatibility with builds < CB1193. --- .../bukkit/LegacyConsoleSender.java | 88 ------------------- .../worldguard/bukkit/WorldGuardPlugin.java | 7 +- 2 files changed, 1 insertion(+), 94 deletions(-) delete mode 100644 src/main/java/com/sk89q/worldguard/bukkit/LegacyConsoleSender.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/LegacyConsoleSender.java b/src/main/java/com/sk89q/worldguard/bukkit/LegacyConsoleSender.java deleted file mode 100644 index 8b37c647..00000000 --- a/src/main/java/com/sk89q/worldguard/bukkit/LegacyConsoleSender.java +++ /dev/null @@ -1,88 +0,0 @@ -package com.sk89q.worldguard.bukkit; - -import java.util.Set; - -import org.bukkit.Server; -import org.bukkit.command.ConsoleCommandSender; -import org.bukkit.permissions.Permission; -import org.bukkit.permissions.PermissionAttachment; -import org.bukkit.permissions.PermissionAttachmentInfo; -import org.bukkit.plugin.Plugin; - -/** -* Console sender. -* -* @author sk89q -*/ -class LegacyConsoleSender extends ConsoleCommandSender { - private Server server; - - public LegacyConsoleSender(Server server) { - super(server); - this.server = server; - } - - public void sendMessage(String message) { - WorldGuardPlugin.logger.info(message); - } - - public Server getServer() { - return server; - } - - public String getName() { - return "CONSOLE"; - } - - public boolean isPermissionSet(String name) { - return true; - } - - public boolean isPermissionSet(Permission perm) { - return true; - } - - public boolean hasPermission(String name) { - return true; - } - - public boolean hasPermission(Permission perm) { - return true; - } - - public PermissionAttachment addAttachment(Plugin plugin, String name, - boolean value) { - throw new UnsupportedOperationException("Fake legacy console command sender does not support this"); - } - - public PermissionAttachment addAttachment(Plugin plugin) { - throw new UnsupportedOperationException("Fake legacy console command sender does not support this"); - } - - public PermissionAttachment addAttachment(Plugin plugin, String name, - boolean value, int ticks) { - throw new UnsupportedOperationException("Fake legacy console command sender does not support this"); - } - - public PermissionAttachment addAttachment(Plugin plugin, int ticks) { - throw new UnsupportedOperationException("Fake legacy console command sender does not support this"); - } - - public void removeAttachment(PermissionAttachment attachment) { - throw new UnsupportedOperationException("Fake legacy console command sender does not support this"); - } - - public void recalculatePermissions() { - } - - public Set getEffectivePermissions() { - throw new UnsupportedOperationException("Fake legacy console command sender does not support this"); - } - - public boolean isOp() { - return true; - } - - public void setOp(boolean value) { - } -} \ No newline at end of file diff --git a/src/main/java/com/sk89q/worldguard/bukkit/WorldGuardPlugin.java b/src/main/java/com/sk89q/worldguard/bukkit/WorldGuardPlugin.java index cecdbf81..32f8d05f 100644 --- a/src/main/java/com/sk89q/worldguard/bukkit/WorldGuardPlugin.java +++ b/src/main/java/com/sk89q/worldguard/bukkit/WorldGuardPlugin.java @@ -569,12 +569,7 @@ public CommandSender matchPlayerOrConsole(CommandSender sender, String filter) if (filter.equalsIgnoreCase("#console") || filter.equalsIgnoreCase("*console*") || filter.equalsIgnoreCase("!")) { - try { - return getServer().getConsoleSender(); - } catch (Throwable t) { - // Legacy support - return new LegacyConsoleSender(getServer()); - } + return getServer().getConsoleSender(); } return matchSinglePlayer(sender, filter);