3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-12-27 11:20:04 +01:00
FastAsyncWorldEdit/contrib/craftscripts/roof.js
Matt 96dcb95b7c
Javadoc and Formatting fixes. (#619)
Javadoc and Formatting fixes.

Also, extremely minor code changes which have been tested.
This commit is only part one of two commits that aim to fix problems with formatting in our project. In part two I will modify the Google Java Style Guide (since it closely matches our code style) for our project so there is guidance on how to format and document. 

* Updated PlotSquared URL
* Removed plugin acronyms
* Fixed a typo
* Fixed grammar
* Use modern block id's
* Update YouTube video URL
2020-10-05 13:41:41 -04:00

54 Zeilen
1.8 KiB
JavaScript

// $Id$
/*
* Copyright (c) 2011 Bentech
*
* 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 <http://www.gnu.org/licenses/>.
*/
importPackage(Packages.com.sk89q.worldedit);
importPackage(Packages.com.sk89q.worldedit.math);
importPackage(Packages.com.sk89q.worldedit.blocks);
var blocks = context.remember();
var session = context.getSession();
var player = context.getPlayer();
var region = session.getRegionSelector(player.getWorld()).getRegion();
context.checkArgs(1, 1, "<type>");
var blocktype = context.getBlock(argv[1]);
var cycles = region.getLength();
if (region.getWidth() > cycles) {
cycles = region.getWidth();
}
cycles = cycles / 2;
for (var c = 0; c < cycles; c++) {
for (var w = 0; w < region.getWidth() - (c * 2); w++) {
for (var l = 0; l < region.getLength() - (c * 2); l++) {
if (w === 0 || w === (region.getWidth() - (c * 2)) - 1 || l === 0 || l === (region.getLength() - (c * 2)) - 1) {
var vec = BlockVector3.at(
region.getMinimumPoint().getX() + (w + c),
region.getMaximumPoint().getY() + c,
region.getMinimumPoint().getZ() + (l + c));
blocks.setBlock(vec, blocktype);
}
}
}
}