Skip to content

Commit

Permalink
fix: waterlogging a block does not revert the state upon rebuilding
Browse files Browse the repository at this point in the history
  • Loading branch information
Misat11 committed Jul 9, 2024
1 parent a2fb790 commit 69783ad
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.BlockState;
import org.bukkit.block.data.Waterlogged;
import org.bukkit.entity.*;
import org.bukkit.event.Cancellable;
import org.bukkit.event.EventHandler;
Expand Down Expand Up @@ -1211,7 +1212,15 @@ public void onPlaceLiquid(PlayerBucketEmptyEvent event) {

Block block = loc.getBlock();
if (game.getStatus() == GameStatus.RUNNING) {
if (block.getType() == Material.AIR || game.getRegion().isBlockAddedDuringGame(block.getLocation())) {
if (game.getRegion().isBlockAddedDuringGame(block.getLocation())) {
return;
}

if (!Main.isLegacy() && event.getBucket() == Material.WATER_BUCKET && event.getBlockClicked().getBlockData() instanceof Waterlogged) {
block = event.getBlockClicked();
game.getRegion().putOriginalBlock(block.getLocation(), block.getState());
game.getRegion().addBuiltDuringGame(block.getLocation());
} else if (block.getType() == Material.AIR) {
game.getRegion().addBuiltDuringGame(block.getLocation());
} else {
event.setCancelled(true);
Expand Down

0 comments on commit 69783ad

Please sign in to comment.