mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 05:06:44 +01:00
Fixes #900
This commit is contained in:
parent
7a97c69d4f
commit
7d8893b5d7
@ -753,14 +753,16 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
public void onChange(final BlockFromToEvent e) {
|
public void onChange(final BlockFromToEvent e) {
|
||||||
final Block b = e.getBlock();
|
Block from = e.getBlock();
|
||||||
Location loc = BukkitUtil.getLocation(b.getLocation());
|
Block to = e.getToBlock();
|
||||||
PlotArea area = loc.getPlotArea();
|
Location tloc = BukkitUtil.getLocation(to.getLocation());
|
||||||
|
PlotArea area = tloc.getPlotArea();
|
||||||
if (area == null) {
|
if (area == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Plot plot = area.getOwnedPlot(loc);
|
Plot plot = area.getOwnedPlot(tloc);
|
||||||
if (plot == null || FlagManager.isPlotFlagTrue(plot, "disable-physics")) {
|
Location floc = BukkitUtil.getLocation(from.getLocation());
|
||||||
|
if (!area.contains(floc.getX(), floc.getZ()) || !Objects.equals(plot, area.getOwnedPlot(floc)) || (plot != null && FlagManager.isPlotFlagTrue(plot, "disable-physics"))) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user