mirror of
https://github.com/libraryaddict/LibsDisguises.git
synced 2024-09-12 01:48:07 +02:00
Only allow refreshing entity is the entity is valid
This commit is contained in:
parent
4e09a64abb
commit
c2e7aae201
@ -383,6 +383,7 @@ public class DisguiseUtilities {
|
||||
* the entity to all the watching players, which is where the magic begins
|
||||
*/
|
||||
public static void refreshTracker(TargetedDisguise disguise, String player) {
|
||||
if (disguise.getEntity() != null && disguise.getEntity().isValid()) {
|
||||
try {
|
||||
Object world = ReflectionManager.getWorld(disguise.getEntity().getWorld());
|
||||
Object tracker = world.getClass().getField("tracker").get(world);
|
||||
@ -392,7 +393,8 @@ public class DisguiseUtilities {
|
||||
if (entityTrackerEntry != null) {
|
||||
HashSet trackedPlayers = (HashSet) entityTrackerEntry.getClass().getField("trackedPlayers")
|
||||
.get(entityTrackerEntry);
|
||||
Method clear = entityTrackerEntry.getClass().getMethod("clear", ReflectionManager.getNmsClass("EntityPlayer"));
|
||||
Method clear = entityTrackerEntry.getClass()
|
||||
.getMethod("clear", ReflectionManager.getNmsClass("EntityPlayer"));
|
||||
Method updatePlayer = entityTrackerEntry.getClass().getMethod("updatePlayer",
|
||||
ReflectionManager.getNmsClass("EntityPlayer"));
|
||||
HashSet cloned = (HashSet) trackedPlayers.clone();
|
||||
@ -408,12 +410,14 @@ public class DisguiseUtilities {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param A
|
||||
* convidence method for me to refresh trackers in other plugins
|
||||
*/
|
||||
public static void refreshTrackers(Entity entity) {
|
||||
if (entity.isValid()) {
|
||||
try {
|
||||
Object world = ReflectionManager.getWorld(entity.getWorld());
|
||||
Object tracker = world.getClass().getField("tracker").get(world);
|
||||
@ -423,7 +427,8 @@ public class DisguiseUtilities {
|
||||
if (entityTrackerEntry != null) {
|
||||
HashSet trackedPlayers = (HashSet) entityTrackerEntry.getClass().getField("trackedPlayers")
|
||||
.get(entityTrackerEntry);
|
||||
Method clear = entityTrackerEntry.getClass().getMethod("clear", ReflectionManager.getNmsClass("EntityPlayer"));
|
||||
Method clear = entityTrackerEntry.getClass()
|
||||
.getMethod("clear", ReflectionManager.getNmsClass("EntityPlayer"));
|
||||
Method updatePlayer = entityTrackerEntry.getClass().getMethod("updatePlayer",
|
||||
ReflectionManager.getNmsClass("EntityPlayer"));
|
||||
HashSet cloned = (HashSet) trackedPlayers.clone();
|
||||
@ -442,6 +447,7 @@ public class DisguiseUtilities {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Resends
|
||||
|
Loading…
Reference in New Issue
Block a user