@@ -58,8 +58,8 @@ boolean onPlayerInteract(final PlayerInteractEvent e) {
58
58
}
59
59
60
60
if (Material .BUCKET .equals (e .getPlayer ().getInventory ().getItemInOffHand ().getType ()) &&
61
- Material .BUCKET .equals (e .getPlayer ().getInventory ().getItemInMainHand ().getType ()) &&
62
- EquipmentSlot .OFF_HAND .equals (e .getHand ()))
61
+ Material .BUCKET .equals (e .getPlayer ().getInventory ().getItemInMainHand ().getType ())
62
+ && EquipmentSlot .OFF_HAND .equals (e .getHand ()))
63
63
{
64
64
// If player is holding bucket in both hands, then allow to interact only with main hand.
65
65
// Prevents lava duplication glitch.
@@ -105,16 +105,11 @@ private boolean lookForLava(PlayerInteractEvent e) {
105
105
}
106
106
107
107
private void givePlayerLava (Player player , Block b , ItemStack bucket ) {
108
- if (bucket .getAmount () == 1 ) {
109
- // Needs some special handling when there is only 1 bucket in the stack
110
- bucket = new ItemStack (Material .LAVA_BUCKET );
111
- } else {
112
- // Remove one empty bucket and add a lava bucket to the player's inventory
113
- bucket .setAmount (bucket .getAmount () - 1 );
114
- HashMap <Integer , ItemStack > map = player .getInventory ().addItem (new ItemStack (Material .LAVA_BUCKET ));
115
- if (!map .isEmpty ()) {
116
- map .values ().forEach (i -> player .getWorld ().dropItem (player .getLocation (), i ));
117
- }
108
+ // Remove one empty bucket and add a lava bucket to the player's inventory
109
+ bucket .setAmount (bucket .getAmount () - 1 );
110
+ HashMap <Integer , ItemStack > map = player .getInventory ().addItem (new ItemStack (Material .LAVA_BUCKET ));
111
+ if (!map .isEmpty ()) {
112
+ map .values ().forEach (i -> player .getWorld ().dropItem (player .getLocation (), i ));
118
113
}
119
114
// Set block to air only after giving bucket
120
115
b .setType (Material .AIR );
0 commit comments