Skip to content
This repository has been archived by the owner on Oct 18, 2021. It is now read-only.

Printing the furthest plot

Jesse Boyd edited this page Aug 6, 2015 · 5 revisions

Download: https://www.dropbox.com/s/h544xf6susqlonf/furthest.js?dl=0

/*
* Script to find the furthest plot from origin in a world:
*  - /plot debugexec runasync furthest.js <plotworld>
*/

if (PS.isPlotWorld("%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;
        }
        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>");
}
Clone this wiki locally