From 424256dcb66f1454e8606d7a017d6afc7b30ab7e Mon Sep 17 00:00:00 2001 From: Felix Cravic Date: Thu, 6 Aug 2020 18:39:56 +0200 Subject: [PATCH] Fixed entities not being removed from viewing list after changing instance --- src/main/java/net/minestom/server/entity/Player.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/net/minestom/server/entity/Player.java b/src/main/java/net/minestom/server/entity/Player.java index d023f5d13..d48eed716 100644 --- a/src/main/java/net/minestom/server/entity/Player.java +++ b/src/main/java/net/minestom/server/entity/Player.java @@ -564,6 +564,7 @@ public class Player extends LivingEntity implements CommandSender { final boolean isLast = counter.get() == length - 1; if (isLast) { // This is the last chunk to be loaded , spawn player + this.viewableEntities.forEach(entity -> entity.removeViewer(this)); super.setInstance(instance); PlayerSpawnEvent spawnEvent = new PlayerSpawnEvent(instance, firstSpawn); callEvent(PlayerSpawnEvent.class, spawnEvent);