mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-21 11:45:19 +01:00
Updated Printing the furthest plot (markdown)
parent
5607785322
commit
4aa853e2cf
@ -1,24 +1,34 @@
|
||||
## This guide is for PlotSquared versions <= 1.12.2
|
||||
``` javascript
|
||||
/*
|
||||
* Script to find the furthest plot from origin in a world:
|
||||
* - /plot debugexec runasync furthest.js <plotworld>
|
||||
*/
|
||||
|
||||
if (PS.isPlotWorld("%s0")) {
|
||||
plots=PS.getPlotAreaByString("l").getPlots();
|
||||
iter=plots.iterator();
|
||||
max=0;
|
||||
while(iter.hasNext()){
|
||||
plot=iter.next();
|
||||
if(t=Math.max(Math.abs(plot.id.x),Math.abs(plot.id.y))>max){
|
||||
max=t;
|
||||
maxPlot=plot
|
||||
if (PS.hasPlotArea("%s0")) {
|
||||
var plots = PS.getAllPlotsRaw().get("%s0").values().toArray();
|
||||
var max = 0;
|
||||
var maxplot;
|
||||
for (var i in plots) {
|
||||
var plot = plots[i];
|
||||
if (plot.x > max) {
|
||||
max = plot.x;
|
||||
maxplot = plot;
|
||||
}
|
||||
};
|
||||
PS.class.static.log(maxPlot);
|
||||
}
|
||||
else {
|
||||
if (plot.y > max) {
|
||||
max = plot.y;
|
||||
maxplot = plot;
|
||||
}
|
||||
if (-plot.x > max) {
|
||||
max = -plot.x;
|
||||
maxplot = plot;
|
||||
}
|
||||
if (-plot.y > max) {
|
||||
max = -plot.y;
|
||||
maxplot = plot;
|
||||
}
|
||||
}
|
||||
PS.class.static.log(plot);
|
||||
} else {
|
||||
PlotPlayer.sendMessage("Usage: /plot debugexec runasync furthest.js <plotworld>");
|
||||
}
|
||||
```
|
Loading…
Reference in New Issue
Block a user