mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 11:55:38 +01:00
Updated Printing the furthest plot (markdown)
parent
fa056bce63
commit
83417e2a4d
@ -1,5 +1,3 @@
|
||||
Download: https://www.dropbox.com/s/h544xf6susqlonf/furthest.js?dl=0
|
||||
|
||||
``` javascript
|
||||
/*
|
||||
* 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")) {
|
||||
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;
|
||||
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 (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 + " &r| " + plot.id);
|
||||
};
|
||||
PS.class.static.log(maxPlot);
|
||||
}
|
||||
else {
|
||||
PlotPlayer.sendMessage("Usage: /plot debugexec runasync furthest.js <plotworld>");
|
||||
|
Loading…
Reference in New Issue
Block a user