Skip to content

Commit

Permalink
Fixes Lava Duplication Glitch (#1964)
Browse files Browse the repository at this point in the history
Due to the fact, that Obsidian Scooping uses one tick delay to remove obsidian, a player with a bucket in hand and offhand duplicated lava. 
To avoid that, added an extra check that ignores the interact event if a player holds a bucket in both hands, and interacted hand is offhand.

Fixes #1963
  • Loading branch information
BONNe authored Apr 11, 2022
1 parent 4341c28 commit 9f163f0
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import org.bukkit.event.EventPriority;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.ItemStack;

import world.bentobox.bentobox.BentoBox;
Expand Down Expand Up @@ -54,6 +55,16 @@ boolean onPlayerInteract(final PlayerInteractEvent e) {
|| e.getClickedBlock().getRelative(e.getBlockFace()).getType().equals(Material.WATER)) {
return false;
}

if (Material.BUCKET.equals(e.getPlayer().getInventory().getItemInOffHand().getType()) &&
Material.BUCKET.equals(e.getPlayer().getInventory().getItemInMainHand().getType()) &&
EquipmentSlot.OFF_HAND.equals(e.getHand()))
{
// If player is holding bucket in both hands, then allow to interact only with main hand.
// Prevents lava duplication glitch.
return false;
}

return lookForLava(e);
}

Expand Down

0 comments on commit 9f163f0

Please sign in to comment.