From f01861f80bc8d903f72210e7d79c90c35473aa74 Mon Sep 17 00:00:00 2001 From: Thinkofname Date: Sat, 2 Apr 2016 01:12:03 +0100 Subject: [PATCH] SPIGOT-2115: Fix entities being added to the world multiple times when teleported --- nms-patches/PlayerList.patch | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/nms-patches/PlayerList.patch b/nms-patches/PlayerList.patch index b872d95c2e..cc18dd76b9 100644 --- a/nms-patches/PlayerList.patch +++ b/nms-patches/PlayerList.patch @@ -588,12 +588,12 @@ + double d1 = enter.getZ(); + double d2 = 8.0D; + /* -+ double d0 = entity.locX; -+ double d1 = entity.locZ; -+ double d2 = 8.0D; -+ float f = entity.yaw; -+ -+ worldserver.methodProfiler.a("moving"); + double d0 = entity.locX; + double d1 = entity.locZ; + double d2 = 8.0D; + float f = entity.yaw; + + worldserver.methodProfiler.a("moving"); + */ + if (worldserver1.dimension == -1) { + d0 = MathHelper.a(d0 / d2, worldserver1.getWorldBorder().b()+ 16.0D, worldserver1.getWorldBorder().d() - 16.0D); @@ -663,12 +663,12 @@ + int i = worldserver.dimension; + + /* - double d0 = entity.locX; - double d1 = entity.locZ; - double d2 = 8.0D; - float f = entity.yaw; - - worldserver.methodProfiler.a("moving"); ++ double d0 = entity.locX; ++ double d1 = entity.locZ; ++ double d2 = 8.0D; ++ float f = entity.yaw; ++ ++ worldserver.methodProfiler.a("moving"); + */ + entity.setPositionRotation(exit.getX(), exit.getY(), exit.getZ(), exit.getYaw(), exit.getPitch()); + if (entity.isAlive()) { @@ -687,7 +687,7 @@ blockposition = worldserver1.getSpawn(); } else { blockposition = worldserver1.getDimensionSpawn(); -@@ -526,15 +903,26 @@ +@@ -526,16 +903,27 @@ worldserver.entityJoinedWorld(entity, false); } } @@ -703,6 +703,7 @@ if (entity.isAlive()) { - entity.setPositionRotation(d0, entity.locY, d1, entity.yaw, entity.pitch); - worldserver1.getTravelAgent().a(entity, f); +- worldserver1.addEntity(entity); + // entity.setPositionRotation(d0, entity.locY, d1, entity.yaw, entity.pitch); + // worldserver1.getTravelAgent().a(entity, f); + if (portal) { @@ -713,9 +714,10 @@ + entity.getBukkitEntity().setVelocity(velocity); + } + } - worldserver1.addEntity(entity); ++ // worldserver1.addEntity(entity); worldserver1.entityJoinedWorld(entity, false); } + @@ -543,6 +931,7 @@ }