mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2025-01-13 11:41:43 +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.entity.Player;
|
||||||
import org.bukkit.event.Event;
|
import org.bukkit.event.Event;
|
||||||
import org.bukkit.event.Event.Priority;
|
import org.bukkit.event.Event.Priority;
|
||||||
|
import org.bukkit.event.Event.Result;
|
||||||
import org.bukkit.event.block.Action;
|
import org.bukkit.event.block.Action;
|
||||||
import org.bukkit.event.player.*;
|
import org.bukkit.event.player.*;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
@ -279,9 +280,9 @@ private void handleBlockLeftClick(PlayerInteractEvent event) {
|
|||||||
|| type == Material.TRAP_DOOR
|
|| type == Material.TRAP_DOOR
|
||||||
|| type == Material.NOTE_BLOCK) {
|
|| type == Material.NOTE_BLOCK) {
|
||||||
if (!plugin.getGlobalRegionManager().hasBypass(player, world)
|
if (!plugin.getGlobalRegionManager().hasBypass(player, world)
|
||||||
&& !set.allows(DefaultFlag.USE)
|
&& !set.canUse(localPlayer)) {
|
||||||
&& !set.canBuild(localPlayer)) {
|
|
||||||
player.sendMessage(ChatColor.DARK_RED + "You don't have permission to use that in this area.");
|
player.sendMessage(ChatColor.DARK_RED + "You don't have permission to use that in this area.");
|
||||||
|
event.setUseInteractedBlock(Result.DENY);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -312,6 +313,7 @@ private void handleAirRightClick(PlayerInteractEvent event) {
|
|||||||
toVector(player.getLocation()),
|
toVector(player.getLocation()),
|
||||||
item.getTypeId()), false, false)) {
|
item.getTypeId()), false, false)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
event.setUseItemInHand(Result.DENY);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -420,9 +422,9 @@ private void handleBlockRightClick(PlayerInteractEvent event) {
|
|||||||
|| type == Material.TRAP_DOOR
|
|| type == Material.TRAP_DOOR
|
||||||
|| type == Material.WORKBENCH) {
|
|| type == Material.WORKBENCH) {
|
||||||
if (!plugin.getGlobalRegionManager().hasBypass(player, world)
|
if (!plugin.getGlobalRegionManager().hasBypass(player, world)
|
||||||
&& !set.allows(DefaultFlag.USE)
|
&& !set.canUse(localPlayer)) {
|
||||||
&& !set.canBuild(localPlayer)) {
|
|
||||||
player.sendMessage(ChatColor.DARK_RED + "You don't have permission to use that in this area.");
|
player.sendMessage(ChatColor.DARK_RED + "You don't have permission to use that in this area.");
|
||||||
|
event.setUseInteractedBlock(Result.DENY);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -573,10 +575,8 @@ private void handlePhysicalInteract(PlayerInteractEvent event) {
|
|||||||
|
|
||||||
if (type == Material.STONE_PLATE || type == Material.WOOD_PLATE) {
|
if (type == Material.STONE_PLATE || type == Material.WOOD_PLATE) {
|
||||||
if (!plugin.getGlobalRegionManager().hasBypass(player, world)
|
if (!plugin.getGlobalRegionManager().hasBypass(player, world)
|
||||||
&& (!set.canBuild(localPlayer))
|
&& !set.canUse(localPlayer)) {
|
||||||
&& (!set.allows(DefaultFlag.USE))) {
|
event.setUseInteractedBlock(Result.DENY);
|
||||||
player.sendMessage(ChatColor.DARK_RED + "You are not allowed"
|
|
||||||
+ " to trigger pressure plates in this area.");
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user