mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-02 13:07:06 +01:00
Fixed potential NPE with bed leave event.
This commit is contained in:
parent
86c467cb50
commit
8de85b8afb
1 changed files with 6 additions and 1 deletions
|
@ -662,7 +662,12 @@ public abstract class EntityHuman extends EntityLiving {
|
|||
if (this.getBukkitEntity() instanceof Player) {
|
||||
Player player = (Player) this.getBukkitEntity();
|
||||
CraftServer server = ((WorldServer) world).getServer();
|
||||
org.bukkit.block.Block bed = ((WorldServer) world).getWorld().getBlockAt(this.b.a, this.b.b, this.b.c);
|
||||
org.bukkit.block.Block bed;
|
||||
if (chunkcoordinates != null) {
|
||||
bed = ((WorldServer) world).getWorld().getBlockAt(chunkcoordinates.a, chunkcoordinates.b, chunkcoordinates.c);
|
||||
} else {
|
||||
bed = ((WorldServer) world).getWorld().getBlockAt(player.getLocation());
|
||||
}
|
||||
PlayerBedLeaveEvent event = new PlayerBedLeaveEvent(player, bed);
|
||||
server.getPluginManager().callEvent(event);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue