Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @EventHandler
- public void onEntityBlockChangeEvent(EntityBlockChangeEvent event) {
- testBlockBreak(event, event.getBlock());
- }
- @EventHandler
- public void onBlockBreak(BlockBreakEvent event) {
- testBlockBreak(event, event.getBlock());
- }
- private void testBlockBreak(Cancellable event, Block block) {
- final BlockFace[] directions = new BlockFace[]
- {
- BlockFace.NORTH, BlockFace.EAST, BlockFace.SOUTH, BlockFace.WEST
- };
- for (BlockFace blockFace : directions)
- {
- Util.info("Test 2");
- Block signBlock = block.getRelative(blockFace);
- if (signBlock.getType() == Material.WALL_SIGN)
- {
- Util.info("Found wall sign in " + blockFace + " direction");
- if (new org.bukkit.material.Sign(Material.WALL_SIGN, signBlock.getData()).getFacing() == blockFace) {
- Util.info("Sign is attached to broken block");
- Sign sign = (Sign) signBlock.getState();
- if (sign.getLine(0).equalsIgnoreCase("HELLO") || sign.getLine(0).equalsIgnoreCase("§b[ReadMe]") || sign.getLine(0).equalsIgnoreCase("§6[Help]") || sign.getLine(0).equalsIgnoreCase("§a[Info]"))
- {
- Util.info("Sign has trigger text");
- event.setCancelled(true);
- return;
- ` }
- }
- }
- }
- Block signBlock = block.getRelative(BlockFace.UP);
- if (signBlock.getType() == Material.SIGN_POST) {
- Util.info("Found sign post above");
- if (sign.getLine(0).equalsIgnoreCase("HELLO") || sign.getLine(0).equalsIgnoreCase("§b[ReadMe]") || sign.getLine(0).equalsIgnoreCase("§6[Help]") || sign.getLine(0).equalsIgnoreCase("§a[Info]"))
- {
- Util.info("Sign has trigger text");
- event.setCancelled(true);
- return;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement