mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-12-24 16:58:50 +01:00
Fix liquid-flow
This commit is contained in:
parent
f6332d2cd9
commit
616d22ceac
@ -1439,6 +1439,18 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onChange(BlockFromToEvent event) {
|
||||
Block from = event.getBlock();
|
||||
|
||||
// Check liquid flow flag inside of origin plot too
|
||||
final Location fLocation = BukkitUtil.getLocation(from.getLocation());
|
||||
final PlotArea fromArea = fLocation.getPlotArea();
|
||||
if (fromArea != null) {
|
||||
final Plot plot = fromArea.getOwnedPlot(fLocation);
|
||||
if (plot != null && !plot.getFlag(LiquidFlowFlag.class) && event.getBlock().isLiquid()) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Block to = event.getToBlock();
|
||||
Location tLocation = BukkitUtil.getLocation(to.getLocation());
|
||||
PlotArea area = tLocation.getPlotArea();
|
||||
@ -1446,7 +1458,6 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
return;
|
||||
}
|
||||
Plot plot = area.getOwnedPlot(tLocation);
|
||||
Location fLocation = BukkitUtil.getLocation(from.getLocation());
|
||||
if (plot != null) {
|
||||
if (plot.getFlag(DisablePhysicsFlag.class)) {
|
||||
event.setCancelled(true);
|
||||
@ -1456,12 +1467,8 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
if (!plot.getFlag(LiquidFlowFlag.class)) {
|
||||
switch (to.getType()) {
|
||||
case WATER:
|
||||
case LAVA:
|
||||
event.setCancelled(true);
|
||||
}
|
||||
if (!plot.getFlag(LiquidFlowFlag.class) && event.getBlock().isLiquid()) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
} else if (!area.contains(fLocation.getX(), fLocation.getZ()) || !Objects
|
||||
.equals(null, area.getOwnedPlot(fLocation))) {
|
||||
|
Loading…
Reference in New Issue
Block a user