From 247e8b163de6645b92935e2b673eefe32ff044b7 Mon Sep 17 00:00:00 2001 From: TomyLobo Date: Mon, 20 Feb 2012 14:21:22 +0100 Subject: [PATCH] Removed the com.sk89q.bukkit.migration package and LegacyPermissionsProviderWrapper. This restores compatibility with the latest Bukkit builds. --- .../bukkit/migration/PermissionsProvider.java | 32 ------- .../bukkit/migration/PermissionsResolver.java | 25 ------ .../migration/PermissionsResolverManager.java | 86 ------------------- .../PermissionsResolverServerListener.java | 45 ---------- .../LegacyPermissionsProviderWrapper.java | 81 ----------------- .../wepif/PluginPermissionsResolver.java | 5 -- 6 files changed, 274 deletions(-) delete mode 100644 src/main/java/com/sk89q/bukkit/migration/PermissionsProvider.java delete mode 100644 src/main/java/com/sk89q/bukkit/migration/PermissionsResolver.java delete mode 100644 src/main/java/com/sk89q/bukkit/migration/PermissionsResolverManager.java delete mode 100644 src/main/java/com/sk89q/bukkit/migration/PermissionsResolverServerListener.java delete mode 100644 src/main/java/com/sk89q/wepif/LegacyPermissionsProviderWrapper.java diff --git a/src/main/java/com/sk89q/bukkit/migration/PermissionsProvider.java b/src/main/java/com/sk89q/bukkit/migration/PermissionsProvider.java deleted file mode 100644 index 588d6f551..000000000 --- a/src/main/java/com/sk89q/bukkit/migration/PermissionsProvider.java +++ /dev/null @@ -1,32 +0,0 @@ -// $Id$ -/* - * WorldEdit - * Copyright (C) 2010, 2011 sk89q and contributors - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.sk89q.bukkit.migration; - -@Deprecated -public interface PermissionsProvider { - public boolean hasPermission(String name, String permission); - - public boolean hasPermission(String worldName, String name, String permission); - - public boolean inGroup(String player, String group); - - public String[] getGroups(String player); - -} diff --git a/src/main/java/com/sk89q/bukkit/migration/PermissionsResolver.java b/src/main/java/com/sk89q/bukkit/migration/PermissionsResolver.java deleted file mode 100644 index bacdbb3da..000000000 --- a/src/main/java/com/sk89q/bukkit/migration/PermissionsResolver.java +++ /dev/null @@ -1,25 +0,0 @@ -// $Id$ -/* - * WorldEdit - * Copyright (C) 2010 sk89q and contributors - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.sk89q.bukkit.migration; - - -@Deprecated -public interface PermissionsResolver extends com.sk89q.wepif.PermissionsResolver { -} diff --git a/src/main/java/com/sk89q/bukkit/migration/PermissionsResolverManager.java b/src/main/java/com/sk89q/bukkit/migration/PermissionsResolverManager.java deleted file mode 100644 index fe58286fe..000000000 --- a/src/main/java/com/sk89q/bukkit/migration/PermissionsResolverManager.java +++ /dev/null @@ -1,86 +0,0 @@ -// $Id$ -/* - * WorldEdit - * Copyright (C) 2010 sk89q and contributors - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.sk89q.bukkit.migration; - -import java.util.logging.Logger; - -import com.sk89q.wepif.WEPIFRuntimeException; -import org.bukkit.Server; -import org.bukkit.plugin.Plugin; - -@Deprecated -public class PermissionsResolverManager implements PermissionsProvider { - - @Deprecated - public PermissionsResolverManager(org.bukkit.util.config.Configuration config, Server server, String name, Logger logger) {} - - @Deprecated - public PermissionsResolverManager(Plugin plugin, String name, Logger logger) { - setUp(plugin); - } - - @Deprecated - public void findResolver() { - getRealResolver().findResolver(); - } - - @Deprecated - public void setPluginPermissionsResolver(Plugin plugin) { - getRealResolver().setPluginPermissionsResolver(plugin); - } - - @Deprecated - public void load() { - try { - getRealResolver().load(); - } catch (WEPIFRuntimeException ignore) { - // Some plugins do this very early in the initialization process - } - } - - public boolean hasPermission(String name, String permission) { - return getRealResolver().hasPermission(name, permission); - } - - public boolean hasPermission(String worldName, String name, String permission) { - return getRealResolver().hasPermission(worldName, name, permission); - } - - public boolean inGroup(String player, String group) { - return getRealResolver().inGroup(player, group); - } - - public String[] getGroups(String player) { - return getRealResolver().getGroups(player); - } - - public String getDetectionMessage() { - return getRealResolver().getDetectionMessage(); - } - - void setUp(Plugin plugin) { - com.sk89q.wepif.PermissionsResolverManager.initialize(plugin); - } - - private com.sk89q.wepif.PermissionsResolverManager getRealResolver() { - return com.sk89q.wepif.PermissionsResolverManager.getInstance(); - } - -} diff --git a/src/main/java/com/sk89q/bukkit/migration/PermissionsResolverServerListener.java b/src/main/java/com/sk89q/bukkit/migration/PermissionsResolverServerListener.java deleted file mode 100644 index fcd78de88..000000000 --- a/src/main/java/com/sk89q/bukkit/migration/PermissionsResolverServerListener.java +++ /dev/null @@ -1,45 +0,0 @@ -// $Id$ -/* - * WorldEdit - * Copyright (C) 2010 sk89q and contributors - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.sk89q.bukkit.migration; - -import org.bukkit.event.server.ServerListener; -import org.bukkit.plugin.Plugin; - -@Deprecated -public class PermissionsResolverServerListener extends ServerListener { - private PermissionsResolverManager manager; - - @Deprecated - public PermissionsResolverServerListener(PermissionsResolverManager manager) { - this.manager = manager; - } - - @Deprecated - public PermissionsResolverServerListener(PermissionsResolverManager manager, Plugin plugin) { - this.manager = manager; - register(plugin); - } - - @Deprecated - public void register(Plugin plugin) { - manager.setUp(plugin); - } - -} diff --git a/src/main/java/com/sk89q/wepif/LegacyPermissionsProviderWrapper.java b/src/main/java/com/sk89q/wepif/LegacyPermissionsProviderWrapper.java deleted file mode 100644 index 0dd5480ad..000000000 --- a/src/main/java/com/sk89q/wepif/LegacyPermissionsProviderWrapper.java +++ /dev/null @@ -1,81 +0,0 @@ -// $Id$ -/* - * WorldEdit - * Copyright (C) 2010 sk89q and contributors - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.sk89q.wepif; - -import org.bukkit.OfflinePlayer; -import org.bukkit.plugin.Plugin; - -@SuppressWarnings("deprecation") -public class LegacyPermissionsProviderWrapper implements PermissionsProvider { - private final com.sk89q.bukkit.migration.PermissionsProvider legacyPermissionsProvider; - - static PermissionsProvider wrap(Plugin plugin) { - if (!(plugin instanceof com.sk89q.bukkit.migration.PermissionsProvider)) { - return null; - } - - final com.sk89q.bukkit.migration.PermissionsProvider legacyPermissionsProvider = (com.sk89q.bukkit.migration.PermissionsProvider) plugin; - return new LegacyPermissionsProviderWrapper(legacyPermissionsProvider); - } - - private LegacyPermissionsProviderWrapper(com.sk89q.bukkit.migration.PermissionsProvider legacyPermissionsProvider) { - this.legacyPermissionsProvider = legacyPermissionsProvider; - } - - @Override - public boolean hasPermission(String name, String permission) { - return legacyPermissionsProvider.hasPermission(name, permission); - } - - @Override - public boolean hasPermission(String worldName, String name, String permission) { - return legacyPermissionsProvider.hasPermission(worldName, name, permission); - } - - @Override - public boolean inGroup(String player, String group) { - return legacyPermissionsProvider.inGroup(player, group); - } - - @Override - public String[] getGroups(String player) { - return legacyPermissionsProvider.getGroups(player); - } - - @Override - public boolean hasPermission(OfflinePlayer player, String permission) { - return legacyPermissionsProvider.hasPermission(player.getName(), permission); - } - - @Override - public boolean hasPermission(String worldName, OfflinePlayer player, String permission) { - return legacyPermissionsProvider.hasPermission(worldName, player.getName(), permission); - } - - @Override - public boolean inGroup(OfflinePlayer player, String group) { - return legacyPermissionsProvider.inGroup(player.getName(), group); - } - - @Override - public String[] getGroups(OfflinePlayer player) { - return legacyPermissionsProvider.getGroups(player.getName()); - } -} diff --git a/src/main/java/com/sk89q/wepif/PluginPermissionsResolver.java b/src/main/java/com/sk89q/wepif/PluginPermissionsResolver.java index 912cbd7a3..18e790b7b 100644 --- a/src/main/java/com/sk89q/wepif/PluginPermissionsResolver.java +++ b/src/main/java/com/sk89q/wepif/PluginPermissionsResolver.java @@ -43,11 +43,6 @@ public class PluginPermissionsResolver implements PermissionsResolver { if (plugin instanceof PermissionsProvider) { return new PluginPermissionsResolver((PermissionsProvider) plugin, plugin); } - - final PermissionsProvider legacyPermissionsProvider = LegacyPermissionsProviderWrapper.wrap(plugin); - if (legacyPermissionsProvider != null) { - return new PluginPermissionsResolver(legacyPermissionsProvider, plugin); - } } return null;