Add waterlogging check for buckets (#1156)

Co-authored-by: Adam <Jikoo.Games@gmail.com>
This commit is contained in:
Erik Eide 2020-12-16 21:32:43 +01:00 committed by GitHub
parent c235bb0a00
commit 329bfb54de
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1461,6 +1461,15 @@ class PlayerEventHandler implements Listener
Block block = bucketEvent.getBlockClicked().getRelative(bucketEvent.getBlockFace());
int minLavaDistance = 10;
// Fixes #1155:
// Prevents waterlogging blocks placed on a claim's edge.
// Waterlogging a block affects the clicked block, and NOT the adjacent location relative to it.
if (bucketEvent.getBucket() == Material.WATER_BUCKET
&& bucketEvent.getBlockClicked().getBlockData() instanceof Waterlogged)
{
block = bucketEvent.getBlockClicked();
}
//make sure the player is allowed to build at the location
String noBuildReason = instance.allowBuild(player, block.getLocation(), Material.WATER);
if (noBuildReason != null)