Remove scripting-related stuff (#2947)

* Remove scripting-related stuff

* Cleanup

Co-authored-by: NotMyFault <mc.cache@web.de>
This commit is contained in:
Hannes Greule 2021-02-24 09:53:55 +01:00 committed by GitHub
parent da45813a06
commit 10e2d65221
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 21 additions and 613 deletions

View File

@ -228,14 +228,6 @@ public class PlotSquared {
this.plotListener = new PlotListener(this.eventDispatcher);
// Copy files
copyFile("addplots.js", Settings.Paths.SCRIPTS);
copyFile("addsigns.js", Settings.Paths.SCRIPTS);
copyFile("automerge.js", Settings.Paths.SCRIPTS);
copyFile("fixborders.js", Settings.Paths.SCRIPTS);
copyFile("furthest.js", Settings.Paths.SCRIPTS);
copyFile("mycommand.js", Settings.Paths.SCRIPTS);
copyFile("setbiomes.js", Settings.Paths.SCRIPTS);
copyFile("start.js", Settings.Paths.SCRIPTS);
copyFile("town.template", Settings.Paths.TEMPLATES);
copyFile("bridge.template", Settings.Paths.TEMPLATES);
copyFile("skyblock.template", Settings.Paths.TEMPLATES);

View File

@ -25,67 +25,32 @@
*/
package com.plotsquared.core.command;
import com.google.common.io.Files;
import com.google.inject.Inject;
import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.Settings;
import com.plotsquared.core.configuration.caption.CaptionHolder;
import com.plotsquared.core.configuration.caption.StaticCaption;
import com.plotsquared.core.configuration.caption.TranslatableCaption;
import com.plotsquared.core.database.DBFunc;
import com.plotsquared.core.events.PlotFlagRemoveEvent;
import com.plotsquared.core.events.Result;
import com.plotsquared.core.generator.HybridUtils;
import com.plotsquared.core.location.Location;
import com.plotsquared.core.permissions.Permission;
import com.plotsquared.core.player.ConsolePlayer;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.plot.PlotArea;
import com.plotsquared.core.plot.PlotId;
import com.plotsquared.core.plot.expiration.ExpireManager;
import com.plotsquared.core.plot.expiration.PlotAnalysis;
import com.plotsquared.core.plot.flag.GlobalFlagContainer;
import com.plotsquared.core.plot.flag.PlotFlag;
import com.plotsquared.core.plot.world.PlotAreaManager;
import com.plotsquared.core.queue.GlobalBlockQueue;
import com.plotsquared.core.util.ChunkManager;
import com.plotsquared.core.util.EconHandler;
import com.plotsquared.core.util.EventDispatcher;
import com.plotsquared.core.util.FileUtils;
import com.plotsquared.core.util.MathMan;
import com.plotsquared.core.util.SchematicHandler;
import com.plotsquared.core.util.SetupUtils;
import com.plotsquared.core.util.StringMan;
import com.plotsquared.core.util.WEManager;
import com.plotsquared.core.util.WorldUtil;
import com.plotsquared.core.util.query.PlotQuery;
import com.plotsquared.core.util.task.RunnableVal;
import com.plotsquared.core.util.task.RunnableVal2;
import com.plotsquared.core.util.task.RunnableVal3;
import com.plotsquared.core.util.task.TaskManager;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.world.block.BlockState;
import net.kyori.adventure.text.minimessage.Template;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.script.Bindings;
import javax.script.ScriptContext;
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import javax.script.ScriptException;
import javax.script.SimpleScriptContext;
import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.concurrent.CompletableFuture;
@CommandDeclaration(command = "debugexec",
permission = "plots.admin",
@ -97,125 +62,34 @@ public class DebugExec extends SubCommand {
private final PlotAreaManager plotAreaManager;
private final EventDispatcher eventDispatcher;
private final WorldEdit worldEdit;
private final GlobalBlockQueue blockQueue;
private final SchematicHandler schematicHandler;
private final EconHandler econHandler;
private final ChunkManager chunkManager;
private final WorldUtil worldUtil;
private final SetupUtils setupUtils;
private final HybridUtils hybridUtils;
private ScriptEngine engine;
private Bindings scope;
@Inject
public DebugExec(
final @NonNull PlotAreaManager plotAreaManager,
final @NonNull EventDispatcher eventDispatcher,
final @Nullable WorldEdit worldEdit,
final @NonNull GlobalBlockQueue blockQueue,
final @NonNull SchematicHandler schematicHandler,
final @NonNull EconHandler econHandler,
final @NonNull ChunkManager chunkManager,
final @NonNull WorldUtil worldUtil,
final @NonNull SetupUtils setupUtils,
final @NonNull HybridUtils hybridUtils
) {
this.plotAreaManager = plotAreaManager;
this.eventDispatcher = eventDispatcher;
this.worldEdit = worldEdit;
this.blockQueue = blockQueue;
this.schematicHandler = schematicHandler;
this.econHandler = econHandler;
this.chunkManager = chunkManager;
this.worldUtil = worldUtil;
this.setupUtils = setupUtils;
this.hybridUtils = hybridUtils;
init();
}
public ScriptEngine getEngine() {
if (this.engine == null) {
init();
}
return this.engine;
}
public Bindings getScope() {
return this.scope;
}
public void init() {
if (this.engine != null) {
return;
}
//create script engine manager
ScriptEngineManager scriptEngineManager = new ScriptEngineManager();
//create nashorn engine
this.engine = scriptEngineManager.getEngineByName("nashorn");
try {
engine.eval("print('PlotSquared scripting engine started');");
} catch (ScriptException e) {
e.printStackTrace();
}
if (this.engine == null) {
this.engine = new ScriptEngineManager(null).getEngineByName("JavaScript");
}
ScriptContext context = new SimpleScriptContext();
this.scope = context.getBindings(ScriptContext.ENGINE_SCOPE);
// stuff
this.scope.put("Settings", new Settings());
this.scope.put("StringMan", new StringMan());
this.scope.put("MathMan", new MathMan());
// Classes
this.scope.put("Location", Location.class);
this.scope.put("BlockState", BlockState.class);
this.scope.put("Plot", Plot.class);
this.scope.put("PlotId", PlotId.class);
this.scope.put("Runnable", Runnable.class);
this.scope.put("RunnableVal", RunnableVal.class);
// Instances
this.scope.put("PS", PlotSquared.get());
this.scope.put("GlobalBlockQueue", this.blockQueue);
this.scope.put("ExpireManager", ExpireManager.IMP);
if (this.worldEdit != null) {
this.scope.put("WEManager", new WEManager());
}
this.scope.put("TaskManager", TaskManager.getPlatformImplementation());
this.scope.put("ConsolePlayer", ConsolePlayer.getConsole());
this.scope.put("SchematicHandler", this.schematicHandler);
this.scope.put("ChunkManager", this.chunkManager);
this.scope.put("BlockManager", this.worldUtil);
this.scope.put("SetupUtils", this.setupUtils);
this.scope.put("EventUtil", this.eventDispatcher);
this.scope.put("EconHandler", this.econHandler);
this.scope.put("DBFunc", DBFunc.dbManager);
this.scope.put("HybridUtils", this.hybridUtils);
this.scope.put("IMP", PlotSquared.platform());
this.scope.put("MainCommand", MainCommand.getInstance());
// enums
for (Enum<?> value : Permission.values()) {
this.scope.put("C_" + value.name(), value);
}
}
@Override
public boolean onCommand(final PlotPlayer<?> player, String[] args) {
List<String> allowed_params = Arrays
.asList("analyze", "calibrate-analysis", "remove-flag", "stop-expire", "start-expire",
"seen", "list-scripts", "start-rgar", "stop-rgar", "help", "addcmd", "runasync",
"run", "allcmd", "all"
List<String> allowedParams = Arrays
.asList("analyze",
"calibrate-analysis",
"start-expire",
"stop-expire",
"remove-flag",
"start-rgar",
"stop-rgar"
);
if (args.length > 0) {
String arg = args[0].toLowerCase();
String script;
boolean async = false;
switch (arg) {
case "analyze": {
Plot plot = player.getCurrentPlot();
@ -268,6 +142,16 @@ public class DebugExec extends SubCommand {
threshold
);
return true;
case "start-expire":
if (ExpireManager.IMP == null) {
ExpireManager.IMP = new ExpireManager(this.eventDispatcher);
}
if (ExpireManager.IMP.runAutomatedTask()) {
player.sendMessage(TranslatableCaption.of("debugexec.expiry_started"));
} else {
player.sendMessage(TranslatableCaption.of("debugexec.expiry_already_started"));
}
return true;
case "stop-expire":
if (ExpireManager.IMP == null || !ExpireManager.IMP.cancelTask()) {
player.sendMessage(TranslatableCaption.of("debugexec.task_halted"));
@ -297,6 +181,7 @@ public class DebugExec extends SubCommand {
TranslatableCaption.of("debugexec.cleared_flag"),
Template.of("value", flag)
);
return true;
case "start-rgar": {
if (args.length != 2) {
player.sendMessage(
@ -333,166 +218,10 @@ public class DebugExec extends SubCommand {
HybridUtils.UPDATE = false;
player.sendMessage(TranslatableCaption.of("debugexec.task_cancelled"));
return true;
case "start-expire":
if (ExpireManager.IMP == null) {
ExpireManager.IMP = new ExpireManager(this.eventDispatcher);
}
if (ExpireManager.IMP.runAutomatedTask()) {
player.sendMessage(TranslatableCaption.of("debugexec.expiry_started"));
} else {
player.sendMessage(TranslatableCaption.of("debugexec.expiry_already_started"));
}
case "?":
case "help":
player.sendMessage(StaticCaption.of("<prefix><gold>Possible sub commands: </gray>/plot debugexec <" + StringMan
.join(allowed_params, " | ") + "></gray>"));
return false;
case "addcmd":
try {
final String cmd = StringMan.join(
Files.readLines(FileUtils.getFile(new File(
PlotSquared.platform().getDirectory() + File.separator
+ Settings.Paths.SCRIPTS), args[1]), StandardCharsets.UTF_8),
System.getProperty("line.separator")
);
new Command(MainCommand.getInstance(), true, args[1].split("\\.")[0], null,
RequiredType.NONE, CommandCategory.DEBUG
) {
@Override
public CompletableFuture<Boolean> execute(
PlotPlayer<?> player,
String[] args, RunnableVal3<Command, Runnable, Runnable> confirm,
RunnableVal2<Command, CommandResult> whenDone
) {
try {
DebugExec.this.scope.put("PlotPlayer", player);
DebugExec.this.scope.put("args", args);
DebugExec.this.engine.eval(cmd, DebugExec.this.scope);
} catch (ScriptException e) {
e.printStackTrace();
player.sendMessage(TranslatableCaption.of("error.command_went_wrong"));
}
return CompletableFuture.completedFuture(true);
}
};
return true;
} catch (IOException e) {
e.printStackTrace();
player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"),
Template.of("value", "/plot debugexec addcmd <file>")
);
return false;
}
case "runasync":
async = true;
case "run":
try {
script = StringMan.join(
Files.readLines(FileUtils.getFile(new File(
PlotSquared.platform().getDirectory() + File.separator
+ Settings.Paths.SCRIPTS), args[1]), StandardCharsets.UTF_8),
System.getProperty("line.separator")
);
if (args.length > 2) {
HashMap<String, String> replacements = new HashMap<>();
for (int i = 2; i < args.length; i++) {
replacements.put("%s" + (i - 2), args[i]);
}
script = StringMan.replaceFromMap(script, replacements);
}
} catch (IOException e) {
e.printStackTrace();
return false;
}
break;
case "list-scripts":
String path = PlotSquared.platform().getDirectory() + File.separator
+ Settings.Paths.SCRIPTS;
File folder = new File(path);
File[] filesArray = folder.listFiles();
int page;
switch (args.length) {
case 1:
page = 0;
break;
case 2:
if (MathMan.isInteger(args[1])) {
page = Integer.parseInt(args[1]) - 1;
break;
}
default:
player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"),
Template.of("value", "/plot debugexec list-scripts [#]")
);
return false;
}
List<File> allFiles = Arrays.asList(filesArray);
paginate(player, allFiles, 8, page, new RunnableVal3<Integer, File, CaptionHolder>() {
@Override
public void run(Integer i, File file, CaptionHolder message) {
String name = file.getName();
Template numTemplate = Template.of("number", String.valueOf(i));
Template nameTemplate = Template.of("name", name);
message.set(StaticCaption.of(MINI_MESSAGE.serialize(MINI_MESSAGE
.parse(
TranslatableCaption.of("debugexec.script_list_item").getComponent(player),
numTemplate,
nameTemplate
))));
}
}, "/plot debugexec list-scripts", TranslatableCaption.of("scripts.script_list"));
return true;
case "all":
if (args.length < 3) {
player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"),
Template.of("value", "/plot debugexec all <condition> <code>")
);
return false;
}
script =
"_1=PS.getBasePlots().iterator();while(_1.hasNext()){plot=_1.next();if("
+ args[1] + "){" + StringMan
.join(Arrays.copyOfRange(args, 2, args.length), " ") + "}}";
break;
default:
script = StringMan.join(args, " ");
}
if (!(player instanceof ConsolePlayer)) {
player.sendMessage(TranslatableCaption.of("console.not_console"));
return false;
}
init();
this.scope.put("PlotPlayer", player);
try {
if (async) {
final String toExec = script;
TaskManager.runTaskAsync(() -> {
long start = System.currentTimeMillis();
Object result = null;
try {
result = DebugExec.this.engine.eval(toExec, DebugExec.this.scope);
} catch (ScriptException e) {
e.printStackTrace();
}
logger.info("{}ms -> {}", System.currentTimeMillis() - start, result);
});
} else {
long start = System.currentTimeMillis();
Object result = this.engine.eval(script, this.scope);
logger.info("{}ms -> {}", System.currentTimeMillis() - start, result);
}
return true;
} catch (ScriptException e) {
e.printStackTrace();
return false;
}
}
player.sendMessage(StaticCaption.of("<prefix><gold>Possible sub commands: </gray>/plot debugexec <"
+ StringMan.join(allowedParams, " | ") + "></gray>"));
return false;
}

View File

@ -439,7 +439,6 @@ public class Settings extends Config {
public static final class Paths {
public static String SCHEMATICS = "schematics";
public static String SCRIPTS = "scripts";
public static String TEMPLATES = "templates";
}

View File

@ -1,41 +0,0 @@
/*
* _____ _ _ _____ _
* | __ \| | | | / ____| | |
* | |__) | | ___ | |_| (___ __ _ _ _ __ _ _ __ ___ __| |
* | ___/| |/ _ \| __|\___ \ / _` | | | |/ _` | '__/ _ \/ _` |
* | | | | (_) | |_ ____) | (_| | |_| | (_| | | | __/ (_| |
* |_| |_|\___/ \__|_____/ \__, |\__,_|\__,_|_| \___|\__,_|
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2020 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/*
This will increase a player's allowed plots by the provided value
/plot debugexec runasync addplots.js <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);
}

View File

@ -1,37 +0,0 @@
/*
* _____ _ _ _____ _
* | __ \| | | | / ____| | |
* | |__) | | ___ | |_| (___ __ _ _ _ __ _ _ __ ___ __| |
* | ___/| |/ _ \| __|\___ \ / _` | | | |/ _` | '__/ _ \/ _` |
* | | | | (_) | |_ ____) | (_| | |_| | (_| | | | __/ (_| |
* |_| |_|\___/ \__|_____/ \__, |\__,_|\__,_|_| \___|\__,_|
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2020 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/*
This script will fix all signs in the world.
*/
var plots = PS.sortPlotsByTemp(PS.getPlots());
for (var i = 0; i < plots.size(); i++) {
var plot = plots.get(i);
if (plot.isBasePlot()) {
plot.setSign();
PS.class.static.log('&cSetting sign for: ' + plot);
}
java.lang.Thread.sleep(10);
}

View File

@ -1,45 +0,0 @@
/*
* _____ _ _ _____ _
* | __ \| | | | / ____| | |
* | |__) | | ___ | |_| (___ __ _ _ _ __ _ _ __ ___ __| |
* | ___/| |/ _ \| __|\___ \ / _` | | | |/ _` | '__/ _ \/ _` |
* | | | | (_) | |_ ____) | (_| | |_| | (_| | | | __/ (_| |
* |_| |_|\___/ \__|_____/ \__, |\__,_|\__,_|_| \___|\__,_|
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2020 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/*
This is an example script that will auto merge all plots
/plot debugexec runasync automerge.js <removeroads>
*/
var plots = PS.sortPlotsByTemp(PS.getPlots());
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(-1, 250000, plot.owner, true);
}
} else if ("%s0" === "false") {
for (var i = 0; i < plots.size(); i++) {
var plot = plots.get(i);
plot.autoMerge(-1, 250000, plot.owner, false);
}
} 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");
}

View File

@ -1,35 +0,0 @@
/*
* _____ _ _ _____ _
* | __ \| | | | / ____| | |
* | |__) | | ___ | |_| (___ __ _ _ _ __ _ _ __ ___ __| |
* | ___/| |/ _ \| __|\___ \ / _` | | | |/ _` | '__/ _ \/ _` |
* | | | | (_) | |_ ____) | (_| | |_| | (_| | | | __/ (_| |
* |_| |_|\___/ \__|_____/ \__, |\__,_|\__,_|_| \___|\__,_|
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2020 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/*
Fixes border around plots
/plot debugexec runasync fixborder.js <Plot ID>
*/
var plots = PS.sortPlotsByTemp(PS.getPlots());
PS.class.static.log("Attempting to fix border for " + plots.size() + " plots");
for (var i = 0; i < plots.size(); i++) {
var plot = plots.get(i);
plot.setComponent("border", "%s0");
}

View File

@ -1,57 +0,0 @@
/*
* _____ _ _ _____ _
* | __ \| | | | / ____| | |
* | |__) | | ___ | |_| (___ __ _ _ _ __ _ _ __ ___ __| |
* | ___/| |/ _ \| __|\___ \ / _` | | | |/ _` | '__/ _ \/ _` |
* | | | | (_) | |_ ____) | (_| | |_| | (_| | | | __/ (_| |
* |_| |_|\___/ \__|_____/ \__, |\__,_|\__,_|_| \___|\__,_|
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2020 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/*
* 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.getX() > max) {
max = plot.getX();
maxplot = plot;
}
if (plot.getY() > max) {
max = plot.getY();
maxplot = plot;
}
if (-plot.getX() > max) {
max = -plot.getX();
maxplot = plot;
}
if (-plot.getY() > max) {
max = -plot.getY();
maxplot = plot;
}
}
PS.class.static.log(plot);
} else {
PlotPlayer.sendMessage("Usage: /plot debugexec runasync furthest.js <plotworld>");
}

View File

@ -309,7 +309,6 @@
"unsafe.debugallowunsafe_off": "<prefix><gray>Unsafe actions disabled.</gray>",
"need.need_block": "<prefix><red>You've got to specify a block.</red>",
"near.plot_near": "<prefix><gold>Players: <gray><list></gray></gold>",
"scripts.script_list": "<dark_gray><strikethrough>--------- <reset><gold>SCRIPTS </gold><dark_gray><strikethrough>---------</dark_gray><reset>",
"info.none": "<gray>None</gray>",
"info.now": "<gray>Now</gray>",
"info.never": "<gray>Never</gray>",

View File

@ -1,27 +0,0 @@
/*
* _____ _ _ _____ _
* | __ \| | | | / ____| | |
* | |__) | | ___ | |_| (___ __ _ _ _ __ _ _ __ ___ __| |
* | ___/| |/ _ \| __|\___ \ / _` | | | |/ _` | '__/ _ \/ _` |
* | | | | (_) | |_ ____) | (_| | |_| | (_| | | | __/ (_| |
* |_| |_|\___/ \__|_____/ \__, |\__,_|\__,_|_| \___|\__,_|
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2020 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
// This command is registered from the start.js file which is run during startup
PlotPlayer.sendMessage("Hello World!");

View File

@ -1,37 +0,0 @@
/*
* _____ _ _ _____ _
* | __ \| | | | / ____| | |
* | |__) | | ___ | |_| (___ __ _ _ _ __ _ _ __ ___ __| |
* | ___/| |/ _ \| __|\___ \ / _` | | | |/ _` | '__/ _ \/ _` |
* | | | | (_) | |_ ____) | (_| | |_| | (_| | | | __/ (_| |
* |_| |_|\___/ \__|_____/ \__, |\__,_|\__,_|_| \___|\__,_|
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2020 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/*
This script will reset all biomes in claimed plots
*/
var plots = PS.sortPlotsByTemp(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);
}

View File

@ -1,32 +0,0 @@
/*
* _____ _ _ _____ _
* | __ \| | | | / ____| | |
* | |__) | | ___ | |_| (___ __ _ _ _ __ _ _ __ ___ __| |
* | ___/| |/ _ \| __|\___ \ / _` | | | |/ _` | '__/ _ \/ _` |
* | | | | (_) | |_ ____) | (_| | |_| | (_| | | | __/ (_| |
* |_| |_|\___/ \__|_____/ \__, |\__,_|\__,_|_| \___|\__,_|
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2020 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
// 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");
}