Add isPermissionsSystem method to PermissionsSystemType enum - fixes #612

This commit is contained in:
EbonJaguar 2016-05-29 18:29:19 -04:00
parent a854d4e0e0
commit 428b27943b
2 changed files with 22 additions and 10 deletions

View File

@ -224,11 +224,12 @@ public class PermissionsManager implements PermissionsService {
String pluginName = plugin.getName();
// Check if any known permissions system is enabling
if (pluginName.equals("PermissionsEx") || pluginName.equals("PermissionsBukkit") ||
pluginName.equals("bPermissions") || pluginName.equals("GroupManager") ||
pluginName.equals("zPermissions") || pluginName.equals("Vault")) {
ConsoleLogger.info(pluginName + " plugin enabled, dynamically updating permissions hooks!");
setup();
for (PermissionsSystemType permissionsSystemType : PermissionsSystemType.values()) {
if (permissionsSystemType.isPermissionSystem(pluginName)) {
ConsoleLogger.info(pluginName + " plugin enabled, dynamically updating permissions hooks!");
setup();
break;
}
}
}
@ -243,11 +244,12 @@ public class PermissionsManager implements PermissionsService {
String pluginName = plugin.getName();
// Is the WorldGuard plugin disabled
if (pluginName.equals("PermissionsEx") || pluginName.equals("PermissionsBukkit") ||
pluginName.equals("bPermissions") || pluginName.equals("GroupManager") ||
pluginName.equals("zPermissions") || pluginName.equals("Vault")) {
ConsoleLogger.info(pluginName + " plugin disabled, updating hooks!");
setup();
for (PermissionsSystemType permissionsSystemType : PermissionsSystemType.values()) {
if (permissionsSystemType.isPermissionSystem(pluginName)) {
ConsoleLogger.info(pluginName + " plugin disabled, updating hooks!");
setup();
break;
}
}
}

View File

@ -83,4 +83,14 @@ public enum PermissionsSystemType {
public String toString() {
return getName();
}
/**
* Check if a given plugin is a permissions system.
*
* @param name The name of the plugin to check.
* @return If the plugin is a valid permissions system.
*/
public boolean isPermissionSystem(String name) {
return name.equals(pluginName);
}
}