Skip to content

Commit

Permalink
fix: essentials.sethome.bed permission
Browse files Browse the repository at this point in the history
  • Loading branch information
Hunh0w committed Dec 12, 2024
1 parent 221defe commit 063eafb
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -795,12 +795,16 @@ public void onPlayerInteract(final PlayerInteractEvent event) {
break;
}
final User player = ess.getUser(event.getPlayer());
if (player.isAuthorized("essentials.sethome.bed") && player.getWorld().getEnvironment().equals(World.Environment.NORMAL)) {
final boolean isAuthorized = player.isAuthorized("essentials.sethome.bed");
if (isAuthorized && player.getWorld().getEnvironment().equals(World.Environment.NORMAL)) {
player.getBase().setBedSpawnLocation(event.getClickedBlock().getLocation());
// In 1.15 and above, vanilla sends its own bed spawn message.
if (VersionUtil.getServerBukkitVersion().isLowerThan(VersionUtil.v1_15_R01)) {
player.sendTl("bedSet", player.getLocation().getWorld().getName(), player.getLocation().getBlockX(), player.getLocation().getBlockY(), player.getLocation().getBlockZ());
}
} else if (!isAuthorized) {
player.sendMessage("event canceled");
event.setCancelled(true);
}
}
break;
Expand Down

0 comments on commit 063eafb

Please sign in to comment.