Paper/CraftBukkit-Patches/0033-Remove-dependency-on-CraftPlayer.getBedSpawnLocation.patch

36 Zeilen
2.0 KiB
Diff

2013-03-20 22:54:12 +01:00
From 808e35b72cc0f8ed679f0d1cfee555091166d02f Mon Sep 17 00:00:00 2001
From: EdGruberman <ed@rjump.com>
Date: Tue, 12 Feb 2013 16:17:31 -0700
Subject: [PATCH] Remove dependency on CraftPlayer.getBedSpawnLocation; Fixes
BUKKIT-3604
---
src/main/java/net/minecraft/server/PlayerList.java | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
2013-03-20 22:54:12 +01:00
index c6513c8..ae7ed8f 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -491,8 +491,15 @@ public abstract class PlayerList {
boolean useTravelAgent = false; // don't use agent for custom worlds or return from THE_END
if (exitWorld != null) {
if ((cause == TeleportCause.END_PORTAL) && (i == 0)) {
- // THE_END -> NORMAL; use bed if available, otherwise default spawn
- exit = ((CraftPlayer) entityplayer.getBukkitEntity()).getBedSpawnLocation();
+ // THE_END -> NORMAL; use bed if available, otherwise default spawn (code modeled after vanilla moveToWorld)
+ ChunkCoordinates chunkcoordinates = entityplayer.getBed();
+ CraftWorld spawnWorld = (CraftWorld) this.server.server.getWorld(entityplayer.spawnWorld);
+ if (spawnWorld != null && chunkcoordinates != null) {
+ ChunkCoordinates chunkcoordinates1 = EntityHuman.getBed(spawnWorld.getHandle(), chunkcoordinates, entityplayer.isRespawnForced());
+ if (chunkcoordinates1 != null) {
+ exit = new Location(spawnWorld, chunkcoordinates1.x + 0.5, chunkcoordinates1.y, chunkcoordinates1.z + 0.5);
+ }
+ }
if (exit == null || ((CraftWorld) exit.getWorld()).getHandle().dimension != 0) {
exit = exitWorld.getWorld().getSpawnLocation();
}
--
2013-03-20 22:54:12 +01:00
1.8.2