mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-22 10:36:10 +01:00
Try to avoid async issues with entity trackers
This commit is contained in:
parent
63ef3cdc73
commit
85e46c6324
@ -87,7 +87,8 @@ public class PlayerlistTracker extends PlayerChunkMap.EntityTracker {
|
||||
}
|
||||
|
||||
public void updateLastPlayer(EntityPlayer lastUpdatedPlayer) {
|
||||
if (tracker.dead || lastUpdatedPlayer == null || tracker.getBukkitEntity().getType() != EntityType.PLAYER)
|
||||
if (tracker.dead || lastUpdatedPlayer == null || tracker.getBukkitEntity().getType() != EntityType.PLAYER
|
||||
|| !CitizensAPI.hasImplementation())
|
||||
return;
|
||||
final EntityPlayer entityplayer = lastUpdatedPlayer;
|
||||
NMS.sendTabListAdd(entityplayer.getBukkitEntity(), (Player) tracker.getBukkitEntity());
|
||||
|
@ -35,8 +35,8 @@ public class PlayerlistTracker extends ChunkMap.TrackedEntity {
|
||||
}
|
||||
|
||||
public void updateLastPlayer() {
|
||||
if (tracker.isRemoved() || lastUpdatedPlayer == null
|
||||
|| tracker.getBukkitEntity().getType() != EntityType.PLAYER)
|
||||
if (tracker.isRemoved() || lastUpdatedPlayer == null || tracker.getBukkitEntity().getType() != EntityType.PLAYER
|
||||
|| !CitizensAPI.hasImplementation())
|
||||
return;
|
||||
final ServerPlayer entityplayer = lastUpdatedPlayer;
|
||||
NMS.sendTabListAdd(entityplayer.getBukkitEntity(), (Player) tracker.getBukkitEntity());
|
||||
|
@ -35,8 +35,8 @@ public class PlayerlistTracker extends ChunkMap.TrackedEntity {
|
||||
}
|
||||
|
||||
public void updateLastPlayer() {
|
||||
if (tracker.isRemoved() || lastUpdatedPlayer == null
|
||||
|| tracker.getBukkitEntity().getType() != EntityType.PLAYER)
|
||||
if (tracker.isRemoved() || lastUpdatedPlayer == null || tracker.getBukkitEntity().getType() != EntityType.PLAYER
|
||||
|| !CitizensAPI.hasImplementation())
|
||||
return;
|
||||
final ServerPlayer entityplayer = lastUpdatedPlayer;
|
||||
NMS.sendTabListAdd(entityplayer.getBukkitEntity(), (Player) tracker.getBukkitEntity());
|
||||
|
@ -58,7 +58,8 @@ public class CitizensEntityTracker extends ChunkMap.TrackedEntity {
|
||||
}
|
||||
|
||||
public void updateLastPlayer(ServerPlayer lastUpdatedPlayer) {
|
||||
if (tracker.isRemoved() || tracker.getBukkitEntity().getType() != EntityType.PLAYER)
|
||||
if (tracker.isRemoved() || tracker.getBukkitEntity().getType() != EntityType.PLAYER
|
||||
|| !CitizensAPI.hasImplementation())
|
||||
return;
|
||||
final ServerPlayer entityplayer = lastUpdatedPlayer;
|
||||
NPC npc = ((NPCHolder) tracker).getNPC();
|
||||
|
@ -59,7 +59,8 @@ public class CitizensEntityTracker extends ChunkMap.TrackedEntity {
|
||||
}
|
||||
|
||||
public void updateLastPlayer(ServerPlayer lastUpdatedPlayer) {
|
||||
if (tracker.isRemoved() || tracker.getBukkitEntity().getType() != EntityType.PLAYER)
|
||||
if (tracker.isRemoved() || tracker.getBukkitEntity().getType() != EntityType.PLAYER
|
||||
|| !CitizensAPI.hasImplementation())
|
||||
return;
|
||||
final ServerPlayer entityplayer = lastUpdatedPlayer;
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(CitizensAPI.getPlugin(), () -> {
|
||||
|
@ -380,6 +380,7 @@ public class NMSImpl implements NMSBridge {
|
||||
public boolean addEntityToWorld(org.bukkit.entity.Entity entity, SpawnReason custom) {
|
||||
int viewDistance = -1;
|
||||
ChunkMap chunkMap = null;
|
||||
|
||||
try {
|
||||
if (entity instanceof Player) {
|
||||
chunkMap = ((ServerChunkCache) getHandle(entity).level().getChunkSource()).chunkMap;
|
||||
|
Loading…
Reference in New Issue
Block a user