Updated Printing the furthest plot (markdown)

NotMyFault 2020-02-16 18:06:20 +01:00
parent 5607785322
commit 4aa853e2cf
1 changed files with 24 additions and 14 deletions

@ -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>");
}
```