mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-11-23 03:05:16 +01:00
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:
parent
9782ea1ef9
commit
4753681b47
@ -18,10 +18,6 @@ public class LiquidsFlowingOutListener extends FlagListener {
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void onLiquidFlow(BlockFromToEvent e) {
|
||||
Block from = e.getBlock();
|
||||
if (!from.isLiquid()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Block to = e.getToBlock();
|
||||
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.
|
||||
|
@ -105,19 +105,6 @@ public class LiquidsFlowingOutListenerTest {
|
||||
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.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user