diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java index 88b72b5bf7..dbc6edc160 100644 --- a/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/src/main/java/net/minecraft/server/EntityPlayer.java @@ -193,8 +193,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { super.b(i); } - // CraftBukkit return EntityPlayer - public EntityPlayer a(boolean flag) { + public void a(boolean flag) { super.o_(); for (int i = 0; i < this.inventory.getSize(); ++i) { @@ -233,7 +232,6 @@ public class EntityPlayer extends EntityHuman implements ICrafting { } } - EntityPlayer player = this; // CraftBukkit if (this.E) { if (this.b.propertyManager.getBoolean("allow-nether", true)) { if (this.vehicle != null) { @@ -243,11 +241,11 @@ public class EntityPlayer extends EntityHuman implements ICrafting { if (this.F >= 1.0F) { this.F = 1.0F; this.D = 10; - player = this.b.serverConfigurationManager.f(this); // CraftBukkit + this.b.serverConfigurationManager.f(this); } } - player.E = false; // CraftBukkit + this.E = false; } } else { if (this.F > 0.0F) { @@ -259,17 +257,14 @@ public class EntityPlayer extends EntityHuman implements ICrafting { } } - // CraftBukkit start - if (player.D > 0) { - --player.D; + if (this.D > 0) { + --this.D; } - if (player.health != player.bK) { - player.netServerHandler.sendPacket(new Packet8UpdateHealth(this.health)); - player.bK = player.health; + if (this.health != this.bK) { + this.netServerHandler.sendPacket(new Packet8UpdateHealth(this.health)); + this.bK = this.health; } - return player; - // CraftBukkit end } private void a(TileEntity tileentity) { diff --git a/src/main/java/net/minecraft/server/NetServerHandler.java b/src/main/java/net/minecraft/server/NetServerHandler.java index 6280f2088f..b1aaab05b3 100644 --- a/src/main/java/net/minecraft/server/NetServerHandler.java +++ b/src/main/java/net/minecraft/server/NetServerHandler.java @@ -219,7 +219,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener { } this.player.onGround = packet10flying.g; - this.player = this.player.a(true); // CraftBukkit + this.player.a(true); this.player.move(d5, 0.0D, d4); this.player.setLocation(d1, d2, d3, f, f1); this.player.motX = d5; diff --git a/src/main/java/net/minecraft/server/ServerConfigurationManager.java b/src/main/java/net/minecraft/server/ServerConfigurationManager.java index 316e7be75a..3458ab6afc 100644 --- a/src/main/java/net/minecraft/server/ServerConfigurationManager.java +++ b/src/main/java/net/minecraft/server/ServerConfigurationManager.java @@ -210,15 +210,19 @@ public class ServerConfigurationManager { this.a(entityplayer.dimension).removePlayer(entityplayer); this.players.remove(entityplayer); this.server.a(entityplayer.dimension).removeEntity(entityplayer); + ChunkCoordinates chunkcoordinates = entityplayer.M(); + + // CraftBukkit start + EntityPlayer entityplayer1 = entityplayer; + if (location == null) { - ChunkCoordinates chunkcoordinates = entityplayer.M(); CraftWorld cw = (CraftWorld) this.server.server.getWorld(entityplayer.spawnWorld); if(cw != null && chunkcoordinates != null) { ChunkCoordinates chunkcoordinates1 = EntityHuman.getBed(cw.getHandle(), chunkcoordinates); if (chunkcoordinates1 != null) { location = new Location(cw, chunkcoordinates1.x + 0.5, chunkcoordinates1.y + 0.1, chunkcoordinates1.z + 0.5); } else { - entityplayer.netServerHandler.sendPacket(new Packet70Bed(0)); + entityplayer1.netServerHandler.sendPacket(new Packet70Bed(0)); } } if (location == null) { @@ -237,30 +241,33 @@ public class ServerConfigurationManager { location.setWorld(this.server.a(i).getWorld()); } WorldServer worldserver = ((CraftWorld)location.getWorld()).getHandle(); - worldserver.chunkProviderServer.getChunkAt((int) entityplayer.locX >> 4, (int) entityplayer.locZ >> 4); - - while (worldserver.getTypeId(location.getBlockX(), location.getBlockY(), location.getBlockZ()) != 0 || - worldserver.getTypeId(location.getBlockX(), location.getBlockY() + 1, location.getBlockZ()) != 0) { - location.setY(location.getY() + 1); - } - byte actualDimension = (byte) (worldserver.getWorld().getEnvironment().getId()); - entityplayer.netServerHandler.sendPacket(new Packet9Respawn((byte) (actualDimension >= 0 ? -1 : 0))); - entityplayer.netServerHandler.sendPacket(new Packet9Respawn(actualDimension)); - entityplayer.a(worldserver); - entityplayer.dead = false; - entityplayer.netServerHandler.teleport(location); - this.a(entityplayer, worldserver); - this.a(entityplayer.dimension).addPlayer(entityplayer); - worldserver.addEntity(entityplayer); - this.players.add(entityplayer); - this.g(entityplayer); - entityplayer.w(); - return entityplayer; + entityplayer1.setLocation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); // CraftBukkit end + + worldserver.chunkProviderServer.getChunkAt((int) entityplayer1.locX >> 4, (int) entityplayer1.locZ >> 4); + + while (worldserver.getEntities(entityplayer1, entityplayer1.boundingBox).size() != 0) { + entityplayer1.setPosition(entityplayer1.locX, entityplayer1.locY + 1.0D, entityplayer1.locZ); + } + + // CraftBukkit start + byte actualDimension = (byte) (worldserver.getWorld().getEnvironment().getId()); + entityplayer1.netServerHandler.sendPacket(new Packet9Respawn((byte) (actualDimension >= 0 ? -1 : 0))); + entityplayer1.netServerHandler.sendPacket(new Packet9Respawn(actualDimension)); + entityplayer1.a(worldserver); + entityplayer1.dead = false; + // CraftBukkit end + entityplayer1.netServerHandler.a(entityplayer1.locX, entityplayer1.locY, entityplayer1.locZ, entityplayer1.yaw, entityplayer1.pitch); + this.a(entityplayer1, worldserver); + this.a(entityplayer1.dimension).addPlayer(entityplayer1); + worldserver.addEntity(entityplayer1); + this.players.add(entityplayer1); + this.g(entityplayer1); // CraftBukkit + entityplayer1.w(); + return entityplayer1; } - // CraftBukkit - changed signature - public EntityPlayer f(EntityPlayer entityplayer) { + public void f(EntityPlayer entityplayer) { WorldServer worldserver = this.server.a(entityplayer.dimension); boolean flag = false; byte b0; @@ -284,7 +291,7 @@ public class ServerConfigurationManager { PlayerPortalEvent event = new PlayerPortalEvent((Player)entityplayer.getBukkitEntity(),startLocation,endLocation); Bukkit.getServer().getPluginManager().callEvent(event); if (event.isCancelled()) { - return entityplayer; + return; } // entityplayer.dimension = b0; @@ -331,7 +338,7 @@ public class ServerConfigurationManager { this.g(entityplayer); */ // CraftBukkit end // CraftBukkit - defer for actual teleportation - return a(entityplayer, b0, new Location(null, entityplayer.locX, entityplayer.locY, entityplayer.locZ)); + a(entityplayer, b0, new Location(null, entityplayer.locX, entityplayer.locY, entityplayer.locZ)); } public void b() {