From 12ba1a9fc47c6c63600437f8c0055c284b3a77b2 Mon Sep 17 00:00:00 2001 From: sk89q Date: Sun, 13 Mar 2011 20:28:15 -0700 Subject: [PATCH] Removed GroupUsers support. --- build.xml | 1 - .../GroupUsersPemissionsResolver.java | 102 ------------------ .../migration/PermissionsResolverManager.java | 11 -- 3 files changed, 114 deletions(-) delete mode 100644 src/com/sk89q/bukkit/migration/GroupUsersPemissionsResolver.java diff --git a/build.xml b/build.xml index afc9ca6d5..38f455c53 100644 --- a/build.xml +++ b/build.xml @@ -13,7 +13,6 @@ - diff --git a/src/com/sk89q/bukkit/migration/GroupUsersPemissionsResolver.java b/src/com/sk89q/bukkit/migration/GroupUsersPemissionsResolver.java deleted file mode 100644 index b12e0546c..000000000 --- a/src/com/sk89q/bukkit/migration/GroupUsersPemissionsResolver.java +++ /dev/null @@ -1,102 +0,0 @@ -// $Id$ -/* - * WorldEdit - * Copyright (C) 2010 sk89q - * - * 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.List; -import org.bukkit.Server; -import org.bukkit.entity.Player; -import org.bukkit.plugin.Plugin; -import org.bukkit.plugin.PluginManager; -import com.bukkit.authorblues.GroupUsers.GroupUsers; - -public class GroupUsersPemissionsResolver implements PermissionsResolver { - private Server server; - private GroupUsers groupUsers; - - public void load() { - - } - - public GroupUsersPemissionsResolver(Server server) - throws PluginAccessException, MissingPluginException { - this.server = server; - PluginManager manager = server.getPluginManager(); - - Plugin plugin = manager.getPlugin("GroupUsers"); - if (plugin == null) { - throw new MissingPluginException(); - } - - try { - groupUsers = (GroupUsers)plugin; - } catch (ClassCastException e) { - throw new PluginAccessException(); - } - } - - public boolean hasPermission(String name, String permission) { - try { - Player player = server.getPlayer(name); - if (player == null) return false; - int dotPos = permission.lastIndexOf("."); - if (dotPos > -1) { - if (hasPermission(name, permission.substring(0, dotPos))) { - return true; - } - } - return groupUsers.playerCanUseCommand(player, permission); - } catch (Throwable t) { - t.printStackTrace(); - return false; - } - } - - public boolean inGroup(String name, String group) { - try { - Player player = server.getPlayer(name); - if (player == null) return false; - return groupUsers.isInGroup(player, group); - } catch (Throwable t) { - t.printStackTrace(); - return false; - } - } - - public String[] getGroups(String name) { - try { - Player player = server.getPlayer(name); - if (player == null) return new String[0]; - List groups = groupUsers.getGroups(); - if (groups == null) return new String[0]; - return groups.toArray(new String[groups.size()]); - } catch (Throwable t) { - t.printStackTrace(); - return new String[0]; - } - } - - public static class PluginAccessException extends Exception { - private static final long serialVersionUID = 7044832912491608706L; - } - - public static class MissingPluginException extends Exception { - private static final long serialVersionUID = 7044832912491608706L; - } -} diff --git a/src/com/sk89q/bukkit/migration/PermissionsResolverManager.java b/src/com/sk89q/bukkit/migration/PermissionsResolverManager.java index bed82f7cb..2336134ab 100644 --- a/src/com/sk89q/bukkit/migration/PermissionsResolverManager.java +++ b/src/com/sk89q/bukkit/migration/PermissionsResolverManager.java @@ -42,7 +42,6 @@ public class PermissionsResolverManager implements PermissionsResolver { public void findResolver() { if (tryPluginPermissionsResolver()) return; - if (tryGroupsUsers()) return; if (tryNijiPermissions()) return; if (tryFlatFilePermissions()) return; @@ -50,16 +49,6 @@ public class PermissionsResolverManager implements PermissionsResolver { logger.info(name + ": No known permissions plugin detected. Using configuration file for permissions."); } - private boolean tryGroupsUsers() { - try { - perms = new GroupUsersPemissionsResolver(server); - logger.info(name + ": GroupUsers detected! Using GroupUsers for permissions."); - return true; - } catch (Throwable e) { - return false; - } - } - private boolean tryNijiPermissions() { try { perms = new NijiPermissionsResolver(server);