Updated Printing the furthest plot (markdown)

Jesse Boyd 2016-12-09 23:48:31 +11:00
parent fa056bce63
commit 83417e2a4d

@ -1,5 +1,3 @@
Download: https://www.dropbox.com/s/h544xf6susqlonf/furthest.js?dl=0
``` javascript ``` javascript
/* /*
* Script to find the furthest plot from origin in a world: * Script to find the furthest plot from origin in a world:
@ -7,29 +5,17 @@ Download: https://www.dropbox.com/s/h544xf6susqlonf/furthest.js?dl=0
*/ */
if (PS.isPlotWorld("%s0")) { if (PS.isPlotWorld("%s0")) {
var plots = PS.getAllPlotsRaw().get("%s0").values().toArray(); plots=PS.getPlotAreaByString("l").getPlots();
var max = 0; iter=plots.iterator();
var maxplot; max=0;
for (var i in plots) { while(iter.hasNext()){
var plot = plots[i]; plot=iter.next();
if (plot.x > max) { if(t=Math.max(Math.abs(plot.id.x),Math.abs(plot.id.y))>max){
max = plot.x; max=t;
maxplot = plot; maxPlot=plot
} }
if (plot.y > max) { };
max = plot.y; PS.class.static.log(maxPlot);
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 + " &r| " + plot.id);
} }
else { else {
PlotPlayer.sendMessage("Usage: /plot debugexec runasync furthest.js <plotworld>"); PlotPlayer.sendMessage("Usage: /plot debugexec runasync furthest.js <plotworld>");