PlotSquared/Core/src/main/resources/automerge.js

49 lines
1.3 KiB
JavaScript
Raw Normal View History

2015-08-01 20:01:41 +02:00
/*
Need to script something quick with PlotSquared?
/plot debugexec runasync automerge.js <removeroads>
This is an example script that will auto merge all plots
2015-08-01 22:11:28 +02:00
The following utility classes are usable:
- PlotSquared
2015-08-01 22:11:28 +02:00
- TaskManager
- TitleManager
- ConsolePlayer
- SchematicHandler
- ChunkManager
- BlockManager
- SetupUtils
- EventUtil
- UUIDHandler
- DBFunc
- HybridUtils
- IMP ( BukkitMain or SpongeMain)
- MainCommand
- MainUtil
- Settings
- StringMan
- MathMan
- C ( use C_ )
- Permissions ( use Permissions_ )
For more information see: https://github.com/IntellectualSites/PlotSquared/wiki/Scripting
2015-08-01 20:01:41 +02:00
*/
2018-08-10 17:01:10 +02:00
var plots = PS.sortPlots(PS.getPlots());
2015-08-28 01:51:05 +02:00
PS.class.static.log("Attempting to auto merge " + plots.size() + " plots");
2015-08-01 20:01:41 +02:00
if ("%s0" === "true") {
for (var i = 0; i < plots.size(); i++) {
var plot = plots.get(i);
plot.autoMerge(-1, 250000, plot.owner, true);
2015-08-01 20:01:41 +02:00
}
}
else if ("%s0" === "false") {
for (var i = 0; i < plots.size(); i++) {
var plot = plots.get(i);
plot.autoMerge(-1, 250000, plot.owner, false);
2015-08-01 20:01:41 +02:00
}
}
else {
C_COMMAND_SYNTAX.send(PlotPlayer, "/plot debugexec automerge.js <removeroads>");
MainUtil.class.static.sendMessage(PlotPlayer, "$1<removeroads> is true or false if you want to remove roads when auto merging");
2018-08-10 17:01:10 +02:00
}