Skip to content

Commit fbf4a63

Browse files
chore/fix: use #getBlock in PlayerBucketEmptyEvent (#4651)
chore/fix: use #getBlock method for block retrieval in PlayerBucketEmptyEvent
1 parent 9abfa21 commit fbf4a63

File tree

1 file changed

+1
-18
lines changed

1 file changed

+1
-18
lines changed

Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEventListener.java

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,8 @@
8888
import org.bukkit.FluidCollisionMode;
8989
import org.bukkit.Material;
9090
import org.bukkit.block.Block;
91-
import org.bukkit.block.BlockFace;
9291
import org.bukkit.block.BlockState;
9392
import org.bukkit.block.Sign;
94-
import org.bukkit.block.data.Waterlogged;
9593
import org.bukkit.command.PluginCommand;
9694
import org.bukkit.entity.ArmorStand;
9795
import org.bukkit.entity.Boat;
@@ -1370,22 +1368,7 @@ public void onBoatPlace(EntityPlaceEvent event) {
13701368

13711369
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
13721370
public void onBucketEmpty(PlayerBucketEmptyEvent event) {
1373-
BlockFace bf = event.getBlockFace();
1374-
// Note: a month after Bukkit 1.14.4 released, they added the API method
1375-
// PlayerBucketEmptyEvent#getBlock(), which returns the block the
1376-
// bucket contents is going to be placed at. Currently we determine this
1377-
// block ourselves to retain compatibility with 1.13.
1378-
final Block block;
1379-
// if the block can be waterlogged, the event might waterlog the block
1380-
// sometimes
1381-
if (event.getBlockClicked().getBlockData() instanceof Waterlogged waterlogged
1382-
&& !waterlogged.isWaterlogged() && event.getBucket() != Material.LAVA_BUCKET) {
1383-
block = event.getBlockClicked();
1384-
} else {
1385-
block = event.getBlockClicked().getLocation()
1386-
.add(bf.getModX(), bf.getModY(), bf.getModZ())
1387-
.getBlock();
1388-
}
1371+
final Block block = event.getBlock();
13891372
Location location = BukkitUtil.adapt(block.getLocation());
13901373
PlotArea area = location.getPlotArea();
13911374
if (area == null) {

0 commit comments

Comments
 (0)