Fixed dinerperms groups and bridge detection.

This commit is contained in:
zml2008 2011-08-16 14:05:33 -07:00
parent 151b4c0fa1
commit 3f0da63b01
3 changed files with 8 additions and 7 deletions

View File

@ -60,7 +60,7 @@ public class DinnerPermsResolver implements PermissionsResolver {
String perm = permAttach.getPermission();
if (!perm.startsWith(GROUP_PREFIX))
continue;
groupNames.add(perm.substring(perm.indexOf(GROUP_PREFIX), perm.length()));
groupNames.add(perm.substring(GROUP_PREFIX.length(), perm.length()));
}
return groupNames.toArray(new String[groupNames.size()]);
}

View File

@ -19,6 +19,7 @@
package com.sk89q.bukkit.migration;
import org.bukkit.Bukkit;
import org.bukkit.Server;
import org.bukkit.command.PluginCommand;
import org.bukkit.entity.Player;
@ -43,7 +44,7 @@ public class NijiPermissionsResolver implements PermissionsResolver {
if (plugin == null) {
throw new MissingPluginException();
}
if (!checkRealNijiPerms(plugin, ignoreBridges))
if (!checkRealNijiPerms(ignoreBridges))
throw new MissingPluginException();
try {
@ -130,12 +131,12 @@ public class NijiPermissionsResolver implements PermissionsResolver {
private static final long serialVersionUID = 7044832912491608706L;
}
public static boolean checkRealNijiPerms(Plugin plugin, boolean ignoreBridges) {
public static boolean checkRealNijiPerms(boolean ignoreBridges) {
if (!ignoreBridges)
return true;
PluginCommand permsCommand = plugin.getServer().getPluginCommand("permissions");
PluginCommand permsCommand = Bukkit.getServer().getPluginCommand("permissions");
if (permsCommand == null)
return false;
return !permsCommand.getPlugin().getDescription().getName().equals("Permissions");
return permsCommand.getPlugin().getDescription().getName().equals("Permissions");
}
}

View File

@ -45,7 +45,7 @@ public class PermissionsResolverServerListener extends ServerListener {
if (plugin instanceof PermissionsProvider) {
manager.setPluginPermissionsResolver(plugin);
} else if (name.equalsIgnoreCase("Permissions") &&
NijiPermissionsResolver.checkRealNijiPerms(plugin, manager.ignoreNijiPermsBridges)) {
NijiPermissionsResolver.checkRealNijiPerms(manager.ignoreNijiPermsBridges)) {
manager.findResolver();
manager.load();
}
@ -63,7 +63,7 @@ public class PermissionsResolverServerListener extends ServerListener {
if (plugin instanceof PermissionsProvider
|| (name.equalsIgnoreCase("Permissions") &&
NijiPermissionsResolver.checkRealNijiPerms(plugin, manager.ignoreNijiPermsBridges))) {
NijiPermissionsResolver.checkRealNijiPerms(manager.ignoreNijiPermsBridges))) {
manager.findResolver();
manager.load();
}