summaryrefslogtreecommitdiffstats
path: root/src/main/java/net/minecraft/server/ServerConfigurationManager.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/net/minecraft/server/ServerConfigurationManager.java')
-rw-r--r--src/main/java/net/minecraft/server/ServerConfigurationManager.java21
1 files changed, 18 insertions, 3 deletions
diff --git a/src/main/java/net/minecraft/server/ServerConfigurationManager.java b/src/main/java/net/minecraft/server/ServerConfigurationManager.java
index f1a66bfc..1ff21bde 100644
--- a/src/main/java/net/minecraft/server/ServerConfigurationManager.java
+++ b/src/main/java/net/minecraft/server/ServerConfigurationManager.java
@@ -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;