Skip to content

Commit

Permalink
Fix bug where water couldn't be placed outside of greenhouse.
Browse files Browse the repository at this point in the history
  • Loading branch information
tastybento committed Feb 1, 2021
1 parent b0a0ae6 commit 39a88a4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public void onPlayerInteractInNether(PlayerBucketEmptyEvent e) {
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);
Expand All @@ -93,7 +93,7 @@ public void onIceBreak(BlockBreakEvent e) {
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,8 @@ public void testOnIceBreakNotIce() {
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);
Expand All @@ -302,6 +304,8 @@ public void testOnIceBreakNotNetherNetherGreenhouse() {
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);
Expand Down

0 comments on commit 39a88a4

Please sign in to comment.