use of org.bukkit.block.data.type.WallSign in project XPKeeper by eccentricdevotion.
the class XPKArrgghh method onEntityExplode.
@EventHandler
public void onEntityExplode(EntityExplodeEvent event) {
if (event.isCancelled()) {
return;
}
String firstline = plugin.getConfig().getString("firstline");
List<Block> blockList = new ArrayList<>(event.blockList());
blockList.forEach((block) -> {
if (Tag.SIGNS.isTagged(block.getType())) {
Sign sign = (Sign) block.getState();
String line0 = ChatColor.stripColor(sign.getLine(0));
if (line0.equalsIgnoreCase("[" + firstline + "]")) {
event.blockList().remove(block);
if (Tag.STANDING_SIGNS.isTagged(block.getType())) {
Block blockdown = block.getRelative(BlockFace.DOWN, 1);
event.blockList().remove(blockdown);
}
if (Tag.WALL_SIGNS.isTagged(block.getType())) {
WallSign data = (WallSign) block.getBlockData();
Block blockbehind = block.getRelative(data.getFacing().getOppositeFace(), 1);
event.blockList().remove(blockbehind);
}
}
}
});
}
use of org.bukkit.block.data.type.WallSign in project XPKeeper by eccentricdevotion.
the class XPKBreak method onPlayerBreakSign.
@EventHandler
public void onPlayerBreakSign(BlockBreakEvent event) {
Player player = event.getPlayer();
Block block = event.getBlock();
Material blockType = block.getType();
if (Tag.SIGNS.isTagged(blockType)) {
if (plugin.getConfig().getBoolean("allow_raids")) {
raidSign(block, event, player);
} else {
// check the text on the sign
xpkSign(block, event, player, "messages.use_command");
}
} else {
// check if breaking block underneath or behind sign
for (BlockFace bf : faces) {
Block faceBlock = block.getRelative(bf);
Material faceBlockType = faceBlock.getType();
if (Tag.WALL_SIGNS.isTagged(faceBlockType)) {
BlockFace attachedFace = ((WallSign) faceBlock.getState().getBlockData()).getFacing();
if (bf.equals(attachedFace)) {
xpkSign(faceBlock, event, player, "messages.no_grief");
}
}
if (bf.equals(BlockFace.UP) && Tag.STANDING_SIGNS.isTagged(faceBlockType)) {
xpkSign(faceBlock, event, player, "messages.no_grief");
}
}
}
}
Aggregations