SPIGOT-5481: PlayerBedLeaveEvent returns wrong bed location

Dieser Commit ist enthalten in:
md_5 2019-12-25 10:11:08 +11:00
Ursprung edcb0a4b6a
Commit d641927fce

Datei anzeigen

@ -362,7 +362,13 @@
this.entitySleep(blockposition); this.entitySleep(blockposition);
this.sleepTicks = 0; this.sleepTicks = 0;
@@ -1215,6 +1373,23 @@ @@ -1210,11 +1368,28 @@
}
public void wakeup(boolean flag, boolean flag1) {
+ BlockPosition bedPosition = this.getBedPosition().orElse(null); // CraftBukkit
super.entityWakeup();
if (this.world instanceof WorldServer && flag1) {
((WorldServer) this.world).everyoneSleeping(); ((WorldServer) this.world).everyoneSleeping();
} }
@ -371,9 +377,8 @@
+ Player player = (Player) this.getBukkitEntity(); + Player player = (Player) this.getBukkitEntity();
+ +
+ org.bukkit.block.Block bed; + org.bukkit.block.Block bed;
+ BlockPosition blockposition = this.getBedPosition().orElse(null); + if (bedPosition != null) {
+ if (blockposition != null) { + bed = this.world.getWorld().getBlockAt(bedPosition.getX(), bedPosition.getY(), bedPosition.getZ());
+ bed = this.world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
+ } else { + } else {
+ bed = this.world.getWorld().getBlockAt(player.getLocation()); + bed = this.world.getWorld().getBlockAt(player.getLocation());
+ } + }