diff --git a/src/main/java/com/sk89q/worldguard/bukkit/WorldGuardPlayerListener.java b/src/main/java/com/sk89q/worldguard/bukkit/WorldGuardPlayerListener.java index 7bb52566..294438dd 100644 --- a/src/main/java/com/sk89q/worldguard/bukkit/WorldGuardPlayerListener.java +++ b/src/main/java/com/sk89q/worldguard/bukkit/WorldGuardPlayerListener.java @@ -548,6 +548,16 @@ private void handleBlockRightClick(PlayerInteractEvent event) { } } + if (type == Material.BED_BLOCK) { + if (!plugin.getGlobalRegionManager().hasBypass(player, world) + && !set.allows(DefaultFlag.SLEEP)) { + player.sendMessage(ChatColor.DARK_RED + "You're not allowed to use that bed."); + event.setUseInteractedBlock(Result.DENY); + event.setCancelled(true); + return; + } + } + if (type == Material.CHEST || type == Material.JUKEBOX //stores the (arguably) most valuable item || type == Material.DISPENSER