This commit is contained in:
Telesphoreo 2022-03-25 16:26:29 -05:00
parent 4b6fb1ead4
commit 8b10afa8aa

View file

@ -41,11 +41,11 @@ public class TFMBridge
Bukkit.getLogger().warning("TotalFreedomMod not detected, checking operator status instead."); Bukkit.getLogger().warning("TotalFreedomMod not detected, checking operator status instead.");
return player.isOp(); return player.isOp();
} }
Object adminList = ReflectionsHelper.getField(getTfm(), "adminList"); Object al = ReflectionsHelper.getField(getTfm(), "al");
Method isAdmin = ReflectionsHelper.getMethod(adminList, "isAdmin", Player.class); Method isAdmin = ReflectionsHelper.getMethod(al, "isAdmin", Player.class);
try try
{ {
return (boolean)isAdmin.invoke(adminList, player) /*getTfm().adminList.isAdmin(player)*/; return (boolean)isAdmin.invoke(al, player) /*getTfm().adminList.isAdmin(player)*/;
} }
catch (IllegalAccessException | InvocationTargetException e) catch (IllegalAccessException | InvocationTargetException e)
{ {
@ -61,11 +61,11 @@ public class TFMBridge
Bukkit.getLogger().warning("TotalFreedomMod not detected, checking operator status instead."); Bukkit.getLogger().warning("TotalFreedomMod not detected, checking operator status instead.");
return sender.isOp(); return sender.isOp();
} }
Object adminList = ReflectionsHelper.getField(getTfm(), "adminList"); Object al = ReflectionsHelper.getField(getTfm(), "al");
Method isAdmin = ReflectionsHelper.getMethod(adminList, "isAdmin", CommandSender.class); Method isAdmin = ReflectionsHelper.getMethod(al, "isAdmin", CommandSender.class);
try try
{ {
return (boolean)isAdmin.invoke(adminList, sender) /*getTfm().adminList.isAdmin(player)*/; return (boolean)isAdmin.invoke(al, sender) /*getTfm().adminList.isAdmin(player)*/;
} }
catch (IllegalAccessException | InvocationTargetException e) catch (IllegalAccessException | InvocationTargetException e)
{ {
@ -81,11 +81,11 @@ public class TFMBridge
Bukkit.getLogger().warning("TotalFreedomMod not detected, vanish will return false."); Bukkit.getLogger().warning("TotalFreedomMod not detected, vanish will return false.");
return false; return false;
} }
Object adminList = ReflectionsHelper.getField(getTfm(), "adminList"); Object al = ReflectionsHelper.getField(getTfm(), "al");
Method isVanished = ReflectionsHelper.getMethod(adminList, "isVanished", String.class); Method isVanished = ReflectionsHelper.getMethod(al, "isVanished", String.class);
try try
{ {
return (boolean)isVanished.invoke(adminList, player.getName()) /*getTfm().adminList.isVanished(player.getName)*/; return (boolean)isVanished.invoke(al, player.getName()) /*getTfm().adminList.isVanished(player.getName)*/;
} }
catch (IllegalAccessException | InvocationTargetException e) catch (IllegalAccessException | InvocationTargetException e)
{ {
@ -101,11 +101,11 @@ public class TFMBridge
return null; return null;
} }
Object playerList = ReflectionsHelper.getField(getTfm(), "playerList"); Object pl = ReflectionsHelper.getField(getTfm(), "pl");
Method getPlayer = ReflectionsHelper.getMethod(playerList, "getPlayer", Player.class); Method getPlayer = ReflectionsHelper.getMethod(pl, "getPlayer", Player.class);
try try
{ {
Object fPlayer = getPlayer.invoke(playerList, player); Object fPlayer = getPlayer.invoke(pl, player);
Method getTag = ReflectionsHelper.getMethod(fPlayer, "getTag"); Method getTag = ReflectionsHelper.getMethod(fPlayer, "getTag");
return (String)getTag.invoke(fPlayer); return (String)getTag.invoke(fPlayer);
@ -125,11 +125,11 @@ public class TFMBridge
return; return;
} }
// getTfm().playerList.getPlayer(player).setTag(null); // getTfm().playerList.getPlayer(player).setTag(null);
Object playerList = ReflectionsHelper.getField(getTfm(), "playerList"); Object pl = ReflectionsHelper.getField(getTfm(), "pl");
Method getPlayer = ReflectionsHelper.getMethod(playerList, "getPlayer", Player.class); Method getPlayer = ReflectionsHelper.getMethod(pl, "getPlayer", Player.class);
try try
{ {
Object fPlayer = getPlayer.invoke(playerList, player); Object fPlayer = getPlayer.invoke(pl, player);
Method setTag = ReflectionsHelper.getMethod(fPlayer, "setTag", String.class); Method setTag = ReflectionsHelper.getMethod(fPlayer, "setTag", String.class);
setTag.invoke(fPlayer, (Object)null); setTag.invoke(fPlayer, (Object)null);