Protect against SignChangeEvent

This commit is contained in:
Olof Larsson 2016-06-17 13:38:45 +02:00
parent 7b7b189573
commit 91d0676bf8
No known key found for this signature in database
GPG Key ID: BBEF14F97DA52474

View File

@ -42,6 +42,7 @@ import org.bukkit.event.block.BlockPistonExtendEvent;
import org.bukkit.event.block.BlockPistonRetractEvent; import org.bukkit.event.block.BlockPistonRetractEvent;
import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.block.BlockSpreadEvent; import org.bukkit.event.block.BlockSpreadEvent;
import org.bukkit.event.block.SignChangeEvent;
import org.bukkit.event.entity.CreatureSpawnEvent; import org.bukkit.event.entity.CreatureSpawnEvent;
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason; import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
import org.bukkit.event.entity.EntityBreakDoorEvent; import org.bukkit.event.entity.EntityBreakDoorEvent;
@ -1423,6 +1424,16 @@ public class EngineMain extends Engine
event.setCancelled(true); event.setCancelled(true);
} }
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void blockBuild(SignChangeEvent event)
{
boolean verboose = ! isFake(event);
if (canPlayerBuildAt(event.getPlayer(), PS.valueOf(event.getBlock()), verboose)) return;
event.setCancelled(true);
}
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void blockBuild(BlockPistonExtendEvent event) public void blockBuild(BlockPistonExtendEvent event)
{ {