mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-04 09:50:03 +01:00
acc7e2172b
sorry for messy commit,doing via tablet on ssh md_5
48 lines
1.7 KiB
Diff
48 lines
1.7 KiB
Diff
From 768d209d592385a01bb859f00fa00322fb325020 Mon Sep 17 00:00:00 2001
|
|
From: EdGruberman <ed@rjump.com>
|
|
Date: Fri, 22 Feb 2013 09:23:51 -0700
|
|
Subject: [PATCH] Return bed location itself instead of next to bed; Fixes BUKKIT-3604
|
|
|
|
---
|
|
.../org/bukkit/craftbukkit/entity/CraftPlayer.java | 22 ++++++++++++++++++-
|
|
1 files changed, 20 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
index 0deb4df..8eb93c0 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
@@ -626,10 +626,28 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
|
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;
|
|
}
|
|
--
|
|
1.7.0.4
|
|
|