From 45f26c28e9570f009620d582b63c74641027d70a Mon Sep 17 00:00:00 2001 From: Esmorall Date: Thu, 2 Jul 2020 11:21:56 -0300 Subject: [PATCH] apply lastest changes to 1.14 and 1.15 --- EntityTrackerFixer/plugin.yml | 2 +- .../entitytrackerfixer/v1_14_R1/NMSEntityTracker.java | 3 --- .../entitytrackerfixer/v1_14_R1/tasks/CheckTask.java | 4 ++++ .../entitytrackerfixer/v1_15_R1/NMSEntityTracker.java | 3 --- .../entitytrackerfixer/v1_15_R1/tasks/CheckTask.java | 4 ++++ .../entitytrackerfixer/v1_16_R1/tasks/CheckTask.java | 5 +---- 6 files changed, 10 insertions(+), 11 deletions(-) diff --git a/EntityTrackerFixer/plugin.yml b/EntityTrackerFixer/plugin.yml index eeed42a..d51c540 100644 --- a/EntityTrackerFixer/plugin.yml +++ b/EntityTrackerFixer/plugin.yml @@ -1,6 +1,6 @@ name: EntityTrackerFixer main: net.minemora.entitytrackerfixer.EntityTrackerFixer -version: 1.2.6 +version: 1.2.7 api-version: 1.14 author: Esmorall description: Untrack entities that are not used at all by the server. diff --git a/EntityTrackerFixer/src/net/minemora/entitytrackerfixer/v1_14_R1/NMSEntityTracker.java b/EntityTrackerFixer/src/net/minemora/entitytrackerfixer/v1_14_R1/NMSEntityTracker.java index 85b34ef..451935f 100644 --- a/EntityTrackerFixer/src/net/minemora/entitytrackerfixer/v1_14_R1/NMSEntityTracker.java +++ b/EntityTrackerFixer/src/net/minemora/entitytrackerfixer/v1_14_R1/NMSEntityTracker.java @@ -29,9 +29,6 @@ public final class NMSEntityTracker { public static void trackEntities(ChunkProviderServer cps, Set trackList) { try { for(net.minecraft.server.v1_14_R1.Entity entity : trackList) { - if(cps.playerChunkMap.trackedEntities.containsKey(entity.getId())) { - continue; - } addEntityMethod.invoke(cps.playerChunkMap, entity); } } catch (SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { diff --git a/EntityTrackerFixer/src/net/minemora/entitytrackerfixer/v1_14_R1/tasks/CheckTask.java b/EntityTrackerFixer/src/net/minemora/entitytrackerfixer/v1_14_R1/tasks/CheckTask.java index 4671212..a25d533 100644 --- a/EntityTrackerFixer/src/net/minemora/entitytrackerfixer/v1_14_R1/tasks/CheckTask.java +++ b/EntityTrackerFixer/src/net/minemora/entitytrackerfixer/v1_14_R1/tasks/CheckTask.java @@ -39,6 +39,10 @@ public class CheckTask extends BukkitRunnable { int d = ConfigMain.getTrackingRange(); for(Player player : Bukkit.getWorld(worldName).getPlayers()) { for(Entity ent : player.getNearbyEntities(d, d, d)) { + net.minecraft.server.v1_14_R1.Entity nms = ((CraftEntity)ent).getHandle(); + if(cps.playerChunkMap.trackedEntities.containsKey(nms.getId()) || !nms.valid) { + continue; + } trackAgain.add(((CraftEntity)ent).getHandle()); } } diff --git a/EntityTrackerFixer/src/net/minemora/entitytrackerfixer/v1_15_R1/NMSEntityTracker.java b/EntityTrackerFixer/src/net/minemora/entitytrackerfixer/v1_15_R1/NMSEntityTracker.java index 7482593..f04c1a0 100644 --- a/EntityTrackerFixer/src/net/minemora/entitytrackerfixer/v1_15_R1/NMSEntityTracker.java +++ b/EntityTrackerFixer/src/net/minemora/entitytrackerfixer/v1_15_R1/NMSEntityTracker.java @@ -29,9 +29,6 @@ public final class NMSEntityTracker { public static void trackEntities(ChunkProviderServer cps, Set trackList) { try { for(net.minecraft.server.v1_15_R1.Entity entity : trackList) { - if(cps.playerChunkMap.trackedEntities.containsKey(entity.getId())) { - continue; - } addEntityMethod.invoke(cps.playerChunkMap, entity); } } catch (SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { diff --git a/EntityTrackerFixer/src/net/minemora/entitytrackerfixer/v1_15_R1/tasks/CheckTask.java b/EntityTrackerFixer/src/net/minemora/entitytrackerfixer/v1_15_R1/tasks/CheckTask.java index b50cc40..cf9f0de 100644 --- a/EntityTrackerFixer/src/net/minemora/entitytrackerfixer/v1_15_R1/tasks/CheckTask.java +++ b/EntityTrackerFixer/src/net/minemora/entitytrackerfixer/v1_15_R1/tasks/CheckTask.java @@ -39,6 +39,10 @@ public class CheckTask extends BukkitRunnable { int d = ConfigMain.getTrackingRange(); for(Player player : Bukkit.getWorld(worldName).getPlayers()) { for(Entity ent : player.getNearbyEntities(d, d, d)) { + net.minecraft.server.v1_15_R1.Entity nms = ((CraftEntity)ent).getHandle(); + if(cps.playerChunkMap.trackedEntities.containsKey(nms.getId()) || !nms.valid) { + continue; + } trackAgain.add(((CraftEntity)ent).getHandle()); } } diff --git a/EntityTrackerFixer/src/net/minemora/entitytrackerfixer/v1_16_R1/tasks/CheckTask.java b/EntityTrackerFixer/src/net/minemora/entitytrackerfixer/v1_16_R1/tasks/CheckTask.java index 810d884..25043a9 100644 --- a/EntityTrackerFixer/src/net/minemora/entitytrackerfixer/v1_16_R1/tasks/CheckTask.java +++ b/EntityTrackerFixer/src/net/minemora/entitytrackerfixer/v1_16_R1/tasks/CheckTask.java @@ -41,10 +41,7 @@ public class CheckTask extends BukkitRunnable { for(Player player : Bukkit.getWorld(worldName).getPlayers()) { for(Entity ent : player.getNearbyEntities(d, d, d)) { net.minecraft.server.v1_16_R1.Entity nms = ((CraftEntity)ent).getHandle(); - if(cps.playerChunkMap.trackedEntities.containsKey(nms.getId())) { - continue; - } - if(!nms.valid) { + if(cps.playerChunkMap.trackedEntities.containsKey(nms.getId()) || !nms.valid) { continue; } trackAgain.add(nms);