2013-04-10 04:36:11 +02:00
|
|
|
From 0a55f29b08d6720b563cec891f68714e943839d4 Mon Sep 17 00:00:00 2001
|
2013-03-01 23:17:52 +01:00
|
|
|
From: EdGruberman <ed@rjump.com>
|
|
|
|
Date: Fri, 22 Feb 2013 09:23:51 -0700
|
2013-04-10 04:36:11 +02:00
|
|
|
Subject: [PATCH] Return bed location itself instead of next to bed; Fixes
|
|
|
|
BUKKIT-3604
|
2013-03-01 23:17:52 +01:00
|
|
|
|
|
|
|
---
|
2013-04-10 04:36:11 +02:00
|
|
|
.../org/bukkit/craftbukkit/entity/CraftPlayer.java | 22 ++++++++++++++++++++--
|
|
|
|
1 file changed, 20 insertions(+), 2 deletions(-)
|
2013-03-01 23:17:52 +01:00
|
|
|
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
2013-04-10 04:36:11 +02:00
|
|
|
index 5b74a5b..a913a1c 100644
|
2013-03-01 23:17:52 +01:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
2013-04-10 04:36:11 +02:00
|
|
|
@@ -628,10 +628,28 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
2013-03-01 23:17:52 +01:00
|
|
|
ChunkCoordinates bed = getHandle().getBed();
|
|
|
|
|
|
|
|
if (world != null && bed != null) {
|
|
|
|
- bed = EntityHuman.getBed(((CraftWorld) world).getHandle(), bed, getHandle().isRespawnForced());
|
|
|
|
- if (bed != null) {
|
|
|
|
+ if (getHandle().isRespawnForced()) {
|
|
|
|
return new Location(world, bed.x, bed.y, bed.z);
|
|
|
|
}
|
|
|
|
+
|
|
|
|
+ int cx = bed.x >> 4;
|
|
|
|
+ int cz = bed.z >> 4;
|
|
|
|
+ boolean before = world.isChunkLoaded(cx, cz);
|
|
|
|
+
|
|
|
|
+ if (!before) {
|
|
|
|
+ world.loadChunk(cx, cz);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ Location location = null;
|
|
|
|
+ if (world.getBlockTypeIdAt(bed.x, bed.y, bed.z) == Block.BED.id) {
|
|
|
|
+ location = new Location(world, bed.x, bed.y, bed.z);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (!before) {
|
|
|
|
+ world.unloadChunk(cx, cz);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return location;
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
--
|
2013-04-10 04:36:11 +02:00
|
|
|
1.8.2.1
|
2013-03-01 23:17:52 +01:00
|
|
|
|