mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-06-26 02:34:42 +02:00
18
Core/src/main/resources/addplots.js
Normal file
18
Core/src/main/resources/addplots.js
Normal file
@ -0,0 +1,18 @@
|
||||
/*
|
||||
This will increase a player's allowed plots by the provided value
|
||||
/plot debugexec runasync addperm <player> <amount>
|
||||
*/
|
||||
var uuid = UUIDHandler.getUUID('%s0', null);
|
||||
if (uuid === null) {
|
||||
C_INVALID_PLAYER.send(PlotPlayer, '%s0');
|
||||
}
|
||||
else if (!MathMan.class.static.isInteger('%s1')) {
|
||||
C_NOT_VALID_NUMBER.send(PlotPlayer, '(0, ' + Settings.MAX_PLOTS + ')');
|
||||
}
|
||||
else {
|
||||
var amount = parseInt('%s1');
|
||||
var pp = IMP.wrapPlayer(UUIDHandler.getUUIDWrapper().getOfflinePlayer(uuid).player);
|
||||
var allowed = pp.getAllowedPlots();
|
||||
MainUtil.class.static.sendMessage(PlotPlayer, '$4Setting permission: plots.plot.' + (allowed + amount) + ' for %s0');
|
||||
IMP.getEconomyHandler().setPermission("", pp.getName(), 'plots.plot.' + (allowed + amount), true);
|
||||
}
|
12
Core/src/main/resources/addsigns.js
Normal file
12
Core/src/main/resources/addsigns.js
Normal file
@ -0,0 +1,12 @@
|
||||
/*
|
||||
This script will fix all signs in the world.
|
||||
*/
|
||||
var plots = PS.sortPlots(PS.getPlots());
|
||||
for (var i = 0; i < plots.size(); i++) {
|
||||
var plot = plots.get(i);
|
||||
if (!plot.isMerged() || !plot.getMerged(0)) {
|
||||
plot.setSign();
|
||||
PS.class.static.log('&cSetting sign for: ' + plot);
|
||||
}
|
||||
java.lang.Thread.sleep(10);
|
||||
}
|
@ -5,7 +5,7 @@ Need to script something quick with PlotSquared?
|
||||
This is an example script that will auto merge all plots
|
||||
|
||||
The following utility classes are usable:
|
||||
- PS
|
||||
- PlotSquared
|
||||
- TaskManager
|
||||
- TitleManager
|
||||
- ConsolePlayer
|
||||
@ -33,16 +33,16 @@ PS.class.static.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);
|
||||
plot.autoMerge(-1, 250000, plot.owner, true);
|
||||
}
|
||||
}
|
||||
else if ("%s0" === "false") {
|
||||
for (var i = 0; i < plots.size(); i++) {
|
||||
var plot = plots.get(i);
|
||||
plot.autoMerge(false);
|
||||
plot.autoMerge(-1, 250000, plot.owner, 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");
|
||||
MainUtil.class.static.sendMessage(PlotPlayer, "$1<removeroads> is true or false if you want to remove roads when auto merging");
|
||||
}
|
||||
|
33
Core/src/main/resources/furthest.js
Normal file
33
Core/src/main/resources/furthest.js
Normal file
@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Script to find the furthest plot from origin in a world:
|
||||
* - /plot debugexec runasync furthest.js <plotworld>
|
||||
*/
|
||||
|
||||
if (PS.hasPlotArea("%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>");
|
||||
}
|
2
Core/src/main/resources/mycommand.js
Normal file
2
Core/src/main/resources/mycommand.js
Normal file
@ -0,0 +1,2 @@
|
||||
// This command is registered from the start.js file which is run during startup
|
||||
PlotPlayer.sendMessage("Hello World!");
|
12
Core/src/main/resources/setbiomes.js
Normal file
12
Core/src/main/resources/setbiomes.js
Normal file
@ -0,0 +1,12 @@
|
||||
/*
|
||||
This script will reset all biomes in claimed plots
|
||||
*/
|
||||
var plots = PS.sortPlots(PS.getPlots());
|
||||
for (var i = 0; i < plots.size(); i++) {
|
||||
var plot = plots.get(i);
|
||||
if (!plot.isMerged() || !plot.getMerged(0)) {
|
||||
plot.setBiome("%s0", null);
|
||||
PS.class.static.log('&cSetting biome for: ' + plot);
|
||||
}
|
||||
java.lang.Thread.sleep(1000);
|
||||
}
|
7
Core/src/main/resources/start.js
Normal file
7
Core/src/main/resources/start.js
Normal file
@ -0,0 +1,7 @@
|
||||
// Add your commands to this list
|
||||
var commands = ["mycommand"];
|
||||
|
||||
// Command registration:
|
||||
for (var i in commands) {
|
||||
MainCommand.class.static.onCommand(PlotPlayer, "plot", "debugexec", "addcmd", commands[i] + ".js");
|
||||
}
|
Reference in New Issue
Block a user