Fix respawn anchor explosion protection (#3778)

Fixes #3723, where respawn anchors explode at charges > 0 when glowstone isn't in the players hand, or at charges = 4 on right click regardless of item.
This commit is contained in:
Josh Roy 2020-12-02 14:43:01 -05:00 committed by GitHub
parent 2342d53dba
commit f5d5ed9844
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -30,7 +30,7 @@ public class EssentialsProtectBlockListener_1_16_R1 implements Listener {
final World.Environment environment = block.getWorld().getEnvironment();
if (block.getType() == Material.RESPAWN_ANCHOR && !environment.equals(World.Environment.NETHER)) {
final RespawnAnchor respawnAnchor = (RespawnAnchor) block.getBlockData();
if (respawnAnchor.getCharges() == respawnAnchor.getMaximumCharges()) {
if ((respawnAnchor.getCharges() > 0 && (event.getItem() == null || event.getItem().getType() != Material.GLOWSTONE)) || respawnAnchor.getCharges() == respawnAnchor.getMaximumCharges()) {
event.setCancelled(prot.getSettingBool(ProtectConfig.prevent_respawn_anchor_explosion));
}
}