Skip to content

Instantly share code, notes, and snippets.

@Jozeth
Jozeth / blockSignBreak.java
Last active December 20, 2015 10:19
This code will stop signs from being destroyed if they contain a specific variable. Also this stops the surrounding blocks from being destroyed.
@EventHandler
public void blockSignBreak(BlockBreakEvent event) {
if(event.getBlock().getState() instanceof Sign) {
Sign sign = (Sign) event.getBlock().getState();
// Stop the destruction of signs all together, if they contain stuff on each line
if(sign.getLine(0).contains("VARIABLE")) {
// if(sign.getLine(LINE).equalsIgnoreCase(anotherString)) {
/*
* Sign lines:
* 0 = First line