fix not setting p3 plugin properly for chat support when the plugin is

loaded later on.
This commit is contained in:
Sleaker 2012-02-05 19:26:22 -08:00
parent 4e93a060e6
commit 958a8c102f

View File

@ -48,10 +48,11 @@ public class Chat_Permissions3 extends Chat {
@EventHandler(priority = EventPriority.MONITOR) @EventHandler(priority = EventPriority.MONITOR)
public void onPluginEnable(PluginEnableEvent event) { public void onPluginEnable(PluginEnableEvent event) {
if (chat == null) { if (chat == null) {
Plugin perms = event.getPlugin(); Plugin permChat = event.getPlugin();
if(perms.getDescription().getName().equals("Permissions") && perms.getDescription().getVersion().startsWith("3")) { if(permChat.getDescription().getName().equals("Permissions") && permChat.getDescription().getVersion().startsWith("3")) {
if (perms.isEnabled()) { if (permChat.isEnabled()) {
chat = (Permissions) perms; chat = (Permissions) permChat;
perms = chat.getHandler();
log.info(String.format("[%s][Permission] %s hooked.", plugin.getDescription().getName(), name)); log.info(String.format("[%s][Permission] %s hooked.", plugin.getDescription().getName(), name));
} }
} }
@ -63,6 +64,7 @@ public class Chat_Permissions3 extends Chat {
if (chat != null) { if (chat != null) {
if (event.getPlugin().getDescription().getName().equals("Permissions")) { if (event.getPlugin().getDescription().getName().equals("Permissions")) {
chat = null; chat = null;
perms = null;
log.info(String.format("[%s][Permission] %s un-hooked.", plugin.getDescription().getName(), name)); log.info(String.format("[%s][Permission] %s un-hooked.", plugin.getDescription().getName(), name));
} }
} }