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

46 lines
2.1 KiB
JavaScript
Raw Normal View History

/*
* _____ _ _ _____ _
* | __ \| | | | / ____| | |
* | |__) | | ___ | |_| (___ __ _ _ _ __ _ _ __ ___ __| |
* | ___/| |/ _ \| __|\___ \ / _` | | | |/ _` | '__/ _ \/ _` |
* | | | | (_) | |_ ____) | (_| | |_| | (_| | | | __/ (_| |
* |_| |_|\___/ \__|_____/ \__, |\__,_|\__,_|_| \___|\__,_|
* | |
* |_|
* 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
2020-08-15 14:59:29 +02:00
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
2015-08-01 20:01:41 +02:00
/*
This is an example script that will auto merge all plots
/plot debugexec runasync automerge.js <removeroads>
2015-08-01 20:01:41 +02:00
*/
2019-04-12 04:11:03 +02:00
var plots = PS.sortPlotsByTemp(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
}
2019-04-24 00:48:22 +02:00
} else if ("%s0" === "false") {
2015-08-01 20:01:41 +02:00
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
}
2019-04-24 00:48:22 +02:00
} else {
2015-08-01 20:01:41 +02:00
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
}