mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 11:55:38 +01:00
Created Printing the furthest plot (markdown)
parent
3c4db73a9a
commit
1a4c3251e0
37
Printing-the-furthest-plot.md
Normal file
37
Printing-the-furthest-plot.md
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
Download: https://www.dropbox.com/s/h544xf6susqlonf/furthest.js?dl=0
|
||||||
|
|
||||||
|
``` javascript
|
||||||
|
/*
|
||||||
|
* 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>");
|
||||||
|
}
|
||||||
|
```
|
Loading…
Reference in New Issue
Block a user