Merge pull request #133 from Gnat008/612-add-PermissionsSystemType-method

Add isPermissionsSystem method to PermissionsSystemType enum - fixes …
This commit is contained in:
ljacqu 2016-05-30 07:51:14 +02:00
commit 9349993faf
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);
}
}