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)
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
public void onChange(BlockFromToEvent event) {
|
public void onChange(BlockFromToEvent event) {
|
||||||
Block from = event.getBlock();
|
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();
|
Block to = event.getToBlock();
|
||||||
Location tLocation = BukkitUtil.getLocation(to.getLocation());
|
Location tLocation = BukkitUtil.getLocation(to.getLocation());
|
||||||
PlotArea area = tLocation.getPlotArea();
|
PlotArea area = tLocation.getPlotArea();
|
||||||
@ -1446,7 +1458,6 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Plot plot = area.getOwnedPlot(tLocation);
|
Plot plot = area.getOwnedPlot(tLocation);
|
||||||
Location fLocation = BukkitUtil.getLocation(from.getLocation());
|
|
||||||
if (plot != null) {
|
if (plot != null) {
|
||||||
if (plot.getFlag(DisablePhysicsFlag.class)) {
|
if (plot.getFlag(DisablePhysicsFlag.class)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
@ -1456,12 +1467,8 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!plot.getFlag(LiquidFlowFlag.class)) {
|
if (!plot.getFlag(LiquidFlowFlag.class) && event.getBlock().isLiquid()) {
|
||||||
switch (to.getType()) {
|
event.setCancelled(true);
|
||||||
case WATER:
|
|
||||||
case LAVA:
|
|
||||||
event.setCancelled(true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else if (!area.contains(fLocation.getX(), fLocation.getZ()) || !Objects
|
} else if (!area.contains(fLocation.getX(), fLocation.getZ()) || !Objects
|
||||||
.equals(null, area.getOwnedPlot(fLocation))) {
|
.equals(null, area.getOwnedPlot(fLocation))) {
|
||||||
|
Loading…
Reference in New Issue
Block a user