Created Scripting (markdown)

Jesse Boyd 2015-08-02 04:02:13 +10:00
parent 9335edfaa0
commit 36d87b00cd

60
Scripting.md Normal file

@ -0,0 +1,60 @@
### Overview
- Scripts go in the `PlotSquared/scripts` folder
- The language is Javascript
### Commands
- `/plot debugexec run <script> [args...]`
- `/plot debugexec runasync <script> [args...]`
- `/plot debugexec <code goes here>`
### Example script
``` javascript
/*
Need to script something quick with PlotSquared?
/plot debugexec runasync automerge.js <removeroads>
This is an example script that will auto merge all plots
The following utility classes are usable:
- PS
- 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
*/
var plots = PS.sortPlots(PS.getPlots());
PS.log("Attempting to auto merge " + plots.size() + " plots");
if ("%s0" === "true") {
for (var i = 0; i < plots.size(); i++) {
var plot = plots.get(i);
plot.autoMerge(false);
}
}
else if ("%s0" === "false") {
for (var i = 0; i < plots.size(); i++) {
var plot = plots.get(i);
plot.autoMerge(false);
}
}
else {
C_COMMAND_SYNTAX.send(PlotPlayer, "/plot debugexec automerge.js <removeroads>");
MainUtil.sendMessage(PlotPlayer, "$1<removeroads> is true or false if you want to remove roads when auto merging");
}
```