mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2025-02-10 17:31:32 +01:00
Fixes Lava Duplication Glitch (#1964)
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
This commit is contained in:
parent
4341c28aca
commit
9f163f0572
@ -15,6 +15,7 @@ import org.bukkit.event.EventHandler;
|
|||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.block.Action;
|
import org.bukkit.event.block.Action;
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
|
import org.bukkit.inventory.EquipmentSlot;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import world.bentobox.bentobox.BentoBox;
|
import world.bentobox.bentobox.BentoBox;
|
||||||
@ -54,6 +55,16 @@ public class ObsidianScoopingListener extends FlagListener {
|
|||||||
|| e.getClickedBlock().getRelative(e.getBlockFace()).getType().equals(Material.WATER)) {
|
|| e.getClickedBlock().getRelative(e.getBlockFace()).getType().equals(Material.WATER)) {
|
||||||
return false;
|
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);
|
return lookForLava(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user