I've either fixed going to The End, or made it worse. I'm sure we'll find out soon!

This commit is contained in:
Nathan Adams
2011-11-24 20:00:55 +00:00
parent 61edd36378
commit 47b4406b7e
3 changed files with 85 additions and 59 deletions

View File

@@ -305,7 +305,7 @@ public class ServerConfigurationManager {
public void a(EntityPlayer entityplayer, int i) {
// CraftBukkit start -- Replaced the standard handling of portals with a more customised method.
int dimension = entityplayer.dimension;
int dimension = i;
WorldServer fromWorld = this.server.getWorldServer(dimension);
WorldServer toWorld = null;
if (dimension < 10) {
@@ -315,13 +315,28 @@ public class ServerConfigurationManager {
}
}
}
double blockRatio = dimension == -1 ? 8 : 0.125;
Location fromLocation = new Location(fromWorld.getWorld(), entityplayer.locX, entityplayer.locY, entityplayer.locZ, entityplayer.yaw, entityplayer.pitch);
Location toLocation = toWorld == null ? null : new Location(toWorld.getWorld(), (entityplayer.locX * blockRatio), entityplayer.locY, (entityplayer.locZ * blockRatio), entityplayer.yaw, entityplayer.pitch);
Location toLocation = null;
if (toWorld != null) {
if ((dimension == -1) || (dimension == 0)) {
double blockRatio = dimension == 0 ? 8 : 0.125;
toLocation = toWorld == null ? null : new Location(toWorld.getWorld(), (entityplayer.locX * blockRatio), entityplayer.locY, (entityplayer.locZ * blockRatio), entityplayer.yaw, entityplayer.pitch);
} else {
ChunkCoordinates coords = toWorld.d();
toLocation = new Location(toWorld.getWorld(), coords.x, coords.y, coords.z, 90, 0);
}
}
org.bukkit.craftbukkit.PortalTravelAgent pta = new org.bukkit.craftbukkit.PortalTravelAgent();
PlayerPortalEvent event = new PlayerPortalEvent((Player) entityplayer.getBukkitEntity(), fromLocation, toLocation, pta);
if (entityplayer.dimension == 1) {
event.useTravelAgent(false);
}
Bukkit.getServer().getPluginManager().callEvent(event);
if (event.isCancelled() || event.getTo() == null) {
return;