mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-12-26 11:08:02 +01:00
Changed the way some flags were handled and canceled
This commit is contained in:
parent
b89d9d44b0
commit
c472dc89ad
@ -29,6 +29,7 @@
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.Event.Priority;
|
||||
import org.bukkit.event.Event.Result;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.player.*;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@ -279,9 +280,9 @@ private void handleBlockLeftClick(PlayerInteractEvent event) {
|
||||
|| type == Material.TRAP_DOOR
|
||||
|| type == Material.NOTE_BLOCK) {
|
||||
if (!plugin.getGlobalRegionManager().hasBypass(player, world)
|
||||
&& !set.allows(DefaultFlag.USE)
|
||||
&& !set.canBuild(localPlayer)) {
|
||||
&& !set.canUse(localPlayer)) {
|
||||
player.sendMessage(ChatColor.DARK_RED + "You don't have permission to use that in this area.");
|
||||
event.setUseInteractedBlock(Result.DENY);
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
@ -312,6 +313,7 @@ private void handleAirRightClick(PlayerInteractEvent event) {
|
||||
toVector(player.getLocation()),
|
||||
item.getTypeId()), false, false)) {
|
||||
event.setCancelled(true);
|
||||
event.setUseItemInHand(Result.DENY);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -420,9 +422,9 @@ private void handleBlockRightClick(PlayerInteractEvent event) {
|
||||
|| type == Material.TRAP_DOOR
|
||||
|| type == Material.WORKBENCH) {
|
||||
if (!plugin.getGlobalRegionManager().hasBypass(player, world)
|
||||
&& !set.allows(DefaultFlag.USE)
|
||||
&& !set.canBuild(localPlayer)) {
|
||||
&& !set.canUse(localPlayer)) {
|
||||
player.sendMessage(ChatColor.DARK_RED + "You don't have permission to use that in this area.");
|
||||
event.setUseInteractedBlock(Result.DENY);
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
@ -573,10 +575,8 @@ private void handlePhysicalInteract(PlayerInteractEvent event) {
|
||||
|
||||
if (type == Material.STONE_PLATE || type == Material.WOOD_PLATE) {
|
||||
if (!plugin.getGlobalRegionManager().hasBypass(player, world)
|
||||
&& (!set.canBuild(localPlayer))
|
||||
&& (!set.allows(DefaultFlag.USE))) {
|
||||
player.sendMessage(ChatColor.DARK_RED + "You are not allowed"
|
||||
+ " to trigger pressure plates in this area.");
|
||||
&& !set.canUse(localPlayer)) {
|
||||
event.setUseInteractedBlock(Result.DENY);
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user