mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2025-01-27 02:21:25 +01:00
Workaround for tnt activating as soon as it was placed, regardless of cancellation.
This commit is contained in:
parent
3e7a5056d5
commit
5f8a6e3423
@ -57,6 +57,7 @@
|
|||||||
import com.sk89q.worldguard.LocalPlayer;
|
import com.sk89q.worldguard.LocalPlayer;
|
||||||
import com.sk89q.worldguard.blacklist.events.BlockBreakBlacklistEvent;
|
import com.sk89q.worldguard.blacklist.events.BlockBreakBlacklistEvent;
|
||||||
import com.sk89q.worldguard.blacklist.events.BlockInteractBlacklistEvent;
|
import com.sk89q.worldguard.blacklist.events.BlockInteractBlacklistEvent;
|
||||||
|
import com.sk89q.worldguard.blacklist.events.BlockPlaceBlacklistEvent;
|
||||||
import com.sk89q.worldguard.blacklist.events.ItemAcquireBlacklistEvent;
|
import com.sk89q.worldguard.blacklist.events.ItemAcquireBlacklistEvent;
|
||||||
import com.sk89q.worldguard.blacklist.events.ItemDropBlacklistEvent;
|
import com.sk89q.worldguard.blacklist.events.ItemDropBlacklistEvent;
|
||||||
import com.sk89q.worldguard.blacklist.events.ItemUseBlacklistEvent;
|
import com.sk89q.worldguard.blacklist.events.ItemUseBlacklistEvent;
|
||||||
@ -563,6 +564,17 @@ private void handleBlockRightClick(PlayerInteractEvent event) {
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (item.getType() == Material.TNT) {
|
||||||
|
Block placedOn = block.getRelative(event.getBlockFace());
|
||||||
|
if (!plugin.getGlobalRegionManager().hasBypass(player, world)
|
||||||
|
&& !plugin.getGlobalRegionManager().allows(
|
||||||
|
DefaultFlag.TNT, placedOn.getLocation())) {
|
||||||
|
event.setUseItemInHand(Result.DENY);
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (item.getType() == Material.INK_SACK
|
if (item.getType() == Material.INK_SACK
|
||||||
&& item.getData() != null
|
&& item.getData() != null
|
||||||
&& item.getData().getData() == 15 // bonemeal
|
&& item.getData().getData() == 15 // bonemeal
|
||||||
@ -570,7 +582,6 @@ private void handleBlockRightClick(PlayerInteractEvent event) {
|
|||||||
if (!plugin.getGlobalRegionManager().hasBypass(player, world)
|
if (!plugin.getGlobalRegionManager().hasBypass(player, world)
|
||||||
&& !set.canBuild(localPlayer)) {
|
&& !set.canBuild(localPlayer)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
event.setUseInteractedBlock(Result.DENY);
|
|
||||||
event.setUseItemInHand(Result.DENY);
|
event.setUseItemInHand(Result.DENY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -674,6 +685,17 @@ private void handleBlockRightClick(PlayerInteractEvent event) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Workaround for http://leaky.bukkit.org/issues/1034
|
||||||
|
if (item.getType() == Material.TNT) {
|
||||||
|
Block placedOn = block.getRelative(event.getBlockFace());
|
||||||
|
if (!wcfg.getBlacklist().check(
|
||||||
|
new BlockPlaceBlacklistEvent(plugin.wrapPlayer(player), toVector(placedOn),
|
||||||
|
item.getTypeId()), false, false)) {
|
||||||
|
event.setUseItemInHand(Result.DENY);
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((block.getType() == Material.CHEST
|
if ((block.getType() == Material.CHEST
|
||||||
|
Loading…
Reference in New Issue
Block a user