Fixes flow out of water logged blocks like slabs.

The check `isLiquid()` does not work for water logged blocks like slabs
or fences so it was possible for players to get liquids outside of the
the island.

https://github.com/BentoBoxWorld/BentoBox/issues/1034
This commit is contained in:
tastybento 2019-11-17 17:45:51 -08:00
parent 9782ea1ef9
commit 4753681b47
2 changed files with 0 additions and 17 deletions

View File

@ -18,10 +18,6 @@ public class LiquidsFlowingOutListener extends FlagListener {
@EventHandler(priority = EventPriority.LOWEST) @EventHandler(priority = EventPriority.LOWEST)
public void onLiquidFlow(BlockFromToEvent e) { public void onLiquidFlow(BlockFromToEvent e) {
Block from = e.getBlock(); Block from = e.getBlock();
if (!from.isLiquid()) {
return;
}
Block to = e.getToBlock(); Block to = e.getToBlock();
if (!getIWM().inWorld(from.getLocation()) || Flags.LIQUIDS_FLOWING_OUT.isSetForWorld(from.getWorld())) { if (!getIWM().inWorld(from.getLocation()) || Flags.LIQUIDS_FLOWING_OUT.isSetForWorld(from.getWorld())) {
// We do not want to run any check if this is not the right world or if it is allowed. // We do not want to run any check if this is not the right world or if it is allowed.

View File

@ -105,19 +105,6 @@ public class LiquidsFlowingOutListenerTest {
when(islandsManager.getProtectedIslandAt(toLocation)).thenReturn(Optional.empty()); when(islandsManager.getProtectedIslandAt(toLocation)).thenReturn(Optional.empty());
} }
/**
* Asserts that the event is never cancelled when the 'from' block is not liquid.
*/
@Test
public void testFromIsNotLiquid() {
// The 'from' block is not liquid
when(from.isLiquid()).thenReturn(false);
// Run
new LiquidsFlowingOutListener().onLiquidFlow(event);
assertFalse(event.isCancelled());
}
/** /**
* Asserts that the event is never cancelled when the 'from' block is not in the world. * Asserts that the event is never cancelled when the 'from' block is not in the world.
*/ */