diff --git a/src/main/java/com/sk89q/bukkit/migration/DinnerPermsResolver.java b/src/main/java/com/sk89q/bukkit/migration/DinnerPermsResolver.java index e07f08191..cdbc7045b 100644 --- a/src/main/java/com/sk89q/bukkit/migration/DinnerPermsResolver.java +++ b/src/main/java/com/sk89q/bukkit/migration/DinnerPermsResolver.java @@ -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()]); } diff --git a/src/main/java/com/sk89q/bukkit/migration/NijiPermissionsResolver.java b/src/main/java/com/sk89q/bukkit/migration/NijiPermissionsResolver.java index dd53a35f0..086862ccf 100644 --- a/src/main/java/com/sk89q/bukkit/migration/NijiPermissionsResolver.java +++ b/src/main/java/com/sk89q/bukkit/migration/NijiPermissionsResolver.java @@ -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"); } } diff --git a/src/main/java/com/sk89q/bukkit/migration/PermissionsResolverServerListener.java b/src/main/java/com/sk89q/bukkit/migration/PermissionsResolverServerListener.java index fdaf4dfd0..f64e8c486 100644 --- a/src/main/java/com/sk89q/bukkit/migration/PermissionsResolverServerListener.java +++ b/src/main/java/com/sk89q/bukkit/migration/PermissionsResolverServerListener.java @@ -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(); }