Use PluginEnableEvent instead of searching for the Plugin during onPluginEnable in P3

This commit is contained in:
Morgan 2011-08-31 12:26:21 -04:00
parent 7c2e3a0c55
commit 88b2bfa048

View File

@ -90,10 +90,9 @@ public class Permission_Permissions3 extends Permission {
public void onPluginEnable(PluginEnableEvent event) { public void onPluginEnable(PluginEnableEvent event) {
if (permission.permission == null) { if (permission.permission == null) {
Plugin perms = plugin.getServer().getPluginManager().getPlugin("Permissions"); Plugin perms = event.getPlugin();
if(perms.getDescription().getName().equals("Permissions") && perms.getDescription().getVersion().startsWith("3")) {
if (perms != null) { if (perms.isEnabled()) {
if (perms.isEnabled() && perms.getDescription().getVersion().startsWith("3")) {
permission.permission = (Permissions) perms; permission.permission = (Permissions) perms;
log.info(String.format("[%s][Permission] %s hooked.", plugin.getDescription().getName(), permission.name)); log.info(String.format("[%s][Permission] %s hooked.", plugin.getDescription().getName(), permission.name));
} }