mirror of
https://github.com/BG-Software-LLC/WildLoaders.git
synced 2024-12-23 16:58:35 +01:00
Fixed server crashing when chunk loaders finish in 1.16.5 (#47)
This commit is contained in:
parent
197926b0c9
commit
1992f03b0e
@ -5,7 +5,6 @@ import com.bgsoftware.wildloaders.handlers.NPCHandler;
|
||||
import com.bgsoftware.wildloaders.npc.DummyChannel;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import net.minecraft.server.v1_16_R3.AxisAlignedBB;
|
||||
import net.minecraft.server.v1_16_R3.Chunk;
|
||||
import net.minecraft.server.v1_16_R3.EntityPlayer;
|
||||
import net.minecraft.server.v1_16_R3.EnumGamemode;
|
||||
import net.minecraft.server.v1_16_R3.EnumProtocolDirection;
|
||||
@ -72,7 +71,7 @@ public final class ChunkLoaderNPC_v1_16_R3 extends EntityPlayer implements Chunk
|
||||
public void die() {
|
||||
if (!dieCall) {
|
||||
dieCall = true;
|
||||
removePlayer(getWorldServer(), this);
|
||||
getWorldServer().removePlayer(this);
|
||||
dieCall = false;
|
||||
} else {
|
||||
super.die();
|
||||
@ -84,20 +83,6 @@ public final class ChunkLoaderNPC_v1_16_R3 extends EntityPlayer implements Chunk
|
||||
return getBukkitEntity().getLocation();
|
||||
}
|
||||
|
||||
private static void removePlayer(WorldServer worldServer, EntityPlayer entityPlayer) {
|
||||
Chunk currentChunk = worldServer.getChunkIfLoaded((int) entityPlayer.locX() >> 4,
|
||||
(int) entityPlayer.locZ() >> 4);
|
||||
if (currentChunk != null)
|
||||
currentChunk.b(entityPlayer);
|
||||
|
||||
worldServer.entitiesById.remove(entityPlayer.getId());
|
||||
worldServer.unregisterEntity(entityPlayer);
|
||||
try {
|
||||
entityPlayer.shouldBeRemoved = true;
|
||||
} catch (Throwable ignored) {
|
||||
}
|
||||
}
|
||||
|
||||
public static class DummyNetworkManager extends NetworkManager {
|
||||
|
||||
private static Field channelField;
|
||||
|
Loading…
Reference in New Issue
Block a user