From 8b904874e44f11b0032fcf8ab5d1a22ee7cf3a9b Mon Sep 17 00:00:00 2001 From: sleak Date: Sun, 11 Dec 2011 23:56:08 -0800 Subject: [PATCH] hopefully fix bPerms chat API implementation --- .../vault/chat/plugins/Chat_bPermissions.java | 33 ++----------------- 1 file changed, 2 insertions(+), 31 deletions(-) diff --git a/src/net/milkbowl/vault/chat/plugins/Chat_bPermissions.java b/src/net/milkbowl/vault/chat/plugins/Chat_bPermissions.java index b1fb2f6..fadf6c5 100644 --- a/src/net/milkbowl/vault/chat/plugins/Chat_bPermissions.java +++ b/src/net/milkbowl/vault/chat/plugins/Chat_bPermissions.java @@ -1,6 +1,5 @@ package net.milkbowl.vault.chat.plugins; -import java.lang.reflect.Field; import java.util.logging.Logger; import org.bukkit.event.Event.Priority; @@ -37,21 +36,7 @@ public class Chat_bPermissions extends Chat { if (chat == null) { Plugin p = plugin.getServer().getPluginManager().getPlugin("bPermissions"); if (p != null) { - Permissions permissions = (Permissions) p; - Field f; - try { - f = permissions.getClass().getField(name); - f.setAccessible(true); - chat = (InfoReader) f.get(permissions); - } catch (SecurityException e) { - return; - } catch (NoSuchFieldException e) { - return; - } catch (IllegalArgumentException e) { - e.printStackTrace(); - } catch (IllegalAccessException e) { - e.printStackTrace(); - } + chat = Permissions.getInfoReader(); log.info(String.format("[%s][Chat] %s hooked.", plugin.getDescription().getName(), "bPermissions")); } } @@ -68,21 +53,7 @@ public class Chat_bPermissions extends Chat { if (this.chat.chat == null) { Plugin chat = plugin.getServer().getPluginManager().getPlugin("bPermissions"); if (chat != null) { - Permissions perms = (Permissions) chat; - Field f; - try { - f = perms.getClass().getField(name); - f.setAccessible(true); - this.chat.chat = (InfoReader) f.get(perms); - } catch (SecurityException e) { - return; - } catch (NoSuchFieldException e) { - return; - } catch (IllegalArgumentException e) { - e.printStackTrace(); - } catch (IllegalAccessException e) { - e.printStackTrace(); - } + this.chat.chat = Permissions.getInfoReader(); log.info(String.format("[%s][Chat] %s hooked.", plugin.getDescription().getName(), "bPermissions")); } }