Fixes for tripwire, flower pots, wooden buttons, ender chests, and sneaking

This commit is contained in:
Wizjany 2013-01-11 21:46:17 -05:00
parent e79bb3533d
commit 0d0ba31d3a

View File

@ -546,7 +546,7 @@ private void handleBlockLeftClick(PlayerInteractEvent event) {
ApplicableRegionSet set = mgr.getApplicableRegions(pt); ApplicableRegionSet set = mgr.getApplicableRegions(pt);
LocalPlayer localPlayer = plugin.wrapPlayer(player); LocalPlayer localPlayer = plugin.wrapPlayer(player);
if (type == BlockID.STONE_BUTTON /*if (type == BlockID.STONE_BUTTON
|| type == BlockID.LEVER || type == BlockID.LEVER
|| type == BlockID.WOODEN_DOOR || type == BlockID.WOODEN_DOOR
|| type == BlockID.TRAP_DOOR || type == BlockID.TRAP_DOOR
@ -559,7 +559,7 @@ private void handleBlockLeftClick(PlayerInteractEvent event) {
event.setCancelled(true); event.setCancelled(true);
return; return;
} }
} }*/
if (type == BlockID.DRAGON_EGG) { if (type == BlockID.DRAGON_EGG) {
if (!plugin.getGlobalRegionManager().hasBypass(player, world) if (!plugin.getGlobalRegionManager().hasBypass(player, world)
@ -652,8 +652,7 @@ private void handleBlockRightClick(PlayerInteractEvent event) {
|| type == BlockID.FURNACE || type == BlockID.FURNACE
|| type == BlockID.BURNING_FURNACE || type == BlockID.BURNING_FURNACE
|| type == BlockID.BREWING_STAND || type == BlockID.BREWING_STAND
|| type == BlockID.ENCHANTMENT_TABLE || type == BlockID.ENCHANTMENT_TABLE)
|| type == BlockID.CAULDRON)
&& wcfg.removeInfiniteStacks && wcfg.removeInfiniteStacks
&& !plugin.hasPermission(player, "worldguard.override.infinite-stack")) { && !plugin.hasPermission(player, "worldguard.override.infinite-stack")) {
for (int slot = 0; slot < 40; slot++) { for (int slot = 0; slot < 40; slot++) {
@ -728,6 +727,22 @@ private void handleBlockRightClick(PlayerInteractEvent event) {
} }
} }
if (type == BlockID.FLOWER_POT) { // no api for this atm
if (item.getTypeId() == BlockID.RED_FLOWER
|| item.getTypeId() == BlockID.YELLOW_FLOWER
|| item.getTypeId() == BlockID.SAPLING
|| item.getTypeId() == BlockID.RED_MUSHROOM
|| item.getTypeId() == BlockID.BROWN_MUSHROOM
|| item.getTypeId() == BlockID.CACTUS
|| item.getTypeId() == BlockID.LONG_GRASS
|| item.getTypeId() == BlockID.DEAD_BUSH) {
event.setUseItemInHand(Result.DENY);
event.setCancelled(true);
player.sendMessage(ChatColor.DARK_RED + "You're not allowed to plant that here.");
return;
}
}
if (type == BlockID.BED) { if (type == BlockID.BED) {
if (!plugin.getGlobalRegionManager().hasBypass(player, world) if (!plugin.getGlobalRegionManager().hasBypass(player, world)
&& !set.allows(DefaultFlag.SLEEP, localPlayer)) { && !set.allows(DefaultFlag.SLEEP, localPlayer)) {
@ -743,7 +758,8 @@ private void handleBlockRightClick(PlayerInteractEvent event) {
|| type == BlockID.DISPENSER || type == BlockID.DISPENSER
|| type == BlockID.FURNACE || type == BlockID.FURNACE
|| type == BlockID.BURNING_FURNACE || type == BlockID.BURNING_FURNACE
|| type == BlockID.BREWING_STAND) { || type == BlockID.BREWING_STAND
|| type == BlockID.ENDER_CHEST) { // meh?
if (!plugin.getGlobalRegionManager().hasBypass(player, world) if (!plugin.getGlobalRegionManager().hasBypass(player, world)
&& !set.canBuild(localPlayer) && !set.canBuild(localPlayer)
&& !set.allows(DefaultFlag.CHEST_ACCESS, localPlayer)) { && !set.allows(DefaultFlag.CHEST_ACCESS, localPlayer)) {
@ -766,6 +782,7 @@ private void handleBlockRightClick(PlayerInteractEvent event) {
if (type == BlockID.LEVER if (type == BlockID.LEVER
|| type == BlockID.STONE_BUTTON || type == BlockID.STONE_BUTTON
|| type == BlockID.WOODEN_BUTTON
|| type == BlockID.NOTE_BLOCK || type == BlockID.NOTE_BLOCK
|| type == BlockID.REDSTONE_REPEATER_OFF || type == BlockID.REDSTONE_REPEATER_OFF
|| type == BlockID.REDSTONE_REPEATER_ON || type == BlockID.REDSTONE_REPEATER_ON
@ -827,13 +844,13 @@ private void handleBlockRightClick(PlayerInteractEvent event) {
} }
if (wcfg.getBlacklist() != null) { if (wcfg.getBlacklist() != null) {
if(type != BlockID.CHEST if (player.isSneaking() // sneak + right clicking no longer activates blocks as of some recent version
|| (type != BlockID.CHEST
&& type != BlockID.DISPENSER && type != BlockID.DISPENSER
&& type != BlockID.FURNACE && type != BlockID.FURNACE
&& type != BlockID.BURNING_FURNACE && type != BlockID.BURNING_FURNACE
&& type != BlockID.BREWING_STAND && type != BlockID.BREWING_STAND
&& type != BlockID.ENCHANTMENT_TABLE && type != BlockID.ENCHANTMENT_TABLE)) {
&& type != BlockID.CAULDRON) {
if (!wcfg.getBlacklist().check( if (!wcfg.getBlacklist().check(
new ItemUseBlacklistEvent(plugin.wrapPlayer(player), toVector(block), new ItemUseBlacklistEvent(plugin.wrapPlayer(player), toVector(block),
item.getTypeId()), false, false)) { item.getTypeId()), false, false)) {
@ -956,7 +973,8 @@ private void handlePhysicalInteract(PlayerInteractEvent event) {
ApplicableRegionSet set = mgr.getApplicableRegions(pt); ApplicableRegionSet set = mgr.getApplicableRegions(pt);
LocalPlayer localPlayer = plugin.wrapPlayer(player); LocalPlayer localPlayer = plugin.wrapPlayer(player);
if (type == BlockID.STONE_PRESSURE_PLATE || type == BlockID.WOODEN_PRESSURE_PLATE) { if (type == BlockID.STONE_PRESSURE_PLATE || type == BlockID.WOODEN_PRESSURE_PLATE
|| type == BlockID.TRIPWIRE) {
if (!plugin.getGlobalRegionManager().hasBypass(player, world) if (!plugin.getGlobalRegionManager().hasBypass(player, world)
&& !set.canBuild(localPlayer) && !set.canBuild(localPlayer)
&& !set.allows(DefaultFlag.USE, localPlayer)) { && !set.allows(DefaultFlag.USE, localPlayer)) {