mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-06-25 02:04:44 +02:00
Fix PlotDeleteEvent and PlotMergeEvent not being called.
Replaced current PlotMergeEvent with PlotAutoMergeEvent (called when a plot is merged on /plot auto). And made PlotMergeEvent be called for /plot merge command.
This commit is contained in:
@ -791,9 +791,18 @@ public class Plot {
|
||||
}
|
||||
|
||||
public boolean clear(boolean checkRunning, final boolean isDelete, final Runnable whenDone) {
|
||||
if (checkRunning && this.getRunning() != 0 || !EventUtil.manager.callClear(this)) {
|
||||
if (checkRunning && this.getRunning() != 0) {
|
||||
return false;
|
||||
}
|
||||
if (isDelete) {
|
||||
if(!EventUtil.manager.callDelete(this)) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if(!EventUtil.manager.callClear(this)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
final HashSet<RegionWrapper> regions = this.getRegions();
|
||||
final Set<Plot> plots = this.getConnectedPlots();
|
||||
final ArrayDeque<Plot> queue = new ArrayDeque<>(plots);
|
||||
@ -2156,6 +2165,9 @@ public class Plot {
|
||||
if (this.owner == null) {
|
||||
return false;
|
||||
}
|
||||
if(!EventUtil.manager.callMerge(this, dir, max)) {
|
||||
return false;
|
||||
}
|
||||
HashSet<Plot> visited = new HashSet<>();
|
||||
HashSet<PlotId> merged = new HashSet<>();
|
||||
Set<Plot> connected = this.getConnectedPlots();
|
||||
|
@ -808,7 +808,7 @@ public abstract class PlotArea {
|
||||
final PlotId pos2 = plotIds.get(plotIds.size() - 1);
|
||||
final PlotManager manager = getPlotManager();
|
||||
|
||||
final boolean result = EventUtil.manager.callMerge(getPlotAbs(pos1), plotIds);
|
||||
final boolean result = EventUtil.manager.callAutoMerge(getPlotAbs(pos1), plotIds);
|
||||
if (!result) {
|
||||
return false;
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ public abstract class EventUtil {
|
||||
|
||||
public abstract boolean callClear(Plot plot);
|
||||
|
||||
public abstract void callDelete(Plot plot);
|
||||
public abstract boolean callDelete(Plot plot);
|
||||
|
||||
public abstract boolean callFlagAdd(Flag flag, Plot plot);
|
||||
|
||||
@ -45,7 +45,9 @@ public abstract class EventUtil {
|
||||
|
||||
public abstract boolean callFlagRemove(Flag<?> flag, Object value, PlotCluster cluster);
|
||||
|
||||
public abstract boolean callMerge(Plot plot, List<PlotId> plots);
|
||||
public abstract boolean callMerge(Plot plot, int dir, int max);
|
||||
|
||||
public abstract boolean callAutoMerge(Plot plot, List<PlotId> plots);
|
||||
|
||||
public abstract boolean callUnlink(PlotArea area, List<PlotId> plots);
|
||||
|
||||
|
Reference in New Issue
Block a user