fixup permission plugin listeners.

This commit is contained in:
Nick Minkler 2013-09-03 15:19:25 -07:00
parent 04b24a00c0
commit db5249ba18
10 changed files with 21 additions and 28 deletions

View File

@ -67,11 +67,10 @@ public class Permission_GroupManager extends Permission {
@EventHandler(priority = EventPriority.MONITOR)
public void onPluginEnable(PluginEnableEvent event) {
if (permission.groupManager == null) {
Plugin perms = plugin.getServer().getPluginManager().getPlugin("GroupManager");
if (perms != null) {
permission.groupManager = (GroupManager) perms;
Plugin p = event.getPlugin();
if (p.getDescription().getName().equals("GroupManager")) {
permission.groupManager = (GroupManager) p;
log.info(String.format("[%s][Permission] %s hooked.", plugin.getDescription().getName(), permission.name));
}
}
}

View File

@ -61,13 +61,10 @@ public class Permission_PermissionsBukkit extends Permission {
@EventHandler(priority = EventPriority.MONITOR)
public void onPluginEnable(PluginEnableEvent event) {
if (permission.perms == null) {
Plugin perms = plugin.getServer().getPluginManager().getPlugin("PermissionsBukkit");
if (perms != null) {
if (perms.isEnabled()) {
permission.perms = (PermissionsPlugin) perms;
log.info(String.format("[%s][Permission] %s hooked.", plugin.getDescription().getName(), permission.name));
}
Plugin perms = event.getPlugin();
if (perms.getDescription().getName().equals("PermissionsBukkit")) {
permission.perms = (PermissionsPlugin) perms;
log.info(String.format("[%s][Permission] %s hooked.", plugin.getDescription().getName(), permission.name));
}
}
}

View File

@ -82,9 +82,8 @@ public class Permission_PermissionsEx extends Permission {
@EventHandler(priority = EventPriority.MONITOR)
public void onPluginEnable(PluginEnableEvent event) {
if (permission.permission == null) {
Plugin perms = plugin.getServer().getPluginManager().getPlugin("PermissionsEx");
if (perms != null) {
Plugin perms = event.getPlugin();
if (perms.getDescription().getName().equals("PermissionsEx")) {
try {
if (Double.valueOf(perms.getDescription().getVersion()) < 1.16) {
log.info(String.format("[%s][Permission] %s below 1.16 is not compatible with Vault! Falling back to SuperPerms only mode. PLEASE UPDATE!", plugin.getDescription().getName(), name));

View File

@ -44,9 +44,8 @@ public class Permission_Privileges extends Permission {
@EventHandler(priority = EventPriority.MONITOR)
public void onPluginEnable(PluginEnableEvent event) {
if (permission.privs == null) {
Plugin perms = plugin.getServer().getPluginManager().getPlugin("Privileges");
if (perms != null) {
Plugin perms = event.getPlugin();
if (perms.getDescription().getName().equals("Privileges")) {
permission.privs = (Privileges) perms;
log.info(String.format("[%s][Permission] %s hooked.", plugin.getDescription().getName(), permission.name));
}

View File

@ -60,9 +60,8 @@ public class Permission_SimplyPerms extends Permission{
@EventHandler(priority = EventPriority.MONITOR)
public void onPluginEnable(PluginEnableEvent event) {
if (permission.perms == null) {
Plugin perms = plugin.getServer().getPluginManager().getPlugin("SimplyPerms");
if (perms != null) {
Plugin perms = event.getPlugin();
if (perms.getDescription().getName().equals("SimplyPerms")) {
permission.perms = ((SimplyPlugin) perms).getAPI();
log.info(String.format("[%s][Permission] %s hooked.", plugin.getDescription().getName(), permission.name));
}

View File

@ -61,7 +61,7 @@ public class Permission_Starburst extends Permission {
public void onPluginEnable(PluginEnableEvent event) {
if (perms == null) {
Plugin p = event.getPlugin();
if (p.getDescription().getName().equals("Starburst") && p.isEnabled()) {
if (p.getDescription().getName().equals("Starburst")) {
perms = (StarburstPlugin) p;
log.info(String.format("[%s][Permission] %s hooked.", plugin.getDescription().getName(), name));
}

View File

@ -45,7 +45,7 @@ public class Permission_TotalPermissions extends Permission {
@EventHandler(priority = EventPriority.MONITOR)
public void onPluginEnable(PluginEnableEvent event) {
if (manager == null) {
if (manager == null || totalperms == null) {
Plugin permPlugin = event.getPlugin();
if (permPlugin.getDescription().getName().equals(name)) {
totalperms = (TotalPermissions) permPlugin;

View File

@ -63,10 +63,10 @@ public class Permission_Xperms extends Permission {
}
@EventHandler(priority = EventPriority.MONITOR)
public void onPluginEnable(PluginEnableEvent event) {
if(permission == null){
Plugin perms = plugin.getServer().getPluginManager().getPlugin("Xperms");
if(perms != null){
public void onPluginEnable(PluginEnableEvent event) {
if (permission.perms == null) {
Plugin perms = event.getPlugin();
if(perms.getDescription().getName().equals("Xperms")){
try{
if(Double.valueOf(perms.getDescription().getVersion()) < 1.1){
log.info(String.format("[%s] [Permission] %s Current version is not compatible with vault! Please Update!", plugin.getDescription().getName(), name));

View File

@ -62,7 +62,7 @@ public class Permission_bPermissions2 extends Permission {
public void onPluginEnable(PluginEnableEvent event) {
if (!hooked) {
Plugin p = event.getPlugin();
if(p.getDescription().getName().equals("bPermissions") && p.isEnabled()) {
if(p.getDescription().getName().equals("bPermissions")) {
hooked = true;
log.info(String.format("[%s][Permission] %s hooked.", plugin.getDescription().getName(), name));
}

View File

@ -59,7 +59,7 @@ public class Permission_zPermissions extends Permission {
@EventHandler(priority = EventPriority.MONITOR)
public void onPluginEnable(PluginEnableEvent event) {
if (service == null) {
if (service == null && event.getPlugin().getDescription().getName().equals("zPermissions")) {
service = plugin.getServer().getServicesManager().load(ZPermissionsService.class);
if (service != null) {
log.info(String.format("[%s][Permission] %s hooked.", plugin.getDescription().getName(), name));