Target default world when returning from The End; Fixes BUKKIT-3494

Due to the having to generate new logic to avoid using the customized
PlayerConnection.moveToWorld, entities returning from The End were not
properly calculating their exit target.  This commit corrects that
logic.
This commit is contained in:
EdGruberman
2013-01-24 17:37:01 -07:00
committed by feildmaster
parent 50e74b3b49
commit 132fdbc4ac
3 changed files with 15 additions and 7 deletions

View File

@@ -1762,9 +1762,11 @@ public abstract class Entity {
Location enter = this.getBukkitEntity().getLocation();
Location exit = exitWorld != null ? minecraftserver.getPlayerList().calculateTarget(enter, minecraftserver.getWorldServer(i)) : null;
boolean useTravelAgent = exitWorld != null && !(this.dimension == 1 && exitWorld.dimension == 1); // don't use agent for custom worlds or return from THE_END
TravelAgent agent = exit != null ? (TravelAgent) ((CraftWorld) exit.getWorld()).getHandle().s() : null;
EntityPortalEvent event = new EntityPortalEvent(this.getBukkitEntity(), enter, exit, agent);
event.useTravelAgent(useTravelAgent);
event.getEntity().getServer().getPluginManager().callEvent(event);
if (event.isCancelled() || event.getTo() == null || !this.isAlive()) {
return;