mirror of
https://github.com/BentoBoxWorld/Greenhouses.git
synced 2025-02-22 14:52:03 +01:00
Fix bug where water couldn't be placed outside of greenhouse.
This commit is contained in:
parent
b0a0ae6e88
commit
39a88a4f84
@ -66,7 +66,7 @@ public class GreenhouseEvents implements Listener {
|
||||
b.setType(Material.WATER);
|
||||
} else if (!e.getPlayer().getWorld().getEnvironment().equals(World.Environment.NETHER)
|
||||
&& addon.getManager().getMap().getGreenhouse(b.getLocation())
|
||||
.map(gh -> gh.getBiomeRecipe().getBiome()).map(NETHER_BIOMES::contains).orElse(true)) {
|
||||
.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);
|
||||
@ -93,7 +93,7 @@ public class GreenhouseEvents implements Listener {
|
||||
b.setType(Material.WATER);
|
||||
} else if (!e.getPlayer().getWorld().getEnvironment().equals(World.Environment.NETHER)
|
||||
&& addon.getManager().getMap().getGreenhouse(b.getLocation())
|
||||
.map(gh -> gh.getBiomeRecipe().getBiome()).map(NETHER_BIOMES::contains).orElse(true)) {
|
||||
.map(gh -> gh.getBiomeRecipe().getBiome()).map(NETHER_BIOMES::contains).orElse(false)) {
|
||||
// Not in Nether, in a nether greenhouse
|
||||
e.setCancelled(true);
|
||||
b.setType(Material.AIR);
|
||||
|
@ -285,6 +285,8 @@ public class GreenhouseEventsTest {
|
||||
Block block = mock(Block.class);
|
||||
when(block.getType()).thenReturn(Material.ACACIA_BOAT);
|
||||
when(block.getWorld()).thenReturn(world);
|
||||
// Nether gh
|
||||
when(block.getLocation()).thenReturn(location2);
|
||||
BlockBreakEvent e = new BlockBreakEvent(block, player);
|
||||
ghe.onIceBreak(e);
|
||||
verify(block, never()).setType(Material.WATER);
|
||||
@ -302,6 +304,8 @@ public class GreenhouseEventsTest {
|
||||
Block block = mock(Block.class);
|
||||
when(block.getType()).thenReturn(Material.ICE);
|
||||
when(block.getWorld()).thenReturn(world);
|
||||
// Nether gh
|
||||
when(block.getLocation()).thenReturn(location2);
|
||||
BlockBreakEvent e = new BlockBreakEvent(block, player);
|
||||
ghe.onIceBreak(e);
|
||||
verify(block).setType(Material.AIR);
|
||||
|
Loading…
Reference in New Issue
Block a user