mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-28 13:36:16 +01:00
Fixed potential NPE with bed leave event.
This commit is contained in:
parent
86c467cb50
commit
8de85b8afb
@ -662,7 +662,12 @@ public abstract class EntityHuman extends EntityLiving {
|
|||||||
if (this.getBukkitEntity() instanceof Player) {
|
if (this.getBukkitEntity() instanceof Player) {
|
||||||
Player player = (Player) this.getBukkitEntity();
|
Player player = (Player) this.getBukkitEntity();
|
||||||
CraftServer server = ((WorldServer) world).getServer();
|
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);
|
PlayerBedLeaveEvent event = new PlayerBedLeaveEvent(player, bed);
|
||||||
server.getPluginManager().callEvent(event);
|
server.getPluginManager().callEvent(event);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user