diff --git a/pom.xml b/pom.xml index 50ac88f78..59f040c70 100644 --- a/pom.xml +++ b/pom.xml @@ -84,6 +84,14 @@ opencsv 2.0 + + + + junit + junit + 4.13.2 + test + diff --git a/src/main/java/com/sk89q/worldguard/bukkit/WorldGuardBlockListener.java b/src/main/java/com/sk89q/worldguard/bukkit/WorldGuardBlockListener.java index 6c3e11120..0f846e635 100644 --- a/src/main/java/com/sk89q/worldguard/bukkit/WorldGuardBlockListener.java +++ b/src/main/java/com/sk89q/worldguard/bukkit/WorldGuardBlockListener.java @@ -18,11 +18,16 @@ */ package com.sk89q.worldguard.bukkit; -import static com.sk89q.worldguard.bukkit.BukkitUtil.dropSign; -import static com.sk89q.worldguard.bukkit.BukkitUtil.toVector; - -import java.util.logging.Logger; - +import com.sk89q.worldedit.Vector; +import com.sk89q.worldedit.blocks.BlockType; +import com.sk89q.worldedit.blocks.ItemType; +import com.sk89q.worldguard.LocalPlayer; +import com.sk89q.worldguard.blacklist.events.BlockBreakBlacklistEvent; +import com.sk89q.worldguard.blacklist.events.BlockPlaceBlacklistEvent; +import com.sk89q.worldguard.blacklist.events.DestroyWithBlacklistEvent; +import com.sk89q.worldguard.protection.ApplicableRegionSet; +import com.sk89q.worldguard.protection.flags.DefaultFlag; +import com.sk89q.worldguard.protection.managers.RegionManager; import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.World; @@ -30,36 +35,15 @@ import org.bukkit.entity.Player; import org.bukkit.event.Event; import org.bukkit.event.Event.Priority; -import org.bukkit.event.block.BlockBreakEvent; -import org.bukkit.event.block.BlockBurnEvent; -import org.bukkit.event.block.BlockDamageEvent; -import org.bukkit.event.block.BlockFadeEvent; -import org.bukkit.event.block.BlockFormEvent; -import org.bukkit.event.block.BlockFromToEvent; -import org.bukkit.event.block.BlockIgniteEvent; -import org.bukkit.event.block.BlockListener; -import org.bukkit.event.block.BlockPhysicsEvent; -import org.bukkit.event.block.BlockPistonExtendEvent; -import org.bukkit.event.block.BlockPistonRetractEvent; -import org.bukkit.event.block.BlockPlaceEvent; -import org.bukkit.event.block.BlockRedstoneEvent; -import org.bukkit.event.block.BlockSpreadEvent; -import org.bukkit.event.block.LeavesDecayEvent; -import org.bukkit.event.block.SignChangeEvent; +import org.bukkit.event.block.*; import org.bukkit.event.block.BlockIgniteEvent.IgniteCause; import org.bukkit.inventory.ItemStack; import org.bukkit.plugin.PluginManager; -import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.blocks.BlockType; -import com.sk89q.worldedit.blocks.ItemType; -import com.sk89q.worldguard.LocalPlayer; -import com.sk89q.worldguard.blacklist.events.BlockBreakBlacklistEvent; -import com.sk89q.worldguard.blacklist.events.BlockPlaceBlacklistEvent; -import com.sk89q.worldguard.blacklist.events.DestroyWithBlacklistEvent; -import com.sk89q.worldguard.protection.ApplicableRegionSet; -import com.sk89q.worldguard.protection.flags.DefaultFlag; -import com.sk89q.worldguard.protection.managers.RegionManager; +import java.util.logging.Logger; + +import static com.sk89q.worldguard.bukkit.BukkitUtil.dropSign; +import static com.sk89q.worldguard.bukkit.BukkitUtil.toVector; /** * The listener for block events. @@ -482,6 +466,14 @@ public void onBlockPhysics(BlockPhysicsEvent event) { return; } + //Block Sign Physics + if(event.getBlock().getTypeId() == 63 || event.getBlock().getTypeId() == 68) { + if (wcfg.useRegions && !this.plugin.getGlobalRegionManager().allows(DefaultFlag.SIGN_UPDATE, event.getBlock().getLocation())) { + event.setCancelled(true); + return; + } + } + int id = event.getChangedTypeId(); if (id == 13 && wcfg.noPhysicsGravel) { diff --git a/src/main/java/com/sk89q/worldguard/protection/flags/DefaultFlag.java b/src/main/java/com/sk89q/worldguard/protection/flags/DefaultFlag.java index c13eb4536..f9ba80a05 100644 --- a/src/main/java/com/sk89q/worldguard/protection/flags/DefaultFlag.java +++ b/src/main/java/com/sk89q/worldguard/protection/flags/DefaultFlag.java @@ -52,6 +52,7 @@ public final class DefaultFlag { public static final StateFlag ICE_MELT = new StateFlag("ice-melt", true); public static final StateFlag MUSHROOMS = new StateFlag("mushroom-growth", true); public static final StateFlag LEAF_DECAY = new StateFlag("leaf-decay", true); + public static final StateFlag SIGN_UPDATE = new StateFlag("sign-update", true); //Re-added from Jilm's fork public static final StateFlag ENDER_BUILD = new StateFlag("enderman-grief", true); public static final StateFlag INVINCIBILITY = new StateFlag("invincible", false); public static final StateFlag ENTRY = new StateFlag("entry", true); @@ -91,7 +92,7 @@ public final class DefaultFlag { SNOW_FALL, SNOW_MELT, ICE_FORM, ICE_MELT, MUSHROOMS, LEAF_DECAY, FIRE_SPREAD, LAVA_FIRE, LAVA_FLOW, WATER_FLOW, TELE_LOC, TELE_PERM, SPAWN_LOC, SPAWN_PERM, - BLOCKED_CMDS, ALLOWED_CMDS, PRICE, BUYABLE, + BLOCKED_CMDS, ALLOWED_CMDS, PRICE, BUYABLE, SIGN_UPDATE }; static {