Commit 13a2e792 authored by Amosar's avatar Amosar

Re-add sign duplication fix

parent 80413b83
......@@ -10,6 +10,7 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockPhysicsEvent;
public class PlayerListener implements Listener {
......@@ -32,13 +33,6 @@ public class PlayerListener implements Listener {
if (checkRedStoneItems_1_13(block.getType())
|| checkRedStoneItemsOlderThan_1_13(block.getType())) {
cleanRedstone(block);
} else if (block.getType() == Material.getMaterial("SIGN")
|| block.getType() == Material.getMaterial("SIGN_POST")) {
BlockState blockState = block.getState();
Sign sign = (Sign) blockState;
if (checkSign(sign)) {
block.setType(Material.AIR);
}
}
}
}
......@@ -68,6 +62,20 @@ public class PlayerListener implements Listener {
}
}
//WorkAround for sign duplication glitch
@EventHandler(priority = EventPriority.HIGHEST)
public void onItemDrop(BlockPhysicsEvent e) {
if (e.getBlock().getType() == Material.getMaterial("SIGN")
|| e.getBlock().getType() == Material.getMaterial("SIGN_POST")) {
BlockState block = e.getBlock().getState();
Sign sign = (Sign) block;
if (checkSign(sign)) {
e.setCancelled(true);
e.getBlock().setType(Material.AIR);
}
}
}
private boolean checkSign(Sign sign) {
return (sign.getLine(0).equalsIgnoreCase(Main.getInstance().getConfig().getString("Sign.Line1")
.replace("&", "§"))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment