mirror of
https://github.com/MilkBowl/Vault.git
synced 2025-02-17 04:41:41 +01:00
hopefully fix bPerms chat API implementation
This commit is contained in:
parent
29681e53d9
commit
8b904874e4
@ -1,6 +1,5 @@
|
|||||||
package net.milkbowl.vault.chat.plugins;
|
package net.milkbowl.vault.chat.plugins;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.bukkit.event.Event.Priority;
|
import org.bukkit.event.Event.Priority;
|
||||||
@ -37,21 +36,7 @@ public class Chat_bPermissions extends Chat {
|
|||||||
if (chat == null) {
|
if (chat == null) {
|
||||||
Plugin p = plugin.getServer().getPluginManager().getPlugin("bPermissions");
|
Plugin p = plugin.getServer().getPluginManager().getPlugin("bPermissions");
|
||||||
if (p != null) {
|
if (p != null) {
|
||||||
Permissions permissions = (Permissions) p;
|
chat = Permissions.getInfoReader();
|
||||||
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();
|
|
||||||
}
|
|
||||||
log.info(String.format("[%s][Chat] %s hooked.", plugin.getDescription().getName(), "bPermissions"));
|
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) {
|
if (this.chat.chat == null) {
|
||||||
Plugin chat = plugin.getServer().getPluginManager().getPlugin("bPermissions");
|
Plugin chat = plugin.getServer().getPluginManager().getPlugin("bPermissions");
|
||||||
if (chat != null) {
|
if (chat != null) {
|
||||||
Permissions perms = (Permissions) chat;
|
this.chat.chat = Permissions.getInfoReader();
|
||||||
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();
|
|
||||||
}
|
|
||||||
log.info(String.format("[%s][Chat] %s hooked.", plugin.getDescription().getName(), "bPermissions"));
|
log.info(String.format("[%s][Chat] %s hooked.", plugin.getDescription().getName(), "bPermissions"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user