Clear the old tracker before replacing it

This commit is contained in:
fullwall 2023-06-18 17:33:09 +08:00
parent a551fe4890
commit 0acda96bff
12 changed files with 12 additions and 0 deletions

View File

@ -1077,6 +1077,7 @@ public class NMSImpl implements NMSBridge {
EntityTrackerEntry entry = server.getTracker().trackedEntities.get(entity.getEntityId());
if (entry == null)
return;
entry.a();
PlayerlistTrackerEntry replace = new PlayerlistTrackerEntry(entry);
server.getTracker().trackedEntities.a(entity.getEntityId(), replace);
if (TRACKED_ENTITY_SET != null) {

View File

@ -1130,6 +1130,7 @@ public class NMSImpl implements NMSBridge {
EntityTrackerEntry entry = server.getTracker().trackedEntities.get(entity.getEntityId());
if (entry == null)
return;
entry.a();
PlayerlistTrackerEntry replace = new PlayerlistTrackerEntry(entry);
server.getTracker().trackedEntities.a(entity.getEntityId(), replace);
if (TRACKED_ENTITY_SET != null) {

View File

@ -1137,6 +1137,7 @@ public class NMSImpl implements NMSBridge {
EntityTrackerEntry entry = server.getTracker().trackedEntities.get(entity.getEntityId());
if (entry == null)
return;
entry.a();
PlayerlistTrackerEntry replace = new PlayerlistTrackerEntry(entry);
server.getTracker().trackedEntities.a(entity.getEntityId(), replace);
if (TRACKED_ENTITY_SET != null) {

View File

@ -1179,6 +1179,7 @@ public class NMSImpl implements NMSBridge {
EntityTrackerEntry entry = server.getTracker().trackedEntities.get(entity.getEntityId());
if (entry == null)
return;
entry.a();
PlayerlistTrackerEntry replace = new PlayerlistTrackerEntry(entry);
server.getTracker().trackedEntities.a(entity.getEntityId(), replace);
if (TRACKED_ENTITY_SET != null) {

View File

@ -1206,6 +1206,7 @@ public class NMSImpl implements NMSBridge {
EntityTracker entry = server.getChunkProvider().playerChunkMap.trackedEntities.get(entity.getEntityId());
if (entry == null)
return;
entry.a();
PlayerlistTracker replace = new PlayerlistTracker(server.getChunkProvider().playerChunkMap, entry);
server.getChunkProvider().playerChunkMap.trackedEntities.put(entity.getEntityId(), replace);
if (getHandle(entity) instanceof EntityHumanNPC) {

View File

@ -1223,6 +1223,7 @@ public class NMSImpl implements NMSBridge {
EntityTracker entry = server.getChunkProvider().playerChunkMap.trackedEntities.get(entity.getEntityId());
if (entry == null)
return;
entry.a();
PlayerlistTracker replace = new PlayerlistTracker(server.getChunkProvider().playerChunkMap, entry);
server.getChunkProvider().playerChunkMap.trackedEntities.put(entity.getEntityId(), replace);
if (getHandle(entity) instanceof EntityHumanNPC) {

View File

@ -1260,6 +1260,7 @@ public class NMSImpl implements NMSBridge {
EntityTracker entry = server.getChunkProvider().playerChunkMap.trackedEntities.get(entity.getEntityId());
if (entry == null)
return;
entry.a();
PlayerlistTracker replace = new PlayerlistTracker(server.getChunkProvider().playerChunkMap, entry);
server.getChunkProvider().playerChunkMap.trackedEntities.put(entity.getEntityId(), replace);
if (getHandle(entity) instanceof EntityHumanNPC) {

View File

@ -1242,6 +1242,7 @@ public class NMSImpl implements NMSBridge {
TrackedEntity entry = server.getChunkProvider().chunkMap.G.get(entity.getEntityId());
if (entry == null)
return;
entry.broadcastRemoved();
PlayerlistTracker replace = new PlayerlistTracker(server.getChunkProvider().chunkMap, entry);
server.getChunkProvider().chunkMap.G.put(entity.getEntityId(), replace);
if (getHandle(entity) instanceof EntityHumanNPC) {

View File

@ -1250,6 +1250,7 @@ public class NMSImpl implements NMSBridge {
TrackedEntity entry = server.getChunkSource().chunkMap.entityMap.get(entity.getEntityId());
if (entry == null)
return;
entry.broadcastRemoved();
PlayerlistTracker replace = new PlayerlistTracker(server.getChunkSource().chunkMap, entry);
server.getChunkSource().chunkMap.entityMap.put(entity.getEntityId(), replace);
if (getHandle(entity) instanceof EntityHumanNPC) {

View File

@ -1349,6 +1349,7 @@ public class NMSImpl implements NMSBridge {
TrackedEntity entry = server.getChunkSource().chunkMap.entityMap.get(entity.getEntityId());
if (entry == null)
return;
entry.broadcastRemoved();
CitizensEntityTracker replace = new CitizensEntityTracker(server.getChunkSource().chunkMap, entry);
server.getChunkSource().chunkMap.entityMap.put(entity.getEntityId(), replace);
}

View File

@ -1348,6 +1348,7 @@ public class NMSImpl implements NMSBridge {
TrackedEntity entry = server.getChunkSource().chunkMap.entityMap.get(entity.getEntityId());
if (entry == null)
return;
entry.broadcastRemoved();
CitizensEntityTracker replace = new CitizensEntityTracker(server.getChunkSource().chunkMap, entry);
server.getChunkSource().chunkMap.entityMap.put(entity.getEntityId(), replace);
}

View File

@ -998,6 +998,7 @@ public class NMSImpl implements NMSBridge {
EntityTrackerEntry entry = server.getTracker().trackedEntities.get(entity.getEntityId());
if (entry == null)
return;
entry.a();
PlayerlistTrackerEntry replace = new PlayerlistTrackerEntry(entry);
server.getTracker().trackedEntities.a(entity.getEntityId(), replace);
if (TRACKED_ENTITY_SET != null) {