Fix AntiBuild performing place checks for block state changes (#3914)

Bukkit sometimes decides that state changes are also a block placement. Work around this by comparing the previous block state with the new block type.

Fixes #3150.
This commit is contained in:
Josh Roy 2021-02-05 14:44:43 -05:00 committed by GitHub
parent 4e7f1377bf
commit 401fc4d2eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions

View File

@ -100,6 +100,11 @@ public class EssentialsAntiBuildListener implements Listener {
final Block block = event.getBlockPlaced();
final Material type = block.getType();
// Happens with blocks like eyes of ender, we shouldn't treat state changes as a block place.
if (type.equals(event.getBlockReplacedState().getType())) {
return;
}
if (prot.getSettingBool(AntiBuildConfig.disable_build) && !user.canBuild() && !metaPermCheck(user, "place", block)) {
if (ess.getSettings().warnOnBuildDisallow()) {
user.sendMessage(tl("antiBuildPlace", EssentialsAntiBuild.getNameForType(type)));