mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-12-18 15:17:36 +01:00
fixed cake protection in regions
This commit is contained in:
parent
4b72805a69
commit
c707434155
@ -437,9 +437,10 @@ public void onBlockPlace(BlockPlaceEvent event) {
|
||||
public void onBlockRightClick(BlockRightClickEvent event) {
|
||||
|
||||
Player player = event.getPlayer();
|
||||
Block blockClicked = event.getBlock();
|
||||
|
||||
if (plugin.useRegions && event.getItemInHand().getTypeId() == plugin.regionWand) {
|
||||
Vector pt = toVector(event.getBlock());
|
||||
Vector pt = toVector(blockClicked);
|
||||
ApplicableRegionSet app = plugin.regionManager.getApplicableRegions(pt);
|
||||
List<String> regions = plugin.regionManager.getApplicableRegionsIDs(pt);
|
||||
|
||||
@ -460,6 +461,24 @@ public void onBlockRightClick(BlockRightClickEvent event) {
|
||||
player.sendMessage(ChatColor.YELLOW + "WorldGuard: No defined regions here!");
|
||||
}
|
||||
}
|
||||
|
||||
Material type = blockClicked.getType();
|
||||
|
||||
if (plugin.useRegions && type == Material.CAKE_BLOCK) {
|
||||
|
||||
Vector pt = toVector(blockClicked);
|
||||
LocalPlayer localPlayer = plugin.wrapPlayer(player);
|
||||
|
||||
if (!plugin.hasPermission(player, "/regionbypass")
|
||||
&& !plugin.regionManager.getApplicableRegions(pt).canBuild(localPlayer)) {
|
||||
player.sendMessage(ChatColor.DARK_RED + "You don't have permission for this area.");
|
||||
|
||||
blockClicked.setData((byte) (blockClicked.getData() - 1));
|
||||
player.setHealth(player.getHealth() - 3);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user