Compare commits
3 Commits
6e3639ce16
...
d1b76309f6
Author | SHA1 | Date |
---|---|---|
Phillipp Glanz | d1b76309f6 | |
renovate[bot] | c57d784df7 | |
TheMeinerLP | 8d55304242 |
|
@ -366,7 +366,7 @@ public class BlockEventListener implements Listener {
|
|||
return;
|
||||
}
|
||||
Plot plot = area.getPlot(location);
|
||||
if (plot != null) {
|
||||
if (plot != null && !plot.isMerging()) {
|
||||
BukkitPlayer plotPlayer = BukkitUtil.adapt(player);
|
||||
// == rather than <= as we only care about the "ground level" not being destroyed
|
||||
if (event.getBlock().getY() == area.getMinGenHeight()) {
|
||||
|
|
|
@ -1245,6 +1245,32 @@ public class Plot {
|
|||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the plot into merging process
|
||||
*/
|
||||
public void setMerging() {
|
||||
for (Plot plot : this.getConnectedPlots()) {
|
||||
plot.setMeta("merging", true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the current state of merging process
|
||||
*/
|
||||
public Boolean isMerging() {
|
||||
Boolean value = (Boolean) this.getMeta("merging");
|
||||
return value != null && value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the merging process
|
||||
*/
|
||||
public void removeMerging() {
|
||||
for (Plot plot : this.getConnectedPlots()) {
|
||||
plot.deleteMeta("merging");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Decrement the number of tracked tasks this plot is running<br>
|
||||
* - Used to track/limit the number of things a player can do on the plot at once
|
||||
|
|
|
@ -591,6 +591,8 @@ public final class PlotModificationManager {
|
|||
Plot other = current.getRelative(Direction.NORTH);
|
||||
if (other != null && other.isOwner(uuid) && (other.getBasePlot(false).equals(current.getBasePlot(false))
|
||||
|| (plots = other.getConnectedPlots()).size() <= max && frontier.addAll(plots) && (max -= plots.size()) != -1)) {
|
||||
current.setMerging();
|
||||
other.setMerging();
|
||||
current.mergePlot(other, removeRoads, queue);
|
||||
merged.add(current.getId());
|
||||
merged.add(other.getId());
|
||||
|
@ -602,12 +604,16 @@ public final class PlotModificationManager {
|
|||
ids.add(other.getId());
|
||||
this.plot.getManager().finishPlotMerge(ids, queue);
|
||||
}
|
||||
current.removeMerging();
|
||||
other.removeMerging();
|
||||
}
|
||||
}
|
||||
if (max >= 0 && (dir == Direction.ALL || dir == Direction.EAST) && !current.isMerged(Direction.EAST)) {
|
||||
Plot other = current.getRelative(Direction.EAST);
|
||||
if (other != null && other.isOwner(uuid) && (other.getBasePlot(false).equals(current.getBasePlot(false))
|
||||
|| (plots = other.getConnectedPlots()).size() <= max && frontier.addAll(plots) && (max -= plots.size()) != -1)) {
|
||||
current.setMerging();
|
||||
other.setMerging();
|
||||
current.mergePlot(other, removeRoads, queue);
|
||||
merged.add(current.getId());
|
||||
merged.add(other.getId());
|
||||
|
@ -619,12 +625,16 @@ public final class PlotModificationManager {
|
|||
ids.add(other.getId());
|
||||
this.plot.getManager().finishPlotMerge(ids, queue);
|
||||
}
|
||||
current.removeMerging();
|
||||
other.removeMerging();
|
||||
}
|
||||
}
|
||||
if (max >= 0 && (dir == Direction.ALL || dir == Direction.SOUTH) && !current.isMerged(Direction.SOUTH)) {
|
||||
Plot other = current.getRelative(Direction.SOUTH);
|
||||
if (other != null && other.isOwner(uuid) && (other.getBasePlot(false).equals(current.getBasePlot(false))
|
||||
|| (plots = other.getConnectedPlots()).size() <= max && frontier.addAll(plots) && (max -= plots.size()) != -1)) {
|
||||
current.setMerging();
|
||||
other.setMerging();
|
||||
current.mergePlot(other, removeRoads, queue);
|
||||
merged.add(current.getId());
|
||||
merged.add(other.getId());
|
||||
|
@ -636,12 +646,16 @@ public final class PlotModificationManager {
|
|||
ids.add(other.getId());
|
||||
this.plot.getManager().finishPlotMerge(ids, queue);
|
||||
}
|
||||
current.removeMerging();
|
||||
other.removeMerging();
|
||||
}
|
||||
}
|
||||
if (max >= 0 && (dir == Direction.ALL || dir == Direction.WEST) && !current.isMerged(Direction.WEST)) {
|
||||
Plot other = current.getRelative(Direction.WEST);
|
||||
if (other != null && other.isOwner(uuid) && (other.getBasePlot(false).equals(current.getBasePlot(false))
|
||||
|| (plots = other.getConnectedPlots()).size() <= max && frontier.addAll(plots) && (max -= plots.size()) != -1)) {
|
||||
current.setMerging();
|
||||
other.setMerging();
|
||||
current.mergePlot(other, removeRoads, queue);
|
||||
merged.add(current.getId());
|
||||
merged.add(other.getId());
|
||||
|
@ -653,6 +667,8 @@ public final class PlotModificationManager {
|
|||
ids.add(other.getId());
|
||||
this.plot.getManager().finishPlotMerge(ids, queue);
|
||||
}
|
||||
current.removeMerging();
|
||||
other.removeMerging();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ shadow = "8.1.1"
|
|||
grgit = "4.1.1"
|
||||
spotless = "6.25.0"
|
||||
nexus = "2.0.0"
|
||||
runPaper = "2.2.3"
|
||||
runPaper = "2.2.4"
|
||||
|
||||
[libraries]
|
||||
# Platform expectations
|
||||
|
|
Loading…
Reference in New Issue