Fix bug with water in offhand and nether greenhouse

Fixes https://github.com/BentoBoxWorld/Greenhouses/issues/76
This commit is contained in:
tastybento 2021-02-17 12:43:39 -08:00
parent f2faeb71df
commit 29f04ef673
1 changed files with 6 additions and 1 deletions

View File

@ -69,7 +69,12 @@ public class GreenhouseEvents implements Listener {
.map(gh -> gh.getBiomeRecipe().getBiome()).map(NETHER_BIOMES::contains).orElse(false)) {
// Not in Nether, in a nether greenhouse
e.setCancelled(true);
e.getPlayer().getInventory().getItemInMainHand().setType(Material.BUCKET);
if (e.getPlayer().getInventory().getItemInMainHand().getType().equals(Material.WATER_BUCKET)) {
e.getPlayer().getInventory().getItemInMainHand().setType(Material.BUCKET);
} else if (e.getPlayer().getInventory().getItemInOffHand().getType().equals(Material.WATER_BUCKET)) {
e.getPlayer().getInventory().getItemInOffHand().setType(Material.BUCKET);
}
b.getWorld().spawnParticle(Particle.SMOKE_NORMAL, b.getLocation(), 10);
b.getWorld().playSound(b.getLocation(), Sound.ENTITY_GENERIC_EXTINGUISH_FIRE, 1F, 5F);
}