Skip to content
This repository has been archived by the owner on Apr 26, 2021. It is now read-only.

New script to set the border of claimed plots #46

Closed
steve4744 opened this issue Apr 14, 2019 · 1 comment
Closed

New script to set the border of claimed plots #46

steve4744 opened this issue Apr 14, 2019 · 1 comment

Comments

@steve4744
Copy link

steve4744 commented Apr 14, 2019

After running 'regenallroads' the borders of claimed plots get reset to the same block as unclaimed plots. In the same way that signs on claimed plots can be re-added with script addsigns.js, this script will reset the borders of claimed plots to whatever is block specified as wall.block_claimed in worlds.yml.

In addition, it could also be used with the new 1.14 slabs to change the look of existing plot worlds with minimum effort.

plot debugexec run setborders.js <plotworld>

/*
This script will update the border walls of claimed plots
Run on console: plot debugexec run setborders.js <plotworld>
*/
if (PS.hasPlotArea("%s0")) {
    var plots = PS.sortPlotsByTemp(PS.getPlots());
    for (var i = 0; i < plots.size(); i++) {
        var plot = plots.get(i);
        var world = plot.getWorldName();
        if ("%s0" === world) {
            if (!plot.isMerged() || !plot.getMerged(0)) {
                plot.setComponent("border", PS.worlds.getString("worlds." + world + ".wall.block_claimed"));
                PS.class.static.log('&cSetting border for ' + plot + " to " + PS.worlds.getString("worlds." + world + ".wall.block_claimed"));
            }
        }
    java.lang.Thread.sleep(10);
    } 
}
else {
    PS.class.static.log("Usage: plot debugexec run setborders.js <plotworld>");
}
@NotMyFault
Copy link
Member

If you want to add that specific script, feel free to fork PlotSquared and make a quick pr.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants