diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index f8b8492f7..000000000
--- a/.travis.yml
+++ /dev/null
@@ -1,18 +0,0 @@
-language: java
-notifications:
- email: false
-before_install: chmod +x gradlew
-install: ./gradlew setupCIWorkspace -s
-script: ./gradlew build -s
-jdk:
- - oraclejdk8
-# Caching for Gradle files, prevents hitting Maven too much.
-before_cache:
- - find $HOME/.gradle/ -name '*.lock' -print -exec rm -f {} \;
-cache:
- directories:
- - $HOME/.gradle/caches/
- - $HOME/.gradle/wrapper/
-
-# Faster builds without sudo.
-sudo: false
diff --git a/COMPILING.md b/COMPILING.md
deleted file mode 100644
index d3e5bac5c..000000000
--- a/COMPILING.md
+++ /dev/null
@@ -1,50 +0,0 @@
-Compiling
-=========
-
-You can compile WorldEdit as long as you have the [Java Development Kit (JDK)](http://www.oracle.com/technetwork/java/javase/downloads/index-jsp-138363.html) for Java 8 or newer.
-You only need one version of the JDK installed.
-
-The build process uses Gradle, which you do *not* need to download. WorldEdit is a multi-module project with four modules:
-
-* `worldedit-core` contains the WorldEdit API
-* `worldedit-bukkit` is the Bukkit plugin
-* `worldedit-sponge` is the Sponge plugin
-* `worldedit-forge` is the Forge mod
-
-## To compile...
-
-### On Windows
-
-1. Shift + right click the folder with WorldEdit's files and click "Open command prompt".
-2. `gradlew clean setupDecompWorkspace`
-3. `gradlew build`
-
-### On Linux, BSD, or Mac OS X
-
-1. In your terminal, navigate to the folder with WorldEdit's files (`cd /folder/of/worldedit/files`)
-2. `./gradlew clean setupDecompWorkspace`
-3. `./gradlew build`
-
-## Then you will find...
-
-You will find:
-
-* The core WorldEdit API in **worldedit-core/build/libs**
-* WorldEdit for Bukkit in **worldedit-bukkit/build/libs**
-* WorldEdit for Sponge in **worldedit-sponge/build/libs**
-* WorldEdit for Forge in **worldedit-forge/build/libs**
-
-If you want to use WorldEdit, use the `-dist` version.
-
-(The -dist version includes WorldEdit + necessary libraries.)
-
-### Note regarding `setupDecompWorkspace`
-`setupDecompWorkspace` requires more memory than is usually given to Gradle by default.
-If it fails, you should put `org.gradle.jvmargs=-Xmx3G` in `gradle.properties`.
-Please don't commit this change!
-
-## Other commands
-
-* `gradlew idea` will generate an [IntelliJ IDEA](http://www.jetbrains.com/idea/) module for each folder.
-* `gradlew eclipse` will generate an [Eclipse](https://www.eclipse.org/downloads/) project for each folder.
-* Use `setupCIWorkspace` instead of `setupDecompWorkspace` if you are doing this on a CI server.
diff --git a/README.md b/README.md
index 973c8968a..c8494060a 100644
--- a/README.md
+++ b/README.md
@@ -15,17 +15,18 @@ FAWE is a fork of WorldEdit that has huge speed and memory improvements and cons
## Downloads
### 1.13+
-* [Download](https://empcraft.com/fawe/download/?bukkit113)
-* [Jenkins](https://ci.athion.net/job/FAWE-1.13/)
+* [Download](https://incendo.org/download/)
+* [Jenkins](https://ci.athion.net/job/FastAsyncWorldEdit-1.13/)
-### <1.12.2
-* [Download](https://empcraft.com/fawe/download/?bukkit)
+### < 1.12.2
+* [Download](https://incendo.org/download/)
* [Jenkins](https://ci.athion.net/job/FastAsyncWorldEdit/)
* [Repository](https://github.com/boy0001/FastAsyncWorldedit)
## Building
-FAWE uses gradle to build
+FAWE uses gradle to build
+You can safely ignore `gradlew setupDecompWorkspace` if you are not planning to work on the forge side of FAWE.
```
$ gradlew setupDecompWorkspace
diff --git a/build.gradle b/build.gradle
index afd809465..ac4274c38 100644
--- a/build.gradle
+++ b/build.gradle
@@ -27,7 +27,11 @@ plugins {
apply plugin: 'java'
clean { delete "target" }
-print new File('splash.txt').text
+
+def splashFile = new File('splash.txt')
+if (splashFile.exists()) {
+ print splashFile.text
+}
group = 'com.boydti.fawe'
@@ -78,11 +82,10 @@ subprojects {
maven { url "http://maven.sk89q.com/repo/" }
maven { url "http://repo.maven.apache.org/maven2" }
// Fawe
- maven {url "http://ci.athion.net/job/FAWE-WorldGuard-1.13/ws/mvn/"}
maven {url "https://mvnrepository.com/artifact/"}
maven {url "http://repo.dmulloy2.net/content/groups/public/"}
maven {url "https://repo.destroystokyo.com/repository/maven-public//"}
- maven {url "http://ci.athion.net/job/PlotSquared-Legacy/ws/mvn/"}
+ maven {url "http://ci.athion.net/job/PlotSquared-Breaking/ws/mvn/"}
mavenLocal()
maven {url "http://empcraft.com/maven2"}
maven {url "https://hub.spigotmc.org/nexus/content/groups/public/"}
diff --git a/config/checkstyle/import-control.xml b/config/checkstyle/import-control.xml
index 2fe94d97d..eedd07857 100644
--- a/config/checkstyle/import-control.xml
+++ b/config/checkstyle/import-control.xml
@@ -14,6 +14,7 @@
+
@@ -30,6 +31,7 @@
+
diff --git a/contrib/craftscripts/README.txt b/contrib/craftscripts/README.txt
index 607196a4e..7638e67ed 100644
--- a/contrib/craftscripts/README.txt
+++ b/contrib/craftscripts/README.txt
@@ -2,7 +2,7 @@ CraftScripts are script files for WorldEdit that let you write world
editing scripts with JavaScript easily.
Example usage:
-/cs maze.js lightstone 10 10
+/cs maze.js glowstone 10 10
You may or may not install these scripts -- it is optional. If you are, however,
place the entire craftscripts/ folder into the respective directory for the platform
diff --git a/contrib/craftscripts/SUBMITTING.txt b/contrib/craftscripts/SUBMITTING.txt
index d39505cf5..b519effe8 100644
--- a/contrib/craftscripts/SUBMITTING.txt
+++ b/contrib/craftscripts/SUBMITTING.txt
@@ -7,4 +7,4 @@ Note: Legally you should not release things to the public domain as not
all countries have the concept of public domain in their copyright law.
You can also post your scripts here:
-http://forum.sk89q.com/forums/craftscripts.6/
\ No newline at end of file
+https://discord.gg/YKbmj7V or http://forum.sk89q.com/forums/craftscripts.6/
\ No newline at end of file
diff --git a/contrib/craftscripts/draw.js b/contrib/craftscripts/draw.js
index 0454864f3..bc78843b9 100644
--- a/contrib/craftscripts/draw.js
+++ b/contrib/craftscripts/draw.js
@@ -43,8 +43,26 @@ var clothColors = [
makeColor(100, 60, 0), // Brown
makeColor(48, 80, 0), // Cactus green
makeColor(255, 0, 0), // Red
- makeColor(0, 0, 0), // Black
-]
+ makeColor(0, 0, 0) // Black
+];
+var clothBlocks = [
+ context.getBlock("white_wool"),
+ context.getBlock("orange_wool"),
+ context.getBlock("magenta_wool"),
+ context.getBlock("light_blue_wool"),
+ context.getBlock("yellow_wool"),
+ context.getBlock("lime_wool"),
+ context.getBlock("pink_wool"),
+ context.getBlock("gray_wool"),
+ context.getBlock("light_gray_wool"),
+ context.getBlock("cyan_wool"),
+ context.getBlock("purple_wool"),
+ context.getBlock("blue_wool"),
+ context.getBlock("brown_wool"),
+ context.getBlock("green_wool"),
+ context.getBlock("red_wool"),
+ context.getBlock("black_wool")
+];
var clothColorsOpt = [
makeColor(178, 178, 178), // White
makeColor(187, 102, 44), // Orange
@@ -61,8 +79,8 @@ var clothColorsOpt = [
makeColor(68, 41, 22), // Brown
makeColor(44, 61, 19), // Cactus green
makeColor(131, 36, 32), // Red
- makeColor(21, 18, 18), // Black
-]
+ makeColor(21, 18, 18) // Black
+];
var clothColorsOptHD = [
makeColor(168, 168, 168), // White
makeColor(143, 59, 0), // Orange
@@ -79,8 +97,8 @@ var clothColorsOptHD = [
makeColor(52, 25, 0), // Brown
makeColor(10, 76, 10), // Cactus green
makeColor(127, 9, 9), // Red
- makeColor(17, 17, 17), // Black
-]
+ makeColor(17, 17, 17) // Black
+];
// http://stackoverflow.com/questions/2103368/color-logic-algorithm/2103608#2103608
function colorDistance(c1, c2) {
@@ -90,7 +108,7 @@ function colorDistance(c1, c2) {
var b = c1.getBlue() - c2.getBlue();
var weightR = 2 + rmean/256;
var weightG = 4.0;
- var weightB = 2 + (255-rmean)/256
+ var weightB = 2 + (255-rmean)/256;
return Math.sqrt(weightR*r*r + weightG*g*g + weightB*b*b);
}
@@ -113,14 +131,14 @@ function findClosestWoolColor(col, clothColors) {
context.checkArgs(1, 3, "");
-var f = context.getSafeFile("drawings", argv[1]);
+var f = context.getSafeOpenFile("drawings", argv[1], "png", ["png", "jpg", "jpeg", "bmp"]);
var sess = context.remember();
-var upright = argv[2] == "v";
+var upright = argv[2] === "v";
var colors = clothColors;
-if(argv[3] == "opt") {
+if(argv[3] === "opt") {
colors = clothColorsOpt;
player.print("Using optimized palette");
-} else if(argv[3] == "optHD") {
+} else if(argv[3] === "optHD") {
colors = clothColorsOptHD;
player.print("Using optimized HD palette");
}
@@ -132,7 +150,7 @@ if (!f.exists()) {
var width = img.getWidth();
var height = img.getHeight();
- var origin = player.getBlockIn();
+ var origin = player.getBlockIn().toVector().toBlockPoint();
for (var x = 0; x < width; x++) {
for (var y = 0; y < height; y++) {
@@ -141,9 +159,9 @@ if (!f.exists()) {
// Added this to enable the user to create images upright
// rather than flat on the ground
if (!upright) {
- sess.setBlock(origin.add(x, 0, y), new BaseBlock(35, data));
+ sess.setBlock(origin.add(x, 0, y), clothBlocks[data]);
} else {
- sess.setBlock(origin.add(x, height - y, 0), new BaseBlock(35, data));
+ sess.setBlock(origin.add(x, height - y, 0), clothBlocks[data]);
}
}
}
diff --git a/contrib/craftscripts/maze.js b/contrib/craftscripts/maze.js
index dd5ca6a52..ea97ea042 100644
--- a/contrib/craftscripts/maze.js
+++ b/contrib/craftscripts/maze.js
@@ -19,6 +19,7 @@
importPackage(Packages.com.sk89q.worldedit);
importPackage(Packages.com.sk89q.worldedit.blocks);
+importPackage(Packages.com.sk89q.worldedit.math);
usage = " [width] [length] [height] [size] [thickness] flags\n";
usage += "\n";
@@ -40,10 +41,15 @@ usage += "• b places blue wool if unvisited";
context.checkArgs(1, -1, usage);
sess = context.remember();
-origin = player.getBlockIn();
+origin = player.getBlockIn().toVector().toBlockPoint();
// This may throw an exception that is caught by the script processor
block = context.getBlock(argv[1]);
+airBlock = context.getBlock("air");
+glassBlock = context.getBlock("glass");
+limeWoolBlock = context.getBlock("lime_wool");
+redWoolBlock = context.getBlock("red_wool");
+blueWoolBlock = context.getBlock("blue_wool");
if (argv.length > 7) flags = String(argv[7]);
else flags = false;
@@ -74,20 +80,20 @@ if (argv.length > 2) {
} else w = 5;
if (flags) {
- ee = flags.search("i") != -1 ? true : false;
- r = flags.search("y") != -1 ? true : false;
+ ee = flags.search("i") != -1;
+ r = flags.search("y") != -1;
if (r) ee = true;
- f = flags.search("f") != -1 ? true : false;
- c = flags.search("c") != -1 ? true : false;
- e = flags.search("e") != -1 ? true : false;
- ao = flags.search("a") != -1 ? true : false;
+ f = flags.search("f") != -1;
+ c = flags.search("c") != -1;
+ e = flags.search("e") != -1;
+ ao = flags.search("a") != -1;
if (ao) f = c = false, e = true;
- v = flags.search("v") != -1 ? true : false;
- so = flags.search("s") != -1 ? true : false;
+ v = flags.search("v") != -1;
+ so = flags.search("s") != -1;
if (so) ee = true;
- g = flags.search("g") != -1 ? true : false;
- re = flags.search("r") != -1 ? true : false;
- bl = flags.search("b") != -1 ? true : false;
+ g = flags.search("g") != -1;
+ re = flags.search("r") != -1;
+ bl = flags.search("b") != -1;
if (g || re || bl) so = ee = true;
} else ee = r = f = c = e = ao = v = so = g = re = bl = false;
@@ -208,8 +214,8 @@ for (y = 0; y <= l; y++) for (x = 0; x <= w; x++) {
}
} else if (e && cell != id(x, l)) {
for (z = 0; z < h; z++) for (yi = 0; yi < s; yi++) for (xi = 1; xi <= wa; xi++) {
- if (!v) sess.setBlock(origin.add(x * (s + wa) - xi, z, y * (s + wa) + yi), BaseBlock(0));
- else sess.setBlock(origin.add(x * (s + wa) - xi, y * (s + wa) + yi, -z), BaseBlock(0));
+ if (!v) sess.setBlock(origin.add(x * (s + wa) - xi, z, y * (s + wa) + yi), airBlock);
+ else sess.setBlock(origin.add(x * (s + wa) - xi, y * (s + wa) + yi, -z), airBlock);
}
}
@@ -222,8 +228,8 @@ for (y = 0; y <= l; y++) for (x = 0; x <= w; x++) {
}
} else if (e && cell != id(w, y)) {
for (z = 0; z < h; z++) for (yi = 1; yi <= wa; yi++) for (xi = 0; xi < s; xi++) {
- if (!v) sess.setBlock(origin.add(x * (s + wa) + xi, z, y * (s + wa) - yi), BaseBlock(0));
- else sess.setBlock(origin.add(x * (s + wa) + xi, y * (s + wa) - yi, -z), BaseBlock(0));
+ if (!v) sess.setBlock(origin.add(x * (s + wa) + xi, z, y * (s + wa) - yi), airBlock);
+ else sess.setBlock(origin.add(x * (s + wa) + xi, y * (s + wa) - yi, -z), airBlock);
}
}
@@ -236,8 +242,8 @@ for (y = 0; y <= l; y++) for (x = 0; x <= w; x++) {
if (e && cell != id(x, l) && cell != id(w, y)) {
for (z = 0; z < h; z++) for (yi = 0; yi < s; yi++) for (xi = 0; xi < s; xi++) {
- if (!v) sess.setBlock(origin.add(x * (s + wa) + xi, z, y * (s + wa) + yi), BaseBlock(0));
- else sess.setBlock(origin.add(x * (s + wa) + xi, y * (s + wa) + yi, -z), BaseBlock(0));
+ if (!v) sess.setBlock(origin.add(x * (s + wa) + xi, z, y * (s + wa) + yi), airBlock);
+ else sess.setBlock(origin.add(x * (s + wa) + xi, y * (s + wa) + yi, -z), airBlock);
}
}
}
@@ -281,51 +287,51 @@ if (so) {
if (visited[cell] && !wrong[cell]) {
for (yi = 0; yi < s; yi++) for (xi = 0; xi < s; xi++) {
- if (!v) sess.setBlock(origin.add(x * (s + wa) + xi, -1, y * (s + wa) + yi), BaseBlock(35, 5));
- else sess.setBlock(origin.add(x * (s + wa) + xi, y * (s + wa) + yi, +1), BaseBlock(35, 5));
+ if (!v) sess.setBlock(origin.add(x * (s + wa) + xi, -1, y * (s + wa) + yi), limeWoolBlock);
+ else sess.setBlock(origin.add(x * (s + wa) + xi, y * (s + wa) + yi, +1), limeWoolBlock);
}
}
if ((visited[cell] && !wrong[cell] && visited[id(x - 1, y)] && !wrong[id(x - 1, y)] && noWallLeft[cell]) || cell == start || id(x - 1, y) == end) {
for (xi = 1; xi <= wa; xi++) for (yi = 0; yi < s; yi++) {
- if (!v) sess.setBlock(origin.add(x * (s + wa) - xi, -1, y * (s + wa) + yi), BaseBlock(35, 5));
- else sess.setBlock(origin.add(x * (s + wa) - xi, y * (s + wa) + yi, +1), BaseBlock(35, 5));
+ if (!v) sess.setBlock(origin.add(x * (s + wa) - xi, -1, y * (s + wa) + yi), limeWoolBlock);
+ else sess.setBlock(origin.add(x * (s + wa) - xi, y * (s + wa) + yi, +1), limeWoolBlock);
}
}
if (visited[cell] && !wrong[cell] && visited[id(x, y - 1)] && !wrong[id(x, y - 1)] && noWallAbove[cell]) {
for (xi = 0; xi < s; xi++) for (yi = 1; yi <= wa; yi++) {
- if (!v) sess.setBlock(origin.add(x * (s + wa) + xi, -1, y * (s + wa) - yi), BaseBlock(35, 5));
- else sess.setBlock(origin.add(x * (s + wa) + xi, y * (s + wa) - yi, +1), BaseBlock(35, 5));
+ if (!v) sess.setBlock(origin.add(x * (s + wa) + xi, -1, y * (s + wa) - yi), limeWoolBlock);
+ else sess.setBlock(origin.add(x * (s + wa) + xi, y * (s + wa) - yi, +1), limeWoolBlock);
}
}
if (g) {
if (visited[cell] && !wrong[cell] && (!visited[id(x - 1, y)] || wrong[id(x - 1, y)]) && noWallLeft[cell] && cell != start) {
for (z = 0; z < h; z++) for (xi = 1; xi <= wa; xi++) for (yi = 0; yi < s; yi++) {
- if (!v) sess.setBlock(origin.add(x * (s + wa) - xi, z, y * (s + wa) + yi), BaseBlock(20));
- else sess.setBlock(origin.add(x * (s + wa) - xi, y * (s + wa) + yi, -z), BaseBlock(20));
+ if (!v) sess.setBlock(origin.add(x * (s + wa) - xi, z, y * (s + wa) + yi), glassBlock);
+ else sess.setBlock(origin.add(x * (s + wa) - xi, y * (s + wa) + yi, -z), glassBlock);
}
}
if ((!visited[cell] || wrong[cell]) && visited[id(x - 1, y)] && !wrong[id(x - 1, y)] && noWallLeft[cell] && id(x - 1, y) != end) {
for (z = 0; z < h; z++) for (xi = 1; xi <= wa; xi++) for (yi = 0; yi < s; yi++) {
- if (!v) sess.setBlock(origin.add(x * (s + wa) - xi, z, y * (s + wa) + yi), BaseBlock(20));
- else sess.setBlock(origin.add(x * (s + wa) - xi, y * (s + wa) + yi, -z), BaseBlock(20));
+ if (!v) sess.setBlock(origin.add(x * (s + wa) - xi, z, y * (s + wa) + yi), glassBlock);
+ else sess.setBlock(origin.add(x * (s + wa) - xi, y * (s + wa) + yi, -z), glassBlock);
}
}
if (visited[cell] && !wrong[cell] && (!visited[id(x, y - 1)] || wrong[id(x, y - 1)]) && noWallAbove[cell]) {
for (z = 0; z < h; z++) for (xi = 0; xi < s; xi++) for (yi = 1; yi <= wa; yi++) {
- if (!v) sess.setBlock(origin.add(x * (s + wa) + xi, z, y * (s + wa) - yi), BaseBlock(20));
- else sess.setBlock(origin.add(x * (s + wa) + xi, y * (s + wa) - yi, -z), BaseBlock(20));
+ if (!v) sess.setBlock(origin.add(x * (s + wa) + xi, z, y * (s + wa) - yi), glassBlock);
+ else sess.setBlock(origin.add(x * (s + wa) + xi, y * (s + wa) - yi, -z), glassBlock);
}
}
if ((!visited[cell] || wrong[cell]) && visited[id(x, y - 1)] && !wrong[id(x, y - 1)] && noWallAbove[cell]) {
for (z = 0; z < h; z++) for (xi = 0; xi < s; xi++) for (yi = 1; yi <= wa; yi++) {
- if (!v) sess.setBlock(origin.add(x * (s + wa) + xi, z, y * (s + wa) - yi), BaseBlock(20));
- else sess.setBlock(origin.add(x * (s + wa) + xi, y * (s + wa) - yi, -z), BaseBlock(20));
+ if (!v) sess.setBlock(origin.add(x * (s + wa) + xi, z, y * (s + wa) - yi), glassBlock);
+ else sess.setBlock(origin.add(x * (s + wa) + xi, y * (s + wa) - yi, -z), glassBlock);
}
}
}
@@ -333,22 +339,22 @@ if (so) {
if (re) {
if (wrong[cell]) {
for (yi = 0; yi < s; yi++) for (xi = 0; xi < s; xi++) {
- if (!v) sess.setBlock(origin.add(x * (s + wa) + xi, -1, y * (s + wa) + yi), BaseBlock(35, 14));
- else sess.setBlock(origin.add(x * (s + wa) + xi, y * (s + wa) + yi, +1), BaseBlock(35, 14));
+ if (!v) sess.setBlock(origin.add(x * (s + wa) + xi, -1, y * (s + wa) + yi), redWoolBlock);
+ else sess.setBlock(origin.add(x * (s + wa) + xi, y * (s + wa) + yi, +1), redWoolBlock);
}
}
if ((wrong[cell] || wrong[id(x - 1, y)]) && noWallLeft[cell]) {
for (xi = 1; xi <= wa; xi++) for (yi = 0; yi < s; yi++) {
- if (!v) sess.setBlock(origin.add(x * (s + wa) - xi, -1, y * (s + wa) + yi), BaseBlock(35, 14));
- else sess.setBlock(origin.add(x * (s + wa) - xi, y * (s + wa) + yi, +1), BaseBlock(35, 14));
+ if (!v) sess.setBlock(origin.add(x * (s + wa) - xi, -1, y * (s + wa) + yi), redWoolBlock);
+ else sess.setBlock(origin.add(x * (s + wa) - xi, y * (s + wa) + yi, +1), redWoolBlock);
}
}
if ((wrong[cell] || wrong[id(x, y - 1)]) && noWallAbove[cell]) {
for (xi = 0; xi < s; xi++) for (yi = 1; yi <= wa; yi++) {
- if (!v) sess.setBlock(origin.add(x * (s + wa) + xi, -1, y * (s + wa) - yi), BaseBlock(35, 14));
- else sess.setBlock(origin.add(x * (s + wa) + xi, y * (s + wa) - yi, +1), BaseBlock(35, 14));
+ if (!v) sess.setBlock(origin.add(x * (s + wa) + xi, -1, y * (s + wa) - yi), redWoolBlock);
+ else sess.setBlock(origin.add(x * (s + wa) + xi, y * (s + wa) - yi, +1), redWoolBlock);
}
}
}
@@ -356,22 +362,22 @@ if (so) {
if (bl) {
if (!visited[cell] && y < l && x < w) {
for (yi = 0; yi < s; yi++) for (xi = 0; xi < s; xi++) {
- if (!v) sess.setBlock(origin.add(x * (s + wa) + xi, -1, y * (s + wa) + yi), BaseBlock(35, 11));
- else sess.setBlock(origin.add(x * (s + wa) + xi, y * (s + wa) + yi, +1), BaseBlock(35, 11));
+ if (!v) sess.setBlock(origin.add(x * (s + wa) + xi, -1, y * (s + wa) + yi), blueWoolBlock);
+ else sess.setBlock(origin.add(x * (s + wa) + xi, y * (s + wa) + yi, +1), blueWoolBlock);
}
}
if ((!visited[cell] || !visited[id(x - 1, y)]) && noWallLeft[cell] && x > 0 && x < w) {
for (xi = 1; xi <= wa; xi++) for (yi = 0; yi < s; yi++) {
- if (!v) sess.setBlock(origin.add(x * (s + wa) - xi, -1, y * (s + wa) + yi), BaseBlock(35, 11));
- else sess.setBlock(origin.add(x * (s + wa) - xi, y * (s + wa) + yi, +1), BaseBlock(35, 11));
+ if (!v) sess.setBlock(origin.add(x * (s + wa) - xi, -1, y * (s + wa) + yi), blueWoolBlock);
+ else sess.setBlock(origin.add(x * (s + wa) - xi, y * (s + wa) + yi, +1), blueWoolBlock);
}
}
if ((!visited[cell] || !visited[id(x, y - 1)]) && noWallAbove[cell]) {
for (xi = 0; xi < s; xi++) for (yi = 1; yi <= wa; yi++) {
- if (!v) sess.setBlock(origin.add(x * (s + wa) + xi, -1, y * (s + wa) - yi), BaseBlock(35, 11));
- else sess.setBlock(origin.add(x * (s + wa) + xi, y * (s + wa) - yi, +1), BaseBlock(35, 11));
+ if (!v) sess.setBlock(origin.add(x * (s + wa) + xi, -1, y * (s + wa) - yi), blueWoolBlock);
+ else sess.setBlock(origin.add(x * (s + wa) + xi, y * (s + wa) - yi, +1), blueWoolBlock);
}
}
}
diff --git a/contrib/craftscripts/quickshot.js b/contrib/craftscripts/quickshot.js
index e47820ea7..27480e282 100644
--- a/contrib/craftscripts/quickshot.js
+++ b/contrib/craftscripts/quickshot.js
@@ -20,11 +20,11 @@
importPackage(Packages.com.sk89q.worldedit);
importPackage(Packages.com.sk89q.worldedit.blocks);
-var torchDirs = {}
-torchDirs[PlayerDirection.NORTH] = [2, 4];
-torchDirs[PlayerDirection.SOUTH] = [1, 3];
-torchDirs[PlayerDirection.WEST] = [3, 2];
-torchDirs[PlayerDirection.EAST] = [4, 1];
+var torchDirs = {};
+torchDirs[Direction.NORTH] = [2, 4];
+torchDirs[Direction.SOUTH] = [1, 3];
+torchDirs[Direction.WEST] = [3, 2];
+torchDirs[Direction.EAST] = [4, 1];
var pitches = {
"f#": 0,
diff --git a/contrib/craftscripts/roof.js b/contrib/craftscripts/roof.js
index 35e03c244..b1201ea3a 100644
--- a/contrib/craftscripts/roof.js
+++ b/contrib/craftscripts/roof.js
@@ -16,20 +16,20 @@
* along with this program. If not, see .
*/
-importPackage(Packages.java.io);
-importPackage(Packages.java.awt);
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 region = session.getRegion();
+var player = context.getPlayer();
+var region = session.getRegionSelector(player.getWorld()).getRegion();
context.checkArgs(1, 1, "");
var blocktype = context.getBlock(argv[1]);
-var cycles = region.getLength()
+var cycles = region.getLength();
if (region.getWidth() > cycles){
cycles = region.getWidth();
@@ -40,12 +40,12 @@ 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 = new Vector(
+ 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);
}
}
diff --git a/favs/build.gradle b/favs/build.gradle
index 778e6aee2..7aded4c06 100644
--- a/favs/build.gradle
+++ b/favs/build.gradle
@@ -1,3 +1,6 @@
+apply plugin: 'eclipse'
+apply plugin: 'maven'
+
repositories {
maven {url "https://ci.athion.net/job/FAWE-WorldGuard-1.13/lastSuccessfulBuild/artifact/mvn"}
}
diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/Brushes.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/Brushes.java
index 77fcc072b..3517a1d05 100644
--- a/favs/src/main/java/com/thevoxelbox/voxelsniper/Brushes.java
+++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/Brushes.java
@@ -79,7 +79,7 @@ public class Brushes
*/
public Set getSniperBrushHandles(Class extends IBrush> clazz)
{
- return new HashSet(brushes.get(clazz));
+ return new HashSet<>(brushes.get(clazz));
}
/**
diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/Message.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/Message.java
index 340fcf282..34e991325 100644
--- a/favs/src/main/java/com/thevoxelbox/voxelsniper/Message.java
+++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/Message.java
@@ -158,12 +158,9 @@ public class Message
}
else
{
- StringBuilder returnValueBuilder = new StringBuilder();
- returnValueBuilder.append(ChatColor.DARK_GREEN);
- returnValueBuilder.append("Block Types Selected: ");
- returnValueBuilder.append(ChatColor.AQUA);
- returnValueBuilder.append(snipeData.getVoxelList());
- snipeData.sendMessage(returnValueBuilder.toString());
+ String returnValueBuilder = ChatColor.DARK_GREEN + "Block Types Selected: " + ChatColor.AQUA
+ + snipeData.getVoxelList();
+ snipeData.sendMessage(returnValueBuilder);
}
}
}
diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/PaintingWrapper.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/PaintingWrapper.java
index 25df54ee1..78a75ef49 100644
--- a/favs/src/main/java/com/thevoxelbox/voxelsniper/PaintingWrapper.java
+++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/PaintingWrapper.java
@@ -40,8 +40,8 @@ public final class PaintingWrapper
@SuppressWarnings("deprecation")
public static void paint(final Player p, final boolean auto, final boolean back, final int choice)
{
- Location targetLocation = p.getTargetBlock((Set) null, 4).getLocation();
- Chunk paintingChunk = p.getTargetBlock((Set) null, 4).getLocation().getChunk();
+ Location targetLocation = p.getTargetBlock(null, 4).getLocation();
+ Chunk paintingChunk = p.getTargetBlock(null, 4).getLocation().getChunk();
Double bestDistanceMatch = 50D;
Painting bestMatch = null;
@@ -66,7 +66,7 @@ public final class PaintingWrapper
{
try
{
- final int i = bestMatch.getArt().getId() + (back ? -1 : 1) + Art.values().length % Art.values().length;
+ final int i = bestMatch.getArt().getId() + (back ? -1 : 1);
Art art = Art.getById(i);
if (art == null)
diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/SnipeData.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/SnipeData.java
index e997e5ec6..9e606daff 100644
--- a/favs/src/main/java/com/thevoxelbox/voxelsniper/SnipeData.java
+++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/SnipeData.java
@@ -77,7 +77,7 @@ public class SnipeData {
*/
private int voxelHeight = SnipeData.DEFAULT_VOXEL_HEIGHT;
/**
- * Voxel centroid -- set Cylynder center /vc #.
+ * Voxel centroid -- set Cylinder center /vc #.
*/
private int cCen = SnipeData.DEFAULT_CYLINDER_CENTER;
private int range = 0;
@@ -272,7 +272,7 @@ public class SnipeData {
* @param voxelId the voxelId to set
*/
public final void setVoxelId(final int voxelId) {
- if (WorldEdit.getInstance().getConfiguration().disallowedBlocks.contains(voxelId)) {
+ if (WorldEdit.getInstance().getConfiguration().disallowedBlocks.contains(BlockTypes.getFromStateId(voxelId).getId())) {
if (owner != null) {
Player plr = owner.getPlayer();
if (plr != null) {
@@ -325,4 +325,4 @@ public class SnipeData {
public static Class> inject() {
return SnipeData.class;
}
-}
\ No newline at end of file
+}
diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/Sniper.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/Sniper.java
index 4c8e102a9..b0ec73c77 100644
--- a/favs/src/main/java/com/thevoxelbox/voxelsniper/Sniper.java
+++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/Sniper.java
@@ -94,7 +94,7 @@ public class Sniper {
}
public String getCurrentToolId() {
- return getToolId((getPlayer().getItemInHand() != null) ? getPlayer().getItemInHand().getType() : null);
+ return getToolId((getPlayer().getInventory().getItemInMainHand() != null) ? getPlayer().getInventory().getItemInMainHand().getType() : null);
}
public String getToolId(Material itemInHand) {
@@ -169,17 +169,10 @@ public class Sniper {
try {
Player player = getPlayer();
final FawePlayer fp = FawePlayer.wrap(player);
- TaskManager.IMP.taskNow(new Runnable() {
- @Override
- public void run() {
- if (!fp.runAction(new Runnable() {
- @Override
- public void run() {
- snipeOnCurrentThread(fp, action, itemInHand, clickedBlock, clickedFace, sniperTool, toolId);
- }
- }, false, true)) {
- BBC.WORLDEDIT_COMMAND_LIMIT.send(fp);
- }
+ TaskManager.IMP.taskNow(() -> {
+ if (!fp.runAction(
+ () -> snipeOnCurrentThread(fp, action, itemInHand, clickedBlock, clickedFace, sniperTool, toolId), false, true)) {
+ BBC.WORLDEDIT_COMMAND_LIMIT.send(fp);
}
}, Fawe.isMainThread());
return true;
@@ -660,9 +653,7 @@ public class Sniper {
private IBrush instantiateBrush(Class extends IBrush> brush) {
try {
return brush.newInstance();
- } catch (InstantiationException e) {
- return null;
- } catch (IllegalAccessException e) {
+ } catch (InstantiationException | IllegalAccessException e) {
return null;
}
}
@@ -671,4 +662,4 @@ public class Sniper {
public static Class> inject() {
return Sniper.class;
}
-}
\ No newline at end of file
+}
diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/Undo.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/Undo.java
index 31c17960e..a999f7bf4 100644
--- a/favs/src/main/java/com/thevoxelbox/voxelsniper/Undo.java
+++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/Undo.java
@@ -26,9 +26,10 @@ package com.thevoxelbox.voxelsniper;
import org.bukkit.World;
import org.bukkit.block.Block;
+import org.bukkit.block.BlockState;
/**
- * Holds {@link org.bukkit.block.BlockState}s that can be later on used to reset those block
+ * Holds {@link BlockState}s that can be later on used to reset those block
* locations back to the recorded states.
*/
public class Undo {
@@ -67,4 +68,4 @@ public class Undo {
public void undo() {
}
-}
\ No newline at end of file
+}
diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/VoxelSniper.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/VoxelSniper.java
index f86410a6f..715d774fa 100644
--- a/favs/src/main/java/com/thevoxelbox/voxelsniper/VoxelSniper.java
+++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/VoxelSniper.java
@@ -169,6 +169,7 @@ public class VoxelSniper extends JavaPlugin
brushManager.registerSniperBrush(EntityRemovalBrush.class, "er", "entityremoval");
brushManager.registerSniperBrush(EraserBrush.class, "erase", "eraser");
brushManager.registerSniperBrush(ErodeBrush.class, "e", "erode");
+ brushManager.registerSniperBrush(ErodeBlendBrush.class, "eb", "erodeblend", "erodeblendball");
brushManager.registerSniperBrush(ExtrudeBrush.class, "ex", "extrude");
brushManager.registerSniperBrush(FillDownBrush.class, "fd", "filldown");
brushManager.registerSniperBrush(FlatOceanBrush.class, "fo", "flatocean");
@@ -218,6 +219,7 @@ public class VoxelSniper extends JavaPlugin
brushManager.registerSniperBrush(VoxelDiscBrush.class, "vd", "voxeldisc");
brushManager.registerSniperBrush(VoxelDiscFaceBrush.class, "vdf", "voxeldiscface");
brushManager.registerSniperBrush(WarpBrush.class, "w", "warp");
+ brushManager.registerSniperBrush(WallSider.class, "wallsider", "sider");
}
public void setupCommand(final String label, final FaweCommand cmd) {
diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/VoxelSniperListener.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/VoxelSniperListener.java
index 0c7d26c4c..ffa8189d5 100644
--- a/favs/src/main/java/com/thevoxelbox/voxelsniper/VoxelSniperListener.java
+++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/VoxelSniperListener.java
@@ -26,7 +26,7 @@ public class VoxelSniperListener implements Listener
private static final String SNIPER_PERMISSION = "voxelsniper.sniper";
private final VoxelSniper plugin;
- private Map commands = new HashMap();
+ private Map commands = new HashMap<>();
/**
* @param plugin
@@ -79,35 +79,32 @@ public class VoxelSniperListener implements Listener
}
FawePlayer fp = FawePlayer.wrap(player);
- if (!fp.runAction(new Runnable() {
- @Override
- public void run() {
- ExceptionConverter exceptionConverter = CommandManager.getInstance().getExceptionConverter();
+ if (!fp.runAction(() -> {
+ ExceptionConverter exceptionConverter = CommandManager.getInstance().getExceptionConverter();
+ try {
try {
- try {
- found.onCommand(player, split);
- return;
- } catch (Throwable t) {
- Throwable next = t;
+ found.onCommand(player, split);
+ return;
+ } catch (Throwable t) {
+ Throwable next = t;
+ exceptionConverter.convert(next);
+ while (next.getCause() != null) {
+ next = next.getCause();
exceptionConverter.convert(next);
- while (next.getCause() != null) {
- next = next.getCause();
- exceptionConverter.convert(next);
- }
- throw next;
}
- } catch (CommandException e) {
- String message = e.getMessage();
- if (message != null) {
- fp.sendMessage(e.getMessage());
- return;
- }
- e.printStackTrace();
- } catch (Throwable e) {
- e.printStackTrace();
+ throw next;
}
- fp.sendMessage("An unknown FAWE error has occurred! Please see console.");
+ } catch (CommandException e) {
+ String message = e.getMessage();
+ if (message != null) {
+ fp.sendMessage(e.getMessage());
+ return;
+ }
+ e.printStackTrace();
+ } catch (Throwable e) {
+ e.printStackTrace();
}
+ fp.sendMessage("An unknown FAWE error has occurred! Please see console.");
}, false, true)) {
BBC.WORLDEDIT_COMMAND_LIMIT.send(fp);
}
diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/BiomeBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/BiomeBrush.java
index 788574e01..2e2ea9e73 100644
--- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/BiomeBrush.java
+++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/BiomeBrush.java
@@ -82,17 +82,18 @@ public class BiomeBrush extends Brush
if (args[1].equalsIgnoreCase("info"))
{
v.sendMessage(ChatColor.GOLD + "Biome Brush Parameters:");
- String availableBiomes = "";
+ StringBuilder availableBiomes = new StringBuilder();
for (final Biome biome : Biome.values())
{
- if (availableBiomes.isEmpty())
+ if (availableBiomes.length() == 0)
{
- availableBiomes = ChatColor.DARK_GREEN + biome.name();
+ availableBiomes = new StringBuilder(ChatColor.DARK_GREEN + biome.name());
continue;
}
- availableBiomes += ChatColor.RED + ", " + ChatColor.DARK_GREEN + biome.name();
+ availableBiomes.append(ChatColor.RED + ", " + ChatColor.DARK_GREEN)
+ .append(biome.name());
}
v.sendMessage(ChatColor.DARK_BLUE + "Available biomes: " + availableBiomes);
@@ -100,15 +101,15 @@ public class BiomeBrush extends Brush
else
{
// allows biome names with spaces in their name
- String biomeName = args[1];
+ StringBuilder biomeName = new StringBuilder(args[1]);
for (int i = 2; i < args.length; i++)
{
- biomeName += " " + args[i];
+ biomeName.append(" ").append(args[i]);
}
for (final Biome biome : Biome.values())
{
- if (biome.name().equalsIgnoreCase(biomeName))
+ if (biome.name().equalsIgnoreCase(biomeName.toString()))
{
this.selectedBiome = biome;
break;
diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/BlendBallBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/BlendBallBrush.java
index 1da2ec01d..34da2c707 100644
--- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/BlendBallBrush.java
+++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/BlendBallBrush.java
@@ -1,5 +1,6 @@
package com.thevoxelbox.voxelsniper.brush;
+import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.block.BlockTypes;
import com.thevoxelbox.voxelsniper.SnipeData;
import com.thevoxelbox.voxelsniper.Undo;
@@ -48,10 +49,8 @@ public class BlendBallBrush extends BlendBrushBase
{
for (int y = 0; y <= brushSizeDoubled; y++)
{
- for (int z = 0; z <= brushSizeDoubled; z++)
- {
- newMaterials[x][y][z] = oldMaterials[x + 1][y + 1][z + 1];
- }
+ System.arraycopy(oldMaterials[x + 1][y + 1], 1, newMaterials[x][y], 0,
+ brushSizeDoubled + 1);
}
}
@@ -82,7 +81,7 @@ public class BlendBallBrush extends BlendBrushBase
}
// Find most common neighboring material.
- for (BlockTypes type : BlockTypes.values)
+ for (BlockType type : BlockTypes.values)
{
int i = type.getInternalId();
if (materialFrequency[i] > modeMatCount && !(this.excludeAir && type.getMaterial().isAir()) && !(this.excludeWater && (type == BlockTypes.WATER)))
@@ -94,7 +93,7 @@ public class BlendBallBrush extends BlendBrushBase
// Make sure there'world not a tie for most common
for (int i = 0; i < modeMatId; i++)
{
- BlockTypes type = BlockTypes.get(i);
+ BlockType type = BlockTypes.get(i);
if (materialFrequency[i] == modeMatCount && !(this.excludeAir && type.getMaterial().isAir()) && !(this.excludeWater && (type == BlockTypes.WATER)))
{
tiecheck = false;
diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/BlendDiscBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/BlendDiscBrush.java
index 75130f9e9..8e2434f61 100644
--- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/BlendDiscBrush.java
+++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/BlendDiscBrush.java
@@ -1,5 +1,6 @@
package com.thevoxelbox.voxelsniper.brush;
+import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.block.BlockTypes;
import com.thevoxelbox.voxelsniper.SnipeData;
import com.thevoxelbox.voxelsniper.Undo;
@@ -41,10 +42,7 @@ public class BlendDiscBrush extends BlendBrushBase
// Log current materials into newmats
for (int x = 0; x <= brushSizeDoubled; x++)
{
- for (int z = 0; z <= brushSizeDoubled; z++)
- {
- newMaterials[x][z] = oldMaterials[x + 1][z + 1];
- }
+ System.arraycopy(oldMaterials[x + 1], 1, newMaterials[x], 0, brushSizeDoubled + 1);
}
// Blend materials
@@ -69,7 +67,7 @@ public class BlendDiscBrush extends BlendBrushBase
}
// Find most common neighboring material.
- for (BlockTypes type : BlockTypes.values)
+ for (BlockType type : BlockTypes.values)
{
int i = type.getInternalId();
if (materialFrequency[i] > modeMatCount && !(this.excludeAir && type.getMaterial().isAir()) && !(this.excludeWater && (type == BlockTypes.WATER)))
@@ -81,7 +79,7 @@ public class BlendDiscBrush extends BlendBrushBase
// Make sure there'world not a tie for most common
for (int i = 0; i < modeMatId; i++)
{
- BlockTypes type = BlockTypes.get(i);
+ BlockType type = BlockTypes.get(i);
if (materialFrequency[i] == modeMatCount && !(this.excludeAir && type.getMaterial().isAir()) && !(this.excludeWater && (type == BlockTypes.WATER)))
{
tiecheck = false;
diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/BlendVoxelBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/BlendVoxelBrush.java
index 30cf38268..088797779 100644
--- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/BlendVoxelBrush.java
+++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/BlendVoxelBrush.java
@@ -1,5 +1,6 @@
package com.thevoxelbox.voxelsniper.brush;
+import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.block.BlockTypes;
import com.thevoxelbox.voxelsniper.SnipeData;
import com.thevoxelbox.voxelsniper.Undo;
@@ -48,10 +49,8 @@ public class BlendVoxelBrush extends BlendBrushBase
{
for (int y = 0; y <= brushSizeDoubled; y++)
{
- for (int z = 0; z <= brushSizeDoubled; z++)
- {
- newMaterials[x][y][z] = oldMaterials[x + 1][y + 1][z + 1];
- }
+ System.arraycopy(oldMaterials[x + 1][y + 1], 1, newMaterials[x][y], 0,
+ brushSizeDoubled + 1);
}
}
@@ -82,7 +81,7 @@ public class BlendVoxelBrush extends BlendBrushBase
}
// Find most common neighboring material.
- for (BlockTypes type : BlockTypes.values)
+ for (BlockType type : BlockTypes.values)
{
int i = type.getInternalId();
if (materialFrequency[i] > modeMatCount && !(this.excludeAir && type.getMaterial().isAir()) && !(this.excludeWater && (type == BlockTypes.WATER)))
@@ -94,7 +93,7 @@ public class BlendVoxelBrush extends BlendBrushBase
// Make sure there'world not a tie for most common
for (int i = 0; i < modeMatId; i++)
{
- BlockTypes type = BlockTypes.get(i);
+ BlockType type = BlockTypes.get(i);
if (materialFrequency[i] == modeMatCount && !(this.excludeAir && type.getMaterial().isAir()) && !(this.excludeWater && (type == BlockTypes.WATER)))
{
tiecheck = false;
diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/BlendVoxelDiscBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/BlendVoxelDiscBrush.java
index 56a670f0b..089710e05 100644
--- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/BlendVoxelDiscBrush.java
+++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/BlendVoxelDiscBrush.java
@@ -1,5 +1,6 @@
package com.thevoxelbox.voxelsniper.brush;
+import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.block.BlockTypes;
import com.thevoxelbox.voxelsniper.SnipeData;
import com.thevoxelbox.voxelsniper.Undo;
@@ -41,10 +42,7 @@ public class BlendVoxelDiscBrush extends BlendBrushBase
// Log current materials into newmats
for (int x = 0; x <= brushSizeDoubled; x++)
{
- for (int z = 0; z <= brushSizeDoubled; z++)
- {
- newMaterials[x][z] = oldMaterials[x + 1][z + 1];
- }
+ System.arraycopy(oldMaterials[x + 1], 1, newMaterials[x], 0, brushSizeDoubled + 1);
}
// Blend materials
@@ -69,7 +67,7 @@ public class BlendVoxelDiscBrush extends BlendBrushBase
}
// Find most common neighboring material.
- for (BlockTypes type : BlockTypes.values)
+ for (BlockType type : BlockTypes.values)
{
int i = type.getInternalId();
if (materialFrequency[i] > modeMatCount && !(this.excludeAir && type.getMaterial().isAir()) && !(this.excludeWater && (type == BlockTypes.WATER)))
@@ -81,7 +79,7 @@ public class BlendVoxelDiscBrush extends BlendBrushBase
// Make sure there'world not a tie for most common
for (int i = 0; i < modeMatId; i++)
{
- BlockTypes type = BlockTypes.get(i);
+ BlockType type = BlockTypes.get(i);
if (materialFrequency[i] == modeMatCount && !(this.excludeAir && type.getMaterial().isAir()) && !(this.excludeWater && (type == BlockTypes.WATER)))
{
tiecheck = false;
diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/BlobBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/BlobBrush.java
index cf51dca5e..0279d2f9e 100644
--- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/BlobBrush.java
+++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/BlobBrush.java
@@ -120,10 +120,7 @@ public class BlobBrush extends PerformBrush
{
for (int y = brushSizeDoubled; y >= 0; y--)
{
- for (int z = brushSizeDoubled; z >= 0; z--)
- {
- splat[x][y][z] = tempSplat[x][y][z];
- }
+ System.arraycopy(tempSplat[x][y], 0, splat[x][y], 0, brushSizeDoubled + 1);
}
}
}
@@ -218,10 +215,7 @@ public class BlobBrush extends PerformBrush
{
for (int y = brushSizeDoubled; y >= 0; y--)
{
- for (int z = brushSizeDoubled; z >= 0; z--)
- {
- splat[x][y][z] = tempSplat[x][y][z];
- }
+ System.arraycopy(tempSplat[x][y], 0, splat[x][y], 0, brushSizeDoubled + 1);
}
}
}
diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/BlockResetBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/BlockResetBrush.java
index 6738b696a..180939755 100644
--- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/BlockResetBrush.java
+++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/BlockResetBrush.java
@@ -13,7 +13,7 @@ import org.bukkit.block.Block;
*/
public class BlockResetBrush extends Brush
{
- private static final ArrayList DENIED_UPDATES = new ArrayList();
+ private static final ArrayList DENIED_UPDATES = new ArrayList<>();
static
{
diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/BlockResetSurfaceBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/BlockResetSurfaceBrush.java
index de93fa6eb..332699ce2 100644
--- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/BlockResetSurfaceBrush.java
+++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/BlockResetSurfaceBrush.java
@@ -4,8 +4,8 @@ import java.util.ArrayList;
import com.boydti.fawe.bukkit.wrapper.AsyncBlock;
import com.boydti.fawe.bukkit.wrapper.AsyncWorld;
-import com.sk89q.worldedit.blocks.BlockMaterial;
import com.sk89q.worldedit.bukkit.BukkitAdapter;
+import com.sk89q.worldedit.world.registry.BlockMaterial;
import com.thevoxelbox.voxelsniper.Message;
import com.thevoxelbox.voxelsniper.SnipeData;
diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/DomeBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/DomeBrush.java
index 19e1322a8..4983bf52a 100644
--- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/DomeBrush.java
+++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/DomeBrush.java
@@ -54,7 +54,7 @@ public class DomeBrush extends Brush
final int absoluteHeight = Math.abs(v.getVoxelHeight());
final boolean negative = v.getVoxelHeight() < 0;
- final Set changeablePositions = new HashSet();
+ final Set changeablePositions = new HashSet<>();
final Undo undo = new Undo();
diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/EntityRemovalBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/EntityRemovalBrush.java
index 0d6871621..727a6a58c 100644
--- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/EntityRemovalBrush.java
+++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/EntityRemovalBrush.java
@@ -16,7 +16,7 @@ import java.util.regex.PatternSyntaxException;
*/
public class EntityRemovalBrush extends Brush
{
- private final List exemptions = new ArrayList(3);
+ private final List exemptions = new ArrayList<>(3);
/**
*
@@ -82,7 +82,7 @@ public class EntityRemovalBrush extends Brush
private boolean isClassInExemptionList(Class extends Entity> entityClass) throws PatternSyntaxException
{
// Create a list of superclasses and interfaces implemented by the current entity type
- final List entityClassHierarchy = new ArrayList();
+ final List entityClassHierarchy = new ArrayList<>();
Class> currentClass = entityClass;
while (currentClass != null && !currentClass.equals(Object.class))
diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/ErodeBlendBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/ErodeBlendBrush.java
new file mode 100644
index 000000000..3f81e05f4
--- /dev/null
+++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/ErodeBlendBrush.java
@@ -0,0 +1,52 @@
+package com.thevoxelbox.voxelsniper.brush;
+
+import com.thevoxelbox.voxelsniper.Message;
+import com.thevoxelbox.voxelsniper.SnipeData;
+
+public class ErodeBlendBrush extends Brush{
+
+ private BlendBallBrush blendBall;
+ private ErodeBrush erode;
+
+ public ErodeBlendBrush() {
+ this.blendBall = new BlendBallBrush();
+ this.erode = new ErodeBrush();
+ this.setName("Erode BlendBall");
+ }
+
+ @Override
+ protected final void arrow(final SnipeData v) {
+ this.blendBall.excludeAir = false;
+ this.blendBall.setTargetBlock(this.getTargetBlock());
+ this.blendBall.arrow(v);
+ this.erode.setTargetBlock(this.getTargetBlock());
+ this.erode.arrow(v);
+ }
+
+ @Override
+ protected final void powder(final SnipeData v) {
+ this.blendBall.excludeAir = false;
+ this.blendBall.setTargetBlock(this.getTargetBlock());
+ this.blendBall.arrow(v);
+ this.erode.setTargetBlock(this.getTargetBlock());
+ this.erode.powder(v);
+ }
+
+ @Override
+ public final void parameters(final String[] par, final SnipeData v) {
+ this.blendBall.parameters(par, v);
+ this.erode.parameters(par, v);
+ }
+
+ @Override
+ public String getPermissionNode() {
+ return "voxelsniper.brush.erodeblend";
+ }
+
+ @Override
+ public void info(Message vm) {
+ this.erode.info(vm);
+ this.blendBall.info(vm);
+ }
+
+}
diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/ErodeBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/ErodeBrush.java
index 0f678c88b..6d2b5e12e 100644
--- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/ErodeBrush.java
+++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/ErodeBrush.java
@@ -133,7 +133,7 @@ public class ErodeBrush extends Brush
int count = 0;
- final Map blockCount = new HashMap();
+ final Map blockCount = new HashMap<>();
for (final Vector vector : ErodeBrush.FACES_TO_CHECK)
{
@@ -363,8 +363,8 @@ public class ErodeBrush extends Brush
public BlockChangeTracker(final AsyncWorld world)
{
- this.blockChanges = new HashMap>();
- this.flatChanges = new HashMap();
+ this.blockChanges = new HashMap<>();
+ this.flatChanges = new HashMap<>();
this.world = world;
}
@@ -400,7 +400,7 @@ public class ErodeBrush extends Brush
{
if (!this.blockChanges.containsKey(iteration))
{
- this.blockChanges.put(iteration, new HashMap());
+ this.blockChanges.put(iteration, new HashMap<>());
}
this.blockChanges.get(iteration).put(position, changedBlock);
diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/GenerateTreeBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/GenerateTreeBrush.java
index 4a9067442..e38d8e277 100644
--- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/GenerateTreeBrush.java
+++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/GenerateTreeBrush.java
@@ -24,7 +24,7 @@ public class GenerateTreeBrush extends Brush
{
// Tree Variables.
private Random randGenerator = new Random();
- private ArrayList branchBlocks = new ArrayList();
+ private ArrayList branchBlocks = new ArrayList<>();
private Undo undo;
// If these default values are edited. Remember to change default values in the default preset.
private Material leafType = Material.OAK_LEAVES;
diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/HeatRayBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/HeatRayBrush.java
index 1ac689d24..b50611818 100644
--- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/HeatRayBrush.java
+++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/HeatRayBrush.java
@@ -44,7 +44,7 @@ public class HeatRayBrush extends Brush
private static final double REQUIRED_FIRE_DENSITY = -0.25;
private static final double REQUIRED_AIR_DENSITY = 0;
- private static final ArrayList FLAMABLE_BLOCKS = new ArrayList();
+ private static final ArrayList FLAMABLE_BLOCKS = new ArrayList<>();
private int octaves = 5;
private double frequency = 1;
diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/JockeyBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/JockeyBrush.java
index a4477dd1b..c1e579771 100644
--- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/JockeyBrush.java
+++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/JockeyBrush.java
@@ -83,11 +83,11 @@ public class JockeyBrush extends Brush
{
if (jockeyType == JockeyType.INVERSE_PLAYER_ONLY || jockeyType == JockeyType.INVERSE_ALL_ENTITIES)
{
- player.setPassenger(closest);
+ player.addPassenger(closest);
}
else
{
- closest.setPassenger(player);
+ closest.addPassenger(player);
jockeyedEntity = closest;
}
v.sendMessage(ChatColor.GREEN + "You are now saddles on entity: " + closest.getEntityId());
@@ -113,7 +113,7 @@ public class JockeyBrush extends Brush
{
if (jockeyType == JockeyType.STACK_ALL_ENTITIES)
{
- lastEntity.setPassenger(entity);
+ lastEntity.addPassenger(entity);
lastEntity = entity;
stackHeight++;
}
@@ -121,7 +121,7 @@ public class JockeyBrush extends Brush
{
if (entity instanceof Player)
{
- lastEntity.setPassenger(entity);
+ lastEntity.addPassenger(entity);
lastEntity = entity;
stackHeight++;
}
diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/MoveBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/MoveBrush.java
index b59d0ece1..9329fbf5f 100644
--- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/MoveBrush.java
+++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/MoveBrush.java
@@ -58,7 +58,7 @@ public class MoveBrush extends Brush
final AsyncWorld world = selection.getBlockStates().get(0).getWorld();
final Undo undo = new Undo();
- final HashSet undoSet = new HashSet();
+ final HashSet undoSet = new HashSet<>();
final Selection newSelection = new Selection();
final Location movedLocation1 = selection.getLocation1();
@@ -214,7 +214,7 @@ public class MoveBrush extends Brush
/**
* Calculated BlockStates of the selection.
*/
- private final ArrayList blockStates = new ArrayList();
+ private final ArrayList blockStates = new ArrayList<>();
/**
*
*/
diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/OverlayBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/OverlayBrush.java
index fa599b04d..e8a3b9ea7 100644
--- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/OverlayBrush.java
+++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/OverlayBrush.java
@@ -1,7 +1,9 @@
package com.thevoxelbox.voxelsniper.brush;
-import com.sk89q.worldedit.blocks.BlockMaterial;
+import com.sk89q.worldedit.bukkit.BukkitAdapter;
+import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.block.BlockTypes;
+import com.sk89q.worldedit.world.registry.BlockMaterial;
import com.thevoxelbox.voxelsniper.Message;
import com.thevoxelbox.voxelsniper.SnipeData;
import com.thevoxelbox.voxelsniper.brush.perform.PerformBrush;
@@ -13,8 +15,7 @@ import org.bukkit.Material;
*
* @author Gavjenks
*/
-public class OverlayBrush extends PerformBrush
-{
+public class OverlayBrush extends PerformBrush {
private static final int DEFAULT_DEPTH = 3;
private int depth = DEFAULT_DEPTH;
private boolean allBlocks = false;
@@ -22,40 +23,38 @@ public class OverlayBrush extends PerformBrush
/**
*
*/
- public OverlayBrush()
- {
+ public OverlayBrush() {
this.setName("Overlay (Topsoil Filling)");
}
- private void overlay(final SnipeData v)
- {
+ private void overlay(final SnipeData v) {
final int brushSize = v.getBrushSize();
final double brushSizeSquared = Math.pow(brushSize + 0.5, 2);
- for (int z = brushSize; z >= -brushSize; z--)
- {
- for (int x = brushSize; x >= -brushSize; x--)
- {
+ for (int z = brushSize; z >= -brushSize; z--) {
+ for (int x = brushSize; x >= -brushSize; x--) {
// check if column is valid
// column is valid if it has no solid block right above the clicked layer
- final int materialId = this.getBlockIdAt(this.getTargetBlock().getX() + x, this.getTargetBlock().getY() + 1, this.getTargetBlock().getZ() + z);
- if (isIgnoredBlock(materialId))
- {
- if ((Math.pow(x, 2) + Math.pow(z, 2)) <= brushSizeSquared)
- {
- for (int y = this.getTargetBlock().getY(); y > 0; y--)
- {
+ final int materialId = this.getBlockIdAt(this.getTargetBlock().getX() + x,
+ this.getTargetBlock().getY() + 1, this.getTargetBlock().getZ() + z);
+ if (isIgnoredBlock(materialId)) {
+ if ((Math.pow(x, 2) + Math.pow(z, 2)) <= brushSizeSquared) {
+ for (int y = this.getTargetBlock().getY(); y > 0; y--) {
// check for surface
- final int layerBlockId = this.getBlockIdAt(this.getTargetBlock().getX() + x, y, this.getTargetBlock().getZ() + z);
- if (!isIgnoredBlock(layerBlockId))
- {
- for (int currentDepth = y; y - currentDepth < depth; currentDepth--)
- {
- final int currentBlockId = this.getBlockIdAt(this.getTargetBlock().getX() + x, currentDepth, this.getTargetBlock().getZ() + z);
- if (isOverrideableMaterial(currentBlockId))
- {
- this.current.perform(this.clampY(this.getTargetBlock().getX() + x, currentDepth, this.getTargetBlock().getZ() + z));
+ final int layerBlockId =
+ this.getBlockIdAt(this.getTargetBlock().getX() + x, y,
+ this.getTargetBlock().getZ() + z);
+ if (!isIgnoredBlock(layerBlockId)) {
+ for (int currentDepth = y;
+ y - currentDepth < depth; currentDepth--) {
+ final int currentBlockId =
+ this.getBlockIdAt(this.getTargetBlock().getX() + x,
+ currentDepth, this.getTargetBlock().getZ() + z);
+ if (isOverrideableMaterial(currentBlockId)) {
+ this.current.perform(
+ this.clampY(this.getTargetBlock().getX() + x,
+ currentDepth, this.getTargetBlock().getZ() + z));
}
}
break;
@@ -69,82 +68,75 @@ public class OverlayBrush extends PerformBrush
v.owner().storeUndo(this.current.getUndo());
}
- @SuppressWarnings("deprecation")
- private boolean isIgnoredBlock(int materialId)
- {
- BlockTypes type = BlockTypes.get(materialId);
- switch (type) {
- case WATER:
- case LAVA:
- case CACTUS:
- return true;
+ @SuppressWarnings("deprecation") private boolean isIgnoredBlock(int materialId) {
+ BlockType type = BlockTypes.get(materialId);
+ String s = type.getResource().toUpperCase();
+ if (type == BlockTypes.WATER || type == BlockTypes.LAVA || type == BlockTypes.CACTUS) {
+ return true;
}
BlockMaterial mat = type.getMaterial();
return mat.isTranslucent();
}
- @SuppressWarnings("deprecation")
- private boolean isOverrideableMaterial(int materialId)
- {
+ @SuppressWarnings("deprecation") private boolean isOverrideableMaterial(int materialId) {
BlockMaterial mat = BlockTypes.get(materialId).getMaterial();
- if (allBlocks && !(mat.isAir()))
- {
+ if (allBlocks && !(mat.isAir())) {
return true;
}
- if (!mat.isFragileWhenPushed() && mat.isFullCube()) {
- return true;
- }
- return false;
+ return !mat.isFragileWhenPushed() && mat.isFullCube();
}
- private void overlayTwo(final SnipeData v)
- {
+ private void overlayTwo(final SnipeData v) {
final int brushSize = v.getBrushSize();
final double brushSizeSquared = Math.pow(brushSize + 0.5, 2);
final int[][] memory = new int[brushSize * 2 + 1][brushSize * 2 + 1];
- for (int z = brushSize; z >= -brushSize; z--)
- {
- for (int x = brushSize; x >= -brushSize; x--)
- {
+ for (int z = brushSize; z >= -brushSize; z--) {
+ for (int x = brushSize; x >= -brushSize; x--) {
boolean surfaceFound = false;
- for (int y = this.getTargetBlock().getY(); y > 0 && !surfaceFound; y--)
- { // start scanning from the height you clicked at
- if (memory[x + brushSize][z + brushSize] != 1)
- { // if haven't already found the surface in this column
- if ((Math.pow(x, 2) + Math.pow(z, 2)) <= brushSizeSquared)
- { // if inside of the column...
- if (!this.getBlockAt(this.getTargetBlock().getX() + x, y - 1, this.getTargetBlock().getZ() + z).isEmpty())
- { // if not a floating block (like one of Notch'world pools)
- if (this.getBlockAt(this.getTargetBlock().getX() + x, y + 1, this.getTargetBlock().getZ() + z).isEmpty())
- { // must start at surface... this prevents it filling stuff in if
+ for (int y = this.getTargetBlock().getY();
+ y > 0 && !surfaceFound; y--) { // start scanning from the height you clicked at
+ if (memory[x + brushSize][z + brushSize]
+ != 1) { // if haven't already found the surface in this column
+ if ((Math.pow(x, 2) + Math.pow(z, 2))
+ <= brushSizeSquared) { // if inside of the column...
+ if (!this.getBlockAt(this.getTargetBlock().getX() + x, y - 1,
+ this.getTargetBlock().getZ() + z)
+ .isEmpty()) { // if not a floating block (like one of Notch'world pools)
+ if (this.getBlockAt(this.getTargetBlock().getX() + x, y + 1,
+ this.getTargetBlock().getZ() + z)
+ .isEmpty()) { // must start at surface... this prevents it filling stuff in if
// you click in a wall and it starts out below surface.
- if (!this.allBlocks)
- { // if the override parameter has not been activated, go to the switch that filters out manmade stuff.
+ if (!this.allBlocks) { // if the override parameter has not been activated, go to the switch that filters out manmade stuff.
- BlockTypes type = BlockTypes.get(this.getBlockIdAt(this.getTargetBlock().getX() + x, y, this.getTargetBlock().getZ() + z));
+ BlockType type = BukkitAdapter.asBlockType((this
+ .getBlockType(this.getTargetBlock().getX() + x, y,
+ this.getTargetBlock().getZ() + z)));
BlockMaterial mat = type.getMaterial();
- if (mat.isSolid() && mat.isFullCube() && !mat.hasContainer()) {
+ if (mat.isSolid() && mat.isFullCube() && !mat
+ .hasContainer()) {
for (int d = 1; (d < this.depth + 1); d++) {
- this.current.perform(this.clampY(this.getTargetBlock().getX() + x, y + d, this.getTargetBlock().getZ() + z)); // fills down as many layers as you specify
+ this.current.perform(
+ this.clampY(this.getTargetBlock().getX() + x,
+ y + d, this.getTargetBlock().getZ()
+ + z)); // fills down as many layers as you specify
// in parameters
- memory[x + brushSize][z + brushSize] = 1; // stop it from checking any other blocks in this vertical 1x1 column.
+ memory[x + brushSize][z + brushSize] =
+ 1; // stop it from checking any other blocks in this vertical 1x1 column.
}
surfaceFound = true;
- continue;
- } else {
- continue;
}
- }
- else
- {
- for (int d = 1; (d < this.depth + 1); d++)
- {
- this.current.perform(this.clampY(this.getTargetBlock().getX() + x, y + d, this.getTargetBlock().getZ() + z)); // fills down as many layers as you specify in
+ } else {
+ for (int d = 1; (d < this.depth + 1); d++) {
+ this.current.perform(
+ this.clampY(this.getTargetBlock().getX() + x, y + d,
+ this.getTargetBlock().getZ()
+ + z)); // fills down as many layers as you specify in
// parameters
- memory[x + brushSize][z + brushSize] = 1; // stop it from checking any other blocks in this vertical 1x1 column.
+ memory[x + brushSize][z + brushSize] =
+ 1; // stop it from checking any other blocks in this vertical 1x1 column.
}
surfaceFound = true;
}
@@ -160,74 +152,58 @@ public class OverlayBrush extends PerformBrush
v.owner().storeUndo(this.current.getUndo());
}
- @Override
- protected final void arrow(final SnipeData v)
- {
+ @Override protected final void arrow(final SnipeData v) {
this.overlay(v);
}
- @Override
- protected final void powder(final SnipeData v)
- {
+ @Override protected final void powder(final SnipeData v) {
this.overlayTwo(v);
}
- @Override
- public final void info(final Message vm)
- {
+ @Override public final void info(final Message vm) {
vm.brushName(this.getName());
vm.size();
}
- @Override
- public final void parameters(final String[] par, final SnipeData v)
- {
- for (int i = 1; i < par.length; i++)
- {
+ @Override public final void parameters(final String[] par, final SnipeData v) {
+ for (int i = 1; i < par.length; i++) {
final String parameter = par[i];
- if (parameter.equalsIgnoreCase("info"))
- {
+ if (parameter.equalsIgnoreCase("info")) {
v.sendMessage(ChatColor.GOLD + "Overlay brush parameters:");
- v.sendMessage(ChatColor.AQUA + "d[number] (ex: d3) How many blocks deep you want to replace from the surface.");
- v.sendMessage(ChatColor.BLUE + "all (ex: /b over all) Sets the brush to overlay over ALL materials, not just natural surface ones (will no longer ignore trees and buildings). The parameter /some will set it back to default.");
+ v.sendMessage(ChatColor.AQUA
+ + "d[number] (ex: d3) How many blocks deep you want to replace from the surface.");
+ v.sendMessage(ChatColor.BLUE
+ + "all (ex: /b over all) Sets the brush to overlay over ALL materials, not just natural surface ones (will no longer ignore trees and buildings). The parameter /some will set it back to default.");
return;
}
- if (parameter.startsWith("d"))
- {
+ if (parameter.startsWith("d")) {
try {
this.depth = Integer.parseInt(parameter.replace("d", ""));
- if (this.depth < 1)
- {
+ if (this.depth < 1) {
this.depth = 1;
}
v.sendMessage(ChatColor.AQUA + "Depth set to " + this.depth);
- } catch (NumberFormatException e) {
+ } catch (NumberFormatException e) {
v.sendMessage(ChatColor.RED + "Depth isn't a number.");
}
- }
- else if (parameter.startsWith("all"))
- {
+ } else if (parameter.startsWith("all")) {
this.allBlocks = true;
v.sendMessage(ChatColor.BLUE + "Will overlay over any block." + this.depth);
- }
- else if (parameter.startsWith("some"))
- {
+ } else if (parameter.startsWith("some")) {
this.allBlocks = false;
- v.sendMessage(ChatColor.BLUE + "Will overlay only natural block types." + this.depth);
- }
- else
- {
- v.sendMessage(ChatColor.RED + "Invalid brush parameters! use the info parameter to display parameter info.");
+ v.sendMessage(
+ ChatColor.BLUE + "Will overlay only natural block types." + this.depth);
+ } else {
+ v.sendMessage(ChatColor.RED
+ + "Invalid brush parameters! use the info parameter to display parameter info.");
}
}
}
- @Override
- public String getPermissionNode()
- {
+ @Override public String getPermissionNode() {
return "voxelsniper.brush.overlay";
}
}
diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/PullBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/PullBrush.java
index 7ec40bfe4..83c4a21bb 100644
--- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/PullBrush.java
+++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/PullBrush.java
@@ -14,7 +14,7 @@ import java.util.HashSet;
*/
public class PullBrush extends Brush
{
- private final HashSet surface = new HashSet();
+ private final HashSet surface = new HashSet<>();
private int vh;
private double c1 = 1;
private double c2 = 0;
diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/Rot2DBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/Rot2DBrush.java
index 90733c6a7..b7b30c599 100644
--- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/Rot2DBrush.java
+++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/Rot2DBrush.java
@@ -163,16 +163,11 @@ public class Rot2DBrush extends Brush
{
this.bSize = v.getBrushSize();
- switch (this.mode)
- {
- case 0:
- this.getMatrix();
- this.rotate(v);
- break;
-
- default:
- v.sendMessage(ChatColor.RED + "Something went wrong.");
- break;
+ if (this.mode == 0) {
+ this.getMatrix();
+ this.rotate(v);
+ } else {
+ v.sendMessage(ChatColor.RED + "Something went wrong.");
}
}
@@ -181,16 +176,11 @@ public class Rot2DBrush extends Brush
{
this.bSize = v.getBrushSize();
- switch (this.mode)
- {
- case 0:
- this.getMatrix();
- this.rotate(v);
- break;
-
- default:
- v.sendMessage(ChatColor.RED + "Something went wrong.");
- break;
+ if (this.mode == 0) {
+ this.getMatrix();
+ this.rotate(v);
+ } else {
+ v.sendMessage(ChatColor.RED + "Something went wrong.");
}
}
diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/Rot2DvertBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/Rot2DvertBrush.java
index f34c43486..c656682f0 100644
--- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/Rot2DvertBrush.java
+++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/Rot2DvertBrush.java
@@ -164,16 +164,11 @@ public class Rot2DvertBrush extends Brush
{
this.bSize = v.getBrushSize();
- switch (this.mode)
- {
- case 0:
- this.getMatrix();
- this.rotate(v);
- break;
-
- default:
- v.owner().getPlayer().sendMessage(ChatColor.RED + "Something went wrong.");
- break;
+ if (this.mode == 0) {
+ this.getMatrix();
+ this.rotate(v);
+ } else {
+ v.owner().getPlayer().sendMessage(ChatColor.RED + "Something went wrong.");
}
}
@@ -182,16 +177,11 @@ public class Rot2DvertBrush extends Brush
{
this.bSize = v.getBrushSize();
- switch (this.mode)
- {
- case 0:
- this.getMatrix();
- this.rotate(v);
- break;
-
- default:
- v.owner().getPlayer().sendMessage(ChatColor.RED + "Something went wrong.");
- break;
+ if (this.mode == 0) {
+ this.getMatrix();
+ this.rotate(v);
+ } else {
+ v.owner().getPlayer().sendMessage(ChatColor.RED + "Something went wrong.");
}
}
diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/Rot3DBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/Rot3DBrush.java
index 1a9069cd1..79ddcbdf8 100644
--- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/Rot3DBrush.java
+++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/Rot3DBrush.java
@@ -248,16 +248,11 @@ public class Rot3DBrush extends Brush
{
this.bSize = v.getBrushSize();
- switch (this.mode)
- {
- case 0:
- this.getMatrix();
- this.rotate(v);
- break;
-
- default:
- v.owner().getPlayer().sendMessage(ChatColor.RED + "Something went wrong.");
- break;
+ if (this.mode == 0) {
+ this.getMatrix();
+ this.rotate(v);
+ } else {
+ v.owner().getPlayer().sendMessage(ChatColor.RED + "Something went wrong.");
}
}
@@ -266,16 +261,11 @@ public class Rot3DBrush extends Brush
{
this.bSize = v.getBrushSize();
- switch (this.mode)
- {
- case 0:
- this.getMatrix();
- this.rotate(v);
- break;
-
- default:
- v.owner().getPlayer().sendMessage(ChatColor.RED + "Something went wrong.");
- break;
+ if (this.mode == 0) {
+ this.getMatrix();
+ this.rotate(v);
+ } else {
+ v.owner().getPlayer().sendMessage(ChatColor.RED + "Something went wrong.");
}
}
diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/ShellBallBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/ShellBallBrush.java
index 7004b2d39..9c25020ba 100644
--- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/ShellBallBrush.java
+++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/ShellBallBrush.java
@@ -50,10 +50,8 @@ public class ShellBallBrush extends Brush
{
for (int y = 0; y <= brushSizeDoubled; y++)
{
- for (int z = 0; z <= brushSizeDoubled; z++)
- {
- newMaterials[x][y][z] = oldMaterials[x + 1][y + 1][z + 1];
- }
+ System.arraycopy(oldMaterials[x + 1][y + 1], 1, newMaterials[x][y], 0,
+ brushSizeDoubled + 1);
}
}
diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/ShellSetBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/ShellSetBrush.java
index 9e7fa81d8..b4037a11f 100644
--- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/ShellSetBrush.java
+++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/ShellSetBrush.java
@@ -57,7 +57,8 @@ public class ShellSetBrush extends Brush
}
else
{
- final ArrayList blocks = new ArrayList(((Math.abs(highX - lowX) * Math.abs(highZ - lowZ) * Math.abs(highY - lowY)) / 2));
+ final ArrayList blocks = new ArrayList<>(
+ ((Math.abs(highX - lowX) * Math.abs(highZ - lowZ) * Math.abs(highY - lowY)) / 2));
for (int y = lowY; y <= highY; y++)
{
for (int x = lowX; x <= highX; x++)
diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/ShellVoxelBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/ShellVoxelBrush.java
index ce394c276..2d528fb58 100644
--- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/ShellVoxelBrush.java
+++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/ShellVoxelBrush.java
@@ -49,10 +49,8 @@ public class ShellVoxelBrush extends Brush
{
for (int y = 0; y <= brushSizeSquared; y++)
{
- for (int z = 0; z <= brushSizeSquared; z++)
- {
- newMaterials[x][y][z] = oldMaterials[x + 1][y + 1][z + 1];
- }
+ System.arraycopy(oldMaterials[x + 1][y + 1], 1, newMaterials[x][y], 0,
+ brushSizeSquared + 1);
}
}
int temp;
diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/SnowConeBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/SnowConeBrush.java
index b68eccd8d..056184209 100644
--- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/SnowConeBrush.java
+++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/SnowConeBrush.java
@@ -2,6 +2,7 @@ package com.thevoxelbox.voxelsniper.brush;
import com.sk89q.worldedit.bukkit.BukkitAdapter;
+import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.block.BlockTypes;
import com.thevoxelbox.voxelsniper.Message;
import com.thevoxelbox.voxelsniper.SnipeData;
@@ -95,19 +96,15 @@ public class SnowConeBrush extends Brush
if (snowData > snowconeData[x][z])
{
- switch (BlockTypes.get(snowcone[x][z]))
- {
- case AIR:
- case CAVE_AIR:
- case VOID_AIR:
- snowconeData[x][z] = snowData;
- snowcone[x][z] = BlockTypes.SNOW.getInternalId();
- case SNOW_BLOCK:
- snowconeData[x][z] = snowData;
- break;
- default:
- break;
+ BlockType blockType =
+ BlockTypes.get(snowcone[x][z]);
+ if (blockType.getMaterial().isAir()) {
+ snowconeData[x][z] = snowData;
+ snowcone[x][z] = BlockTypes.SNOW.getInternalId();
+ snowconeData[x][z] = snowData;
+ } else if (blockType == BlockTypes.SNOW_BLOCK) {
+ snowconeData[x][z] = snowData;
}
}
else if (yOffset[x][z] > 0 && snowcone[x][z] == BlockTypes.SNOW.getInternalId())
@@ -152,22 +149,17 @@ public class SnowConeBrush extends Brush
@Override
protected final void powder(final SnipeData v)
{
- switch (getTargetBlock().getType())
- {
- case SNOW:
- this.addSnow(v, this.getTargetBlock());
- break;
- default:
- Block blockAbove = getTargetBlock().getRelative(BlockFace.UP);
- if (blockAbove != null && BukkitAdapter.adapt(blockAbove.getType()).getMaterial().isAir())
- {
- addSnow(v, blockAbove);
- }
- else
- {
- v.owner().getPlayer().sendMessage(ChatColor.RED + "Error: Center block neither snow nor air.");
- }
- break;
+ if (getTargetBlock().getType() == Material.SNOW) {
+ this.addSnow(v, this.getTargetBlock());
+ } else {
+ Block blockAbove = getTargetBlock().getRelative(BlockFace.UP);
+ if (blockAbove != null && BukkitAdapter.adapt(blockAbove.getType()).getMaterial()
+ .isAir()) {
+ addSnow(v, blockAbove);
+ } else {
+ v.owner().getPlayer()
+ .sendMessage(ChatColor.RED + "Error: Center block neither snow nor air.");
+ }
}
}
diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/SpiralStaircaseBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/SpiralStaircaseBrush.java
index b803ac117..c3b12d0b4 100644
--- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/SpiralStaircaseBrush.java
+++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/SpiralStaircaseBrush.java
@@ -2,6 +2,7 @@ package com.thevoxelbox.voxelsniper.brush;
import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.extension.input.InputParseException;
+import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.block.BlockTypes;
import com.sk89q.worldedit.world.registry.LegacyMapper;
import com.thevoxelbox.voxelsniper.Message;
@@ -724,14 +725,12 @@ public class SpiralStaircaseBrush extends Brush
// step/slab
try {
- BlockTypes type = BlockTypes.parse(par[i]);
+ BlockType type = BlockTypes.parse(par[i]);
this.stairtype = par[i].toLowerCase().intern();
v.sendMessage(ChatColor.BLUE + "Staircase type: " + this.stairtype);
return;
} catch (InputParseException ignore) {}
- switch (par[i].toLowerCase()) {
- case "block":
-
+ if ("block".equals(par[i].toLowerCase())) {
}
if (par[i].equalsIgnoreCase("block") || par[i].equalsIgnoreCase("step") || par[i].equalsIgnoreCase("woodstair") || par[i].equalsIgnoreCase("cobblestair"))
{
diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/SplatterBallBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/SplatterBallBrush.java
index ec13e95c7..fb45a2b5f 100644
--- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/SplatterBallBrush.java
+++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/SplatterBallBrush.java
@@ -130,10 +130,9 @@ public class SplatterBallBrush extends PerformBrush
{
for (int y = 2 * v.getBrushSize(); y >= 0; y--)
{
- for (int z = 2 * v.getBrushSize(); z >= 0; z--)
- {
- splat[x][y][z] = tempSplat[x][y][z];
- }
+ if (2 * v.getBrushSize() + 1 >= 0)
+ System.arraycopy(tempSplat[x][y], 0, splat[x][y], 0,
+ 2 * v.getBrushSize() + 1);
}
}
}
diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/SplatterDiscBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/SplatterDiscBrush.java
index c67d1e094..05d970753 100644
--- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/SplatterDiscBrush.java
+++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/SplatterDiscBrush.java
@@ -115,10 +115,8 @@ public class SplatterDiscBrush extends PerformBrush
// integrate tempsplat back into splat at end of iteration
for (int x = 2 * v.getBrushSize(); x >= 0; x--)
{
- for (int y = 2 * v.getBrushSize(); y >= 0; y--)
- {
- splat[x][y] = tempSplat[x][y];
- }
+ if (2 * v.getBrushSize() + 1 >= 0)
+ System.arraycopy(tempSplat[x], 0, splat[x], 0, 2 * v.getBrushSize() + 1);
}
}
this.growPercent = gref;
diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/SplatterOverlayBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/SplatterOverlayBrush.java
index baea84b19..162f831d0 100644
--- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/SplatterOverlayBrush.java
+++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/SplatterOverlayBrush.java
@@ -1,7 +1,8 @@
package com.thevoxelbox.voxelsniper.brush;
-import com.sk89q.worldedit.blocks.BlockMaterial;
+import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.block.BlockTypes;
+import com.sk89q.worldedit.world.registry.BlockMaterial;
import com.thevoxelbox.voxelsniper.Message;
import com.thevoxelbox.voxelsniper.SnipeData;
import com.thevoxelbox.voxelsniper.brush.perform.PerformBrush;
@@ -103,10 +104,8 @@ public class SplatterOverlayBrush extends PerformBrush
// integrate tempsplat back into splat at end of iteration
for (int x = 2 * v.getBrushSize(); x >= 0; x--)
{
- for (int y = 2 * v.getBrushSize(); y >= 0; y--)
- {
- splat[x][y] = tempSplat[x][y];
- }
+ if (2 * v.getBrushSize() + 1 >= 0)
+ System.arraycopy(tempSplat[x], 0, splat[x], 0, 2 * v.getBrushSize() + 1);
}
}
this.growPercent = gref;
@@ -135,7 +134,7 @@ public class SplatterOverlayBrush extends PerformBrush
if (!this.allBlocks)
{
// if the override parameter has not been activated, go to the switch that filters out manmade stuff.
- BlockTypes type = BlockTypes.get(this.getBlockIdAt(this.getTargetBlock().getX() + x, y, this.getTargetBlock().getZ() + z));
+ BlockType type = BlockTypes.get(this.getBlockIdAt(this.getTargetBlock().getX() + x, y, this.getTargetBlock().getZ() + z));
BlockMaterial mat = type.getMaterial();
if (mat.isSolid() && mat.isFullCube() && !mat.hasContainer()) {
final int depth = randomizeHeight ? generator.nextInt(this.depth) : this.depth;
@@ -239,10 +238,8 @@ public class SplatterOverlayBrush extends PerformBrush
// integrate tempsplat back into splat at end of iteration
for (int x = 2 * v.getBrushSize(); x >= 0; x--)
{
- for (int y = 2 * v.getBrushSize(); y >= 0; y--)
- {
- splat[x][y] = tempsplat[x][y];
- }
+ if (2 * v.getBrushSize() + 1 >= 0)
+ System.arraycopy(tempsplat[x], 0, splat[x], 0, 2 * v.getBrushSize() + 1);
}
}
this.growPercent = gref;
@@ -268,7 +265,7 @@ public class SplatterOverlayBrush extends PerformBrush
if (!this.allBlocks)
{ // if the override parameter has not been activated, go to the switch that filters out manmade stuff.
- BlockTypes type = BlockTypes.get(this.getBlockIdAt(this.getTargetBlock().getX() + x, y, this.getTargetBlock().getZ() + z));
+ BlockType type = BlockTypes.get(this.getBlockIdAt(this.getTargetBlock().getX() + x, y, this.getTargetBlock().getZ() + z));
BlockMaterial mat = type.getMaterial();
if (mat.isSolid() && mat.isFullCube() && !mat.hasContainer())
{
diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/SplatterVoxelBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/SplatterVoxelBrush.java
index cfa39e759..805ab96cd 100644
--- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/SplatterVoxelBrush.java
+++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/SplatterVoxelBrush.java
@@ -130,10 +130,9 @@ public class SplatterVoxelBrush extends PerformBrush
{
for (int y = 2 * v.getBrushSize(); y >= 0; y--)
{
- for (int z = 2 * v.getBrushSize(); z >= 0; z--)
- {
- splat[x][y][z] = tempSplat[x][y][z];
- }
+ if (2 * v.getBrushSize() + 1 >= 0)
+ System.arraycopy(tempSplat[x][y], 0, splat[x][y], 0,
+ 2 * v.getBrushSize() + 1);
}
}
}
diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/SplatterVoxelDiscBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/SplatterVoxelDiscBrush.java
index aea30c080..920a8be7d 100644
--- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/SplatterVoxelDiscBrush.java
+++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/SplatterVoxelDiscBrush.java
@@ -111,10 +111,8 @@ public class SplatterVoxelDiscBrush extends PerformBrush
// integrate tempsplat back into splat at end of iteration
for (int x = 2 * v.getBrushSize(); x >= 0; x--)
{
- for (int y = 2 * v.getBrushSize(); y >= 0; y--)
- {
- splat[x][y] = tempSplat[x][y];
- }
+ if (2 * v.getBrushSize() + 1 >= 0)
+ System.arraycopy(tempSplat[x], 0, splat[x], 0, 2 * v.getBrushSize() + 1);
}
}
this.growPercent = gref;
diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/SplineBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/SplineBrush.java
index 707a8c7ab..b2a0bdb47 100644
--- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/SplineBrush.java
+++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/SplineBrush.java
@@ -16,9 +16,9 @@ import java.util.ArrayList;
*/
public class SplineBrush extends PerformBrush
{
- private final ArrayList endPts = new ArrayList();
- private final ArrayList ctrlPts = new ArrayList();
- protected ArrayList spline = new ArrayList();
+ private final ArrayList endPts = new ArrayList<>();
+ private final ArrayList ctrlPts = new ArrayList<>();
+ protected ArrayList spline = new ArrayList<>();
protected boolean set;
protected boolean ctrl;
protected String[] sparams = {"ss", "sc", "clear"};
diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/StampBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/StampBrush.java
index 43b884c28..c19e0f4e1 100644
--- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/StampBrush.java
+++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/StampBrush.java
@@ -52,10 +52,10 @@ public class StampBrush extends Brush
NO_AIR, FILL, DEFAULT
}
- protected HashSet clone = new HashSet();
- protected HashSet fall = new HashSet();
- protected HashSet drop = new HashSet();
- protected HashSet solid = new HashSet();
+ protected HashSet clone = new HashSet<>();
+ protected HashSet fall = new HashSet<>();
+ protected HashSet drop = new HashSet<>();
+ protected HashSet solid = new HashSet<>();
protected Undo undo;
protected boolean sorted = false;
diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/StencilListBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/StencilListBrush.java
index a90f80569..b96a78a21 100644
--- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/StencilListBrush.java
+++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/StencilListBrush.java
@@ -26,7 +26,7 @@ public class StencilListBrush extends Brush
private short zRef;
private short yRef;
private byte pasteParam = 0;
- private HashMap stencilList = new HashMap();
+ private HashMap stencilList = new HashMap<>();
/**
*
diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/UnderlayBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/UnderlayBrush.java
index 38e8ea2c3..28a68b65c 100644
--- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/UnderlayBrush.java
+++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/UnderlayBrush.java
@@ -1,7 +1,7 @@
package com.thevoxelbox.voxelsniper.brush;
-import com.sk89q.worldedit.blocks.BlockMaterial;
import com.sk89q.worldedit.world.block.BlockTypes;
+import com.sk89q.worldedit.world.registry.BlockMaterial;
import com.thevoxelbox.voxelsniper.Message;
import com.thevoxelbox.voxelsniper.SnipeData;
import com.thevoxelbox.voxelsniper.brush.perform.PerformBrush;
diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/WallSider.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/WallSider.java
new file mode 100644
index 000000000..f1b794f4b
--- /dev/null
+++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/WallSider.java
@@ -0,0 +1,139 @@
+package com.thevoxelbox.voxelsniper.brush;
+
+import org.bukkit.ChatColor;
+import org.bukkit.block.Block;
+import org.bukkit.block.BlockFace;
+import org.bukkit.util.Vector;
+
+import com.boydti.fawe.bukkit.wrapper.AsyncBlock;
+import com.thevoxelbox.voxelsniper.Message;
+import com.thevoxelbox.voxelsniper.SnipeData;
+
+public class WallSider extends Brush{
+
+ private static String[] facings = new String[] { "north", "east", "south", "west", "relative to player" };
+ private short c;
+ private short d;
+ private double e;
+ private boolean f;
+ private boolean g;
+ private boolean h;
+
+ public WallSider() {
+ this.c = 4;
+ this.d = 1;
+ this.e = 0.0;
+ this.setName("WallSider");
+ }
+
+ private void a(final SnipeData snipeData, final Block block, final boolean b) {
+ final double n = (snipeData.getBrushSize() + this.e) * (snipeData.getBrushSize() + this.e);
+ final Vector vector;
+ final Vector clone = (vector = block.getLocation().toVector()).clone();
+ int c;
+ if (this.c == 4) {
+ double n2;
+ if ((n2 = (snipeData.owner().getPlayer().getLocation().getYaw() - 90.0f) % 360.0f) < 0.0) {
+ n2 += 360.0;
+ }
+ c = ((0.0 >= n2 && n2 < 45.0) ? 2 : ((45.0 >= n2 && n2 < 135.0) ? 3 : ((135.0 >= n2 && n2 < 225.0) ? 0 : ((225.0 >= n2 && n2 < 315.0) ? 1 : ((315.0 >= n2 && n2 < 360.0) ? 2 : -1)))));
+ }
+ else {
+ c = this.c;
+ }
+ int n3 = c;
+ if (b) {
+ n3 = (short)((n3 + 2) % 4);
+ }
+ int n4 = 98;
+ if (n3 == 0 || n3 == 2) {
+ n4 = 97;
+ }
+ for (int i = -snipeData.getBrushSize(); i <= snipeData.getBrushSize(); ++i) {
+ if (n4 == 97) {
+ clone.setX(vector.getX() + i);
+ }
+ else {
+ clone.setZ(vector.getZ() + i);
+ }
+ for (int j = -snipeData.getBrushSize(); j <= snipeData.getBrushSize(); ++j) {
+ clone.setY(vector.getY() + j);
+ if (vector.distanceSquared(clone) <= n) {
+ for (short n5 = 0; n5 < this.d; ++n5) {
+ if (n4 == 97) {
+ clone.setZ(vector.getZ() + ((n3 == 2) ? n5 : (-n5)));
+ }
+ else {
+ clone.setX(vector.getX() + ((n3 == 1) ? n5 : (-n5)));
+ }
+ final AsyncBlock block2 = this.getWorld().getBlockAt(clone.getBlockX(), clone.getBlockY(), clone.getBlockZ());
+ if ((this.f && block2.getTypeId() == snipeData.getReplaceId()) || (!this.f && (block2.getTypeId() != 0 || this.g))) {
+ block2.setTypeId(snipeData.getVoxelId());
+ }
+ }
+ if (n4 == 97) {
+ clone.setZ(vector.getZ());
+ }
+ else {
+ clone.setX(vector.getX());
+ }
+ }
+ }
+ }
+ }
+
+ @Override
+ protected final void arrow(final SnipeData snipeData) {
+ this.a(snipeData, this.getTargetBlock(), false);
+ }
+
+ @Override
+ protected final void powder(final SnipeData snipeData) {
+ this.a(snipeData, this.getTargetBlock(), true);
+ }
+
+ public final void parameters(final String[] array, final SnipeData snipeData) {
+ for (int i = 1; i < array.length; ++i) {
+ final String lowerCase;
+ if ((lowerCase = array[i].toLowerCase()).startsWith("d")) {
+ this.d = (short)Integer.parseInt(lowerCase.replace("d", ""));
+ snipeData.sendMessage(ChatColor.AQUA + "Depth set to " + this.d + " blocks");
+ }
+ else if (lowerCase.startsWith("s")) {
+ this.c = (short)Integer.parseInt(lowerCase.replace("s", ""));
+ if (this.c > 4 || this.c < 0) {
+ this.c = 4;
+ }
+ snipeData.sendMessage(ChatColor.AQUA + "Orientation set to " + facings[this.c]);
+ }
+ else if (lowerCase.startsWith("true")) {
+ this.e = 0.5;
+ snipeData.sendMessage(ChatColor.AQUA + "True circle mode ON.");
+ }
+ else if (lowerCase.startsWith("false")) {
+ this.e = 0.0;
+ snipeData.sendMessage(ChatColor.AQUA + "True circle mode OFF.");
+ }
+ else if (lowerCase.startsWith("air")) {
+ this.g = true;
+ snipeData.sendMessage(ChatColor.AQUA + "Including air.");
+ }
+ else if (lowerCase.startsWith("mm")) {
+ this.f = true;
+ snipeData.sendMessage(ChatColor.AQUA + "Replacing block.");
+ }
+ }
+ }
+
+ @Override
+ public String getPermissionNode() {
+ return "voxelsniper.brush.wallsider";
+ }
+
+ @Override
+ public void info(Message vm) {
+ // TODO Auto-generated method stub
+
+ }
+
+}
diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/PatternPerformer.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/PatternPerformer.java
index aade828fa..dbbfd0782 100644
--- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/PatternPerformer.java
+++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/PatternPerformer.java
@@ -2,10 +2,10 @@ package com.thevoxelbox.voxelsniper.brush.perform;
import com.boydti.fawe.bukkit.wrapper.AsyncBlock;
import com.boydti.fawe.object.pattern.PatternTraverser;
-import com.sk89q.worldedit.MutableBlockVector;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.function.pattern.Pattern;
+import com.sk89q.worldedit.math.BlockVector3;
import com.thevoxelbox.voxelsniper.Message;
import com.thevoxelbox.voxelsniper.SnipeData;
import org.bukkit.block.Block;
@@ -14,7 +14,6 @@ public class PatternPerformer extends vPerformer {
private String info;
private Pattern pattern;
private Extent extent;
- private MutableBlockVector mutable = new MutableBlockVector();
@Override
public void info(Message vm) {
@@ -33,9 +32,9 @@ public class PatternPerformer extends vPerformer {
@Override
public void perform(AsyncBlock block) {
- mutable.setComponents(block.getX(), block.getY(), block.getZ());
+ BlockVector3 bv = BlockVector3.at(block.getX(), block.getY(), block.getZ());
try {
- pattern.apply(extent, mutable, mutable);
+ pattern.apply(extent, bv, bv);
} catch (WorldEditException e) {
throw new RuntimeException(e);
}
diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/Performer.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/Performer.java
index 01a2a07c5..157d1b6ef 100644
--- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/Performer.java
+++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/Performer.java
@@ -12,7 +12,7 @@ import com.thevoxelbox.voxelsniper.Message;
public interface Performer
{
- public void parse(String[] args, com.thevoxelbox.voxelsniper.SnipeData v);
+ void parse(String[] args, com.thevoxelbox.voxelsniper.SnipeData v);
- public void showInfo(Message vm);
+ void showInfo(Message vm);
}
diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/PerformerE.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/PerformerE.java
index ef0ff7e5a..c4f5b819e 100644
--- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/PerformerE.java
+++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/PerformerE.java
@@ -99,7 +99,7 @@ public enum PerformerE
public static String performer_list_short = "";
public static String performer_list_long = "";
- private PerformerE(Class extends vPerformer> c, String s, String l)
+ PerformerE(Class extends vPerformer> c, String s, String l)
{
pclass = c;
short_name = s;
@@ -116,28 +116,12 @@ public enum PerformerE
p = pclass.getConstructor().newInstance();
return p;
}
- catch (InstantiationException ex)
- {
- Logger.getLogger(PerformerE.class.getName()).log(Level.SEVERE, null, ex);
- }
- catch (IllegalAccessException ex)
- {
- Logger.getLogger(PerformerE.class.getName()).log(Level.SEVERE, null, ex);
- }
- catch (IllegalArgumentException ex)
- {
- Logger.getLogger(PerformerE.class.getName()).log(Level.SEVERE, null, ex);
- }
- catch (InvocationTargetException ex)
+ catch (InstantiationException | IllegalAccessException | InvocationTargetException | IllegalArgumentException ex)
{
Logger.getLogger(PerformerE.class.getName()).log(Level.SEVERE, null, ex);
}
}
- catch (NoSuchMethodException ex)
- {
- Logger.getLogger(PerformerE.class.getName()).log(Level.SEVERE, null, ex);
- }
- catch (SecurityException ex)
+ catch (NoSuchMethodException | SecurityException ex)
{
Logger.getLogger(PerformerE.class.getName()).log(Level.SEVERE, null, ex);
}
@@ -163,8 +147,8 @@ public enum PerformerE
static
{
- performers = new TreeMap();
- long_names = new TreeMap();
+ performers = new TreeMap<>();
+ long_names = new TreeMap<>();
for (PerformerE pe : values())
{
diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/command/VoxelReplaceCommand.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/command/VoxelReplaceCommand.java
index d3674f374..0e040ce4e 100644
--- a/favs/src/main/java/com/thevoxelbox/voxelsniper/command/VoxelReplaceCommand.java
+++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/command/VoxelReplaceCommand.java
@@ -2,6 +2,7 @@ package com.thevoxelbox.voxelsniper.command;
import com.bekvon.bukkit.residence.commands.material;
import com.boydti.fawe.bukkit.wrapper.AsyncBlock;
+import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.block.BlockTypes;
import com.thevoxelbox.voxelsniper.RangeBlockHelper;
import com.thevoxelbox.voxelsniper.SnipeData;
@@ -39,7 +40,7 @@ public class VoxelReplaceCommand extends VoxelCommand
return true;
}
- BlockTypes weType = BlockTypes.parse(args[0]);
+ BlockType weType = BlockTypes.parse(args[0]);
if (weType != null)
{
snipeData.setReplaceId(weType.getInternalId());
diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/command/VoxelVoxelCommand.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/command/VoxelVoxelCommand.java
index cbd8b52fe..743b027c7 100644
--- a/favs/src/main/java/com/thevoxelbox/voxelsniper/command/VoxelVoxelCommand.java
+++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/command/VoxelVoxelCommand.java
@@ -29,6 +29,7 @@ import com.bekvon.bukkit.residence.commands.material;
import com.boydti.fawe.bukkit.favs.PatternUtil;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.bukkit.BukkitAdapter;
+import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.block.BlockTypes;
import com.thevoxelbox.voxelsniper.RangeBlockHelper;
import com.thevoxelbox.voxelsniper.SnipeData;
@@ -53,8 +54,8 @@ public class VoxelVoxelCommand extends VoxelCommand {
Block block = (new RangeBlockHelper(player, sniper.getWorld())).getTargetBlock();
Material blockType = block.getType();
- BlockTypes weType = BukkitAdapter.adapt(blockType);
- if(!player.hasPermission("voxelsniper.ignorelimitations") && WorldEdit.getInstance().getConfiguration().disallowedBlocks.contains(weType)) {
+ BlockType weType = BukkitAdapter.adapt(blockType);
+ if(!player.hasPermission("voxelsniper.ignorelimitations") && WorldEdit.getInstance().getConfiguration().disallowedBlocks.contains(weType.getId())) {
player.sendMessage("You are not allowed to use " + blockType.name() + ". (WorldEdit config.yml)");
return true;
}
@@ -65,9 +66,9 @@ public class VoxelVoxelCommand extends VoxelCommand {
return true;
} else {
- BlockTypes weType = BlockTypes.parse(args[0]);
+ BlockType weType = BlockTypes.parse(args[0]);
if(weType != null) {
- if(!player.hasPermission("voxelsniper.ignorelimitations") && WorldEdit.getInstance().getConfiguration().disallowedBlocks.contains(weType)) {
+ if(!player.hasPermission("voxelsniper.ignorelimitations") && WorldEdit.getInstance().getConfiguration().disallowedBlocks.contains(weType.getId())) {
player.sendMessage("You are not allowed to use " + weType + ".");
return true;
} else {
diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/jsap/HelpJSAP.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/jsap/HelpJSAP.java
index 17a01b81c..89870aa21 100644
--- a/favs/src/main/java/com/thevoxelbox/voxelsniper/jsap/HelpJSAP.java
+++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/jsap/HelpJSAP.java
@@ -165,7 +165,7 @@ public class HelpJSAP extends JSAP
{
if (!(jsapResult.success()) || jsapResult.getBoolean("help"))
{
- List returnValue = new LinkedList();
+ List returnValue = new LinkedList<>();
// To avoid spurious missing argument errors we never print errors if help is required.
if (!jsapResult.getBoolean("help"))
{
diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/util/BlockWrapper.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/util/BlockWrapper.java
index 997ccc1e3..d8f31240c 100644
--- a/favs/src/main/java/com/thevoxelbox/voxelsniper/util/BlockWrapper.java
+++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/util/BlockWrapper.java
@@ -1,6 +1,7 @@
package com.thevoxelbox.voxelsniper.util;
import com.boydti.fawe.bukkit.wrapper.AsyncBlock;
+import org.bukkit.Material;
import org.bukkit.World;
/**
@@ -10,6 +11,7 @@ public class BlockWrapper
{
private int id;
+ private Material type;
private int x;
private int y;
private int z;
@@ -38,6 +40,10 @@ public class BlockWrapper
return this.data;
}
+ public Material getType() {
+ return type;
+ }
+
/**
* @return the id
*/
@@ -131,4 +137,9 @@ public class BlockWrapper
{
this.z = z;
}
+
+ public void setType(Material type) {
+ this.type = type;
+ }
+
}
diff --git a/favs/src/main/resources/plugin.yml b/favs/src/main/resources/plugin.yml
index fa6b1e7b1..6c5f76cd9 100644
--- a/favs/src/main/resources/plugin.yml
+++ b/favs/src/main/resources/plugin.yml
@@ -7,7 +7,7 @@ load: STARTUP
database: false
depend: [WorldEdit]
api-version: 1.13
-#softdepend: [WorldGuard, PlotSquared, MCore, Factions, GriefPrevention, Residence, Towny, PlotMe, PreciousStones]
+#softdepend: [WorldGuard, PlotSquared, MCore, Factions, GriefPrevention, Residence, Towny, PreciousStones]
commands:
'/p':
description: VoxelSniper perform command
@@ -146,6 +146,7 @@ permissions:
voxelsniper.brush.ellipsoid: true
voxelsniper.brush.eraser: true
voxelsniper.brush.erode: true
+ voxelsniper.brush.erodeblend: true
voxelsniper.brush.extrude: true
voxelsniper.brush.filldown: true
voxelsniper.brush.flatocean: true
@@ -190,6 +191,7 @@ permissions:
voxelsniper.brush.voxeldisc: true
voxelsniper.brush.voxeldiscface: true
voxelsniper.brush.warp: true
+ voxelsniper.brush.wallsider: true
voxelsniper.goto: true
voxelsniper.sniper: true
voxelsniper.sniper:
@@ -228,6 +230,7 @@ permissions:
voxelsniper.brush.entityremoval: true
voxelsniper.brush.eraser: true
voxelsniper.brush.erode: true
+ voxelsniper.brush.erodeblend: true
voxelsniper.brush.extrude: true
voxelsniper.brush.filldown: true
voxelsniper.brush.flatocean: true
@@ -279,6 +282,7 @@ permissions:
voxelsniper.brush.voxeldisc: true
voxelsniper.brush.voxeldiscface: true
voxelsniper.brush.warp: true
+ voxelsniper.brush.wallsider: true
voxelsniper.brush.ball:
default: op
voxelsniper.brush.biome:
@@ -333,6 +337,8 @@ permissions:
default: op
voxelsniper.brush.erode:
default: op
+ voxelsniper.brush.erodeblend:
+ default: op
voxelsniper.brush.extrude:
default: op
voxelsniper.brush.filldown:
@@ -433,5 +439,7 @@ permissions:
default: op
voxelsniper.brush.voxeldiscface:
default: op
+ voxelsniper.brush.wallsider:
+ default: op
voxelsniper.brush.warp:
default: op
\ No newline at end of file
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index e0b3fb8d7..db93606ed 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,5 +1,6 @@
+#Mon Mar 25 18:59:14 EDT 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
diff --git a/splash.txt b/splash.txt
index 70cf461ed..c63b561f2 100644
--- a/splash.txt
+++ b/splash.txt
@@ -10,7 +10,6 @@
======= By Empire92 and WorldEdit team =======
If you encounter trouble:
- - Read COMPILING.md if you haven't yet
- Run `build` in a separate Gradle run
- Use gradlew and not gradle
- Ask us!
diff --git a/worldedit-bukkit/build.gradle b/worldedit-bukkit/build.gradle
index 5e5b3f48b..acefe8c9b 100644
--- a/worldedit-bukkit/build.gradle
+++ b/worldedit-bukkit/build.gradle
@@ -1,90 +1,88 @@
-apply plugin: 'eclipse'
-apply plugin: 'idea'
-apply plugin: 'maven'
-
-repositories {
- maven { url "https://hub.spigotmc.org/nexus/content/groups/public" }
- maven { url "https://ci.athion.net/job/FAWE-WorldGuard-1.13/lastSuccessfulBuild/artifact/mvn" }
-}
-
-dependencies {
- compile project(':worldedit-core')
- compile 'com.sk89q:dummypermscompat:1.8'
- compile 'com.destroystokyo.paper:paper-api:1.13-R0.1-SNAPSHOT'
- compile 'org.spigotmc:spigot:1.13.2-R0.1-SNAPSHOT'
- testCompile 'org.mockito:mockito-core:1.9.0-rc1'
- compile 'net.milkbowl.vault:VaultAPI:1.5.6'
- compile 'com.massivecraft:factions:2.8.0'
- compile 'com.drtshock:factions:1.6.9.5'
- compile 'com.factionsone:FactionsOne:1.2.2'
- compile 'me.ryanhamshire:GriefPrevention:11.5.2'
- compile 'com.massivecraft:mcore:7.0.1'
- compile 'net.sacredlabyrinth.Phaed:PreciousStones:10.0.4-SNAPSHOT'
- compile 'net.jzx7:regios:5.9.9'
- compile 'com.bekvon.bukkit.residence:Residence:4.5._13.1'
- compile 'com.palmergames.bukkit:towny:0.84.0.9'
- compile 'com.worldcretornica:plotme_core:0.16.3'
- compile 'com.thevoxelbox.voxelsniper:voxelsniper:5.171.0'
- compile 'com.comphenix.protocol:ProtocolLib-API:4.4.0-SNAPSHOT'
- compile 'com.wasteofplastic:askyblock:3.0.8.2'
- compile 'com.sk89q:worldguard-core:latest'
- compile 'com.sk89q:worldguard-legacy:latest'
-}
-
-processResources {
- from (sourceSets.main.resources.srcDirs) {
- expand 'internalVersion': project.internalVersion
- include 'plugin.yml'
- }
-
- from (sourceSets.main.resources.srcDirs) {
- exclude 'plugin.yml'
- }
-}
-
-jar.archiveName="fawe-bukkit-${project.parent.version}.jar"
-jar.destinationDir = file '../mvn/com/boydti/fawe-bukkit/' + project.parent.version
-task createPom << {
- pom {
- project {
- groupId 'com.boydti'
- artifactId 'fawe-bukkit'
- version project.parent.version
- }
- }
- .getEffectivePom()
- .setDependencies(new ArrayList<>())
- .writeTo("../mvn/com/boydti/fawe-bukkit/${project.parent.version}/fawe-bukkit-${project.parent.version}.pom")
- pom {
- project {
- groupId 'com.boydti'
- artifactId 'fawe-bukkit'
- version 'latest'
- }
- }
- .getEffectivePom()
- .setDependencies(new ArrayList<>())
- .writeTo("../mvn/com/boydti/fawe-bukkit/latest/fawe-bukkit-latest.pom")
-}
-task copyFiles {
- doLast {
- copy {
- from "../mvn/com/boydti/fawe-bukkit/${project.parent.version}/"
- into '../mvn/com/boydti/fawe-bukkit/latest/'
- include('*.jar')
- rename ("fawe-bukkit-${project.parent.version}.jar", 'fawe-bukkit-latest.jar')
- }
- }
-}
-
-shadowJar {
- dependencies {
- include(dependency(':worldedit-core'))
- }
- archiveName = "${parent.name}-${project.name.replaceAll("worldedit-", "")}-${parent.version}.jar"
- destinationDir = file '../target'
-}
-
-build.dependsOn(shadowJar)
-build.finalizedBy(copyFiles)
-copyFiles.dependsOn(createPom)
+apply plugin: 'eclipse'
+apply plugin: 'idea'
+apply plugin: 'maven'
+
+repositories {
+ maven { url "https://hub.spigotmc.org/nexus/content/groups/public" }
+}
+
+dependencies {
+ compile project(':worldedit-core')
+ compile 'net.milkbowl.vault:VaultAPI:1.7'
+ compile 'com.sk89q:dummypermscompat:1.10'
+ compile 'com.destroystokyo.paper:paper-api:1.13.2-R0.1-SNAPSHOT'
+ compile 'org.spigotmc:spigot:1.13.2-R0.1-SNAPSHOT'
+ testCompile 'org.mockito:mockito-core:1.9.0-rc1'
+ compile 'com.massivecraft:factions:2.8.0'
+ compile 'com.drtshock:factions:1.6.9.5'
+ compile 'com.factionsone:FactionsOne:1.2.2'
+ compile 'me.ryanhamshire:GriefPrevention:11.5.2'
+ compile 'com.massivecraft:mcore:7.0.1'
+ compile 'net.sacredlabyrinth.Phaed:PreciousStones:10.0.4-SNAPSHOT'
+ compile 'net.jzx7:regios:5.9.9'
+ compile 'com.bekvon.bukkit.residence:Residence:4.5._13.1'
+ compile 'com.palmergames.bukkit:towny:0.84.0.9'
+ compile 'com.thevoxelbox.voxelsniper:voxelsniper:5.171.0'
+ compile 'com.comphenix.protocol:ProtocolLib-API:4.4.0-SNAPSHOT'
+ compile 'com.wasteofplastic:askyblock:3.0.8.2'
+ compileOnly 'com.sk89q.worldguard:worldguard-core:7.0.0-20190215.210421-39'
+ compileOnly 'com.sk89q.worldguard:worldguard-legacy:7.0.0-20190215.210421-39'
+}
+
+processResources {
+ from (sourceSets.main.resources.srcDirs) {
+ expand 'internalVersion': project.internalVersion
+ include 'plugin.yml'
+ }
+
+ from (sourceSets.main.resources.srcDirs) {
+ exclude 'plugin.yml'
+ }
+}
+
+jar.archiveName="fawe-bukkit-${project.parent.version}.jar"
+jar.destinationDir = file '../mvn/com/boydti/fawe-bukkit/' + project.parent.version
+task createPom << {
+ pom {
+ project {
+ groupId 'com.boydti'
+ artifactId 'fawe-bukkit'
+ version project.parent.version
+ }
+ }
+ .getEffectivePom()
+ .setDependencies(new ArrayList<>())
+ .writeTo("../mvn/com/boydti/fawe-bukkit/${project.parent.version}/fawe-bukkit-${project.parent.version}.pom")
+ pom {
+ project {
+ groupId 'com.boydti'
+ artifactId 'fawe-bukkit'
+ version 'latest'
+ }
+ }
+ .getEffectivePom()
+ .setDependencies(new ArrayList<>())
+ .writeTo("../mvn/com/boydti/fawe-bukkit/latest/fawe-bukkit-latest.pom")
+}
+task copyFiles {
+ doLast {
+ copy {
+ from "../mvn/com/boydti/fawe-bukkit/${project.parent.version}/"
+ into '../mvn/com/boydti/fawe-bukkit/latest/'
+ include('*.jar')
+ rename ("fawe-bukkit-${project.parent.version}.jar", 'fawe-bukkit-latest.jar')
+ }
+ }
+}
+
+shadowJar {
+ dependencies {
+ include(dependency(':worldedit-core'))
+ }
+ archiveName = "${parent.name}-${project.name.replaceAll("worldedit-", "")}-${parent.version}.jar"
+ destinationDir = file '../target'
+}
+
+build.dependsOn(shadowJar)
+build.finalizedBy(copyFiles)
+copyFiles.dependsOn(createPom)
diff --git a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/BStats.java b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/BStats.java
new file mode 100644
index 000000000..1bcc86214
--- /dev/null
+++ b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/BStats.java
@@ -0,0 +1,704 @@
+package org.bstats.bukkit;
+
+import com.boydti.fawe.Fawe;
+import org.bukkit.Bukkit;
+import org.bukkit.configuration.file.YamlConfiguration;
+import org.bukkit.plugin.Plugin;
+import org.bukkit.plugin.RegisteredServiceProvider;
+import org.bukkit.plugin.ServicePriority;
+import org.json.simple.JSONArray;
+import org.json.simple.JSONObject;
+
+import javax.net.ssl.HttpsURLConnection;
+import java.io.*;
+import java.lang.reflect.InvocationTargetException;
+import java.net.URL;
+import java.nio.charset.StandardCharsets;
+import java.util.*;
+import java.util.concurrent.Callable;
+import java.util.logging.Level;
+import java.util.zip.GZIPOutputStream;
+
+/**
+ * bStats collects some data for plugin authors.
+ *
+ * Check out https://bStats.org/ to learn more about bStats!
+ */
+@SuppressWarnings({"WeakerAccess", "unused"}) public class BStats {
+
+ static {
+ // You can use the property to disable the check in your test environment
+ if (System.getProperty("bstats.relocatecheck") == null || !System
+ .getProperty("bstats.relocatecheck").equals("false")) {
+ // Maven's Relocate is clever and changes strings, too. So we have to use this little "trick" ... :D
+ final String defaultPackage = new String(
+ new byte[] {'o', 'r', 'g', '.', 'b', 's', 't', 'a', 't', 's', '.', 'b', 'u', 'k',
+ 'k', 'i', 't'});
+ final String examplePackage =
+ new String(new byte[] {'y', 'o', 'u', 'r', '.', 'p', 'a', 'c', 'k', 'a', 'g', 'e'});
+ // We want to make sure nobody just copy & pastes the example and use the wrong package names
+ if (Metrics.class.getPackage().getName().equals(defaultPackage) || Metrics.class
+ .getPackage().getName().equals(examplePackage)) {
+ throw new IllegalStateException(
+ "bStats Metrics class has not been relocated correctly!");
+ }
+ }
+ }
+
+ // The version of this bStats class
+ public static final int B_STATS_VERSION = 1;
+
+ // The url to which the data is sent
+ private static final String URL = "https://bStats.org/submitData/bukkit";
+
+ // Is bStats enabled on this server?
+ private boolean enabled;
+
+ // Should failed requests be logged?
+ private static boolean logFailedRequests;
+
+ // Should the sent data be logged?
+ private static boolean logSentData;
+
+ // Should the response text be logged?
+ private static boolean logResponseStatusText;
+
+ // The uuid of the server
+ private static String serverUUID;
+
+ // The plugin
+ private final Plugin plugin;
+
+ // A list with all custom charts
+ private final List charts = new ArrayList<>();
+
+ /**
+ * Class constructor.
+ *
+ * @param plugin The plugin which stats should be submitted.
+ */
+ public BStats(Plugin plugin) {
+ if (plugin == null) {
+ throw new IllegalArgumentException("Plugin cannot be null!");
+ }
+ this.plugin = plugin;
+
+ // Get the config file
+ File bStatsFolder = new File(plugin.getDataFolder().getParentFile(), "bStats");
+ File configFile = new File(bStatsFolder, "config.yml");
+ YamlConfiguration config = YamlConfiguration.loadConfiguration(configFile);
+
+ // Check if the config file exists
+ if (!config.isSet("serverUuid")) {
+
+ // Add default values
+ config.addDefault("enabled", true);
+ // Every server gets it's unique random id.
+ config.addDefault("serverUuid", UUID.randomUUID().toString());
+ // Should failed request be logged?
+ config.addDefault("logFailedRequests", false);
+ // Should the sent data be logged?
+ config.addDefault("logSentData", false);
+ // Should the response text be logged?
+ config.addDefault("logResponseStatusText", false);
+
+ // Inform the server owners about bStats
+ config.options().header(
+ "bStats collects some data for plugin authors like how many servers are using their plugins.\n"
+ + "To honor their work, you should not disable it.\n"
+ + "This has nearly no effect on the server performance!\n"
+ + "Check out https://bStats.org/ to learn more :)").copyDefaults(true);
+ try {
+ config.save(configFile);
+ } catch (IOException ignored) {
+ }
+ }
+
+ // Load the data
+ enabled = config.getBoolean("enabled", true);
+ serverUUID = config.getString("serverUuid");
+ logFailedRequests = config.getBoolean("logFailedRequests", false);
+ logSentData = config.getBoolean("logSentData", false);
+ logResponseStatusText = config.getBoolean("logResponseStatusText", false);
+
+ if (enabled) {
+ boolean found = false;
+ // Search for all other bStats Metrics classes to see if we are the first one
+ for (Class> service : Bukkit.getServicesManager().getKnownServices()) {
+ try {
+ service.getField("B_STATS_VERSION"); // Our identifier :)
+ found = true; // We aren't the first
+ break;
+ } catch (NoSuchFieldException ignored) {
+ }
+ }
+ // Register our service
+ Bukkit.getServicesManager()
+ .register(BStats.class, this, plugin, ServicePriority.Normal);
+ if (!found) {
+ // We are the first!
+ startSubmitting();
+ }
+ }
+ }
+
+ /**
+ * Checks if bStats is enabled.
+ *
+ * @return Whether bStats is enabled or not.
+ */
+ public boolean isEnabled() {
+ return enabled;
+ }
+
+ /**
+ * Adds a custom chart.
+ *
+ * @param chart The chart to add.
+ */
+ public void addCustomChart(CustomChart chart) {
+ if (chart == null) {
+ throw new IllegalArgumentException("Chart cannot be null!");
+ }
+ charts.add(chart);
+ }
+
+ /**
+ * Starts the Scheduler which submits our data every 30 minutes.
+ */
+ private void startSubmitting() {
+ final Timer timer =
+ new Timer(true); // We use a timer cause the Bukkit scheduler is affected by server lags
+ timer.scheduleAtFixedRate(new TimerTask() {
+ @Override public void run() {
+ if (!plugin.isEnabled()) { // Plugin was disabled
+ timer.cancel();
+ return;
+ }
+ // Nevertheless we want our code to run in the Bukkit main thread, so we have to use the Bukkit scheduler
+ // Don't be afraid! The connection to the bStats server is still async, only the stats collection is sync ;)
+ Bukkit.getScheduler().runTask(plugin, () -> submitData());
+ }
+ }, 1000 * 60 * 5, 1000 * 60 * 30);
+ // Submit the data every 30 minutes, first time after 5 minutes to give other plugins enough time to start
+ // WARNING: Changing the frequency has no effect but your plugin WILL be blocked/deleted!
+ // WARNING: Just don't do it!
+ }
+
+ /**
+ * Gets the plugin specific data.
+ * This method is called using Reflection.
+ *
+ * @return The plugin specific data.
+ */
+ public JSONObject getPluginData() {
+ JSONObject data = new JSONObject();
+
+ String pluginName = "FastAsyncWorldEdit";
+ String pluginVersion = Fawe.get().getVersion() + "";
+
+ data.put("pluginName", pluginName); // Append the name of the plugin
+ data.put("pluginVersion", pluginVersion); // Append the version of the plugin
+ JSONArray customCharts = new JSONArray();
+ for (CustomChart customChart : charts) {
+ // Add the data of the custom charts
+ JSONObject chart = customChart.getRequestJsonObject();
+ if (chart == null) { // If the chart is null, we skip it
+ continue;
+ }
+ customCharts.add(chart);
+ }
+ data.put("customCharts", customCharts);
+
+ return data;
+ }
+
+ /**
+ * Gets the server specific data.
+ *
+ * @return The server specific data.
+ */
+ private JSONObject getServerData() {
+ // Minecraft specific data
+ int playerAmount = getPlayerCount();
+ int onlineMode = Fawe.imp().isOnlineMode() ? 1 : 0;
+ String serverVersion = Fawe.imp().getPlatformVersion();
+
+ // OS/Java specific data
+ String javaVersion = System.getProperty("java.version");
+ String osName = System.getProperty("os.name");
+ String osArch = System.getProperty("os.arch");
+ String osVersion = System.getProperty("os.version");
+ int coreCount = Runtime.getRuntime().availableProcessors();
+
+ JSONObject data = new JSONObject();
+
+ data.put("serverUUID", serverUUID);
+
+ data.put("playerAmount", playerAmount);
+ data.put("onlineMode", onlineMode);
+ data.put("bukkitVersion", serverVersion);
+
+ data.put("javaVersion", javaVersion);
+ data.put("osName", osName);
+ data.put("osArch", osArch);
+ data.put("osVersion", osVersion);
+ data.put("coreCount", coreCount);
+
+ return data;
+ }
+
+ public int getPlayerCount() {
+ return Fawe.imp() == null ? 1 : Fawe.imp().getPlayerCount();
+ }
+
+ /**
+ * Collects the data and sends it afterwards.
+ */
+ private void submitData() {
+ final JSONObject data = getServerData();
+
+ JSONArray pluginData = new JSONArray();
+ // Search for all other bStats Metrics classes to get their plugin data
+ for (Class> service : Bukkit.getServicesManager().getKnownServices()) {
+ try {
+ service.getField("B_STATS_VERSION"); // Our identifier :)
+
+ for (RegisteredServiceProvider> provider : Bukkit.getServicesManager()
+ .getRegistrations(service)) {
+ try {
+ pluginData.add(provider.getService().getMethod("getPluginData")
+ .invoke(provider.getProvider()));
+ } catch (NullPointerException | NoSuchMethodException | IllegalAccessException | InvocationTargetException ignored) {
+ }
+ }
+ } catch (NoSuchFieldException ignored) {
+ }
+ }
+
+ data.put("plugins", pluginData);
+
+ // Create a new thread for the connection to the bStats server
+ new Thread(() -> {
+ try {
+ // Send the data
+ sendData(plugin, data);
+ } catch (Exception e) {
+ // Something went wrong! :(
+ if (logFailedRequests) {
+ plugin.getLogger()
+ .log(Level.WARNING, "Could not submit plugin stats of " + plugin.getName(),
+ e);
+ }
+ }
+ }).start();
+ }
+
+ /**
+ * Sends the data to the bStats server.
+ *
+ * @param plugin Any plugin. It's just used to get a logger instance.
+ * @param data The data to send.
+ * @throws Exception If the request failed.
+ */
+ private static void sendData(Plugin plugin, JSONObject data) throws Exception {
+ if (data == null) {
+ throw new IllegalArgumentException("Data cannot be null!");
+ }
+ if (Bukkit.isPrimaryThread()) {
+ throw new IllegalAccessException(
+ "This method must not be called from the main thread!");
+ }
+ if (logSentData) {
+ plugin.getLogger().info("Sending data to bStats: " + data.toString());
+ }
+ HttpsURLConnection connection = (HttpsURLConnection) new URL(URL).openConnection();
+
+ // Compress the data to save bandwidth
+ byte[] compressedData = compress(data.toString());
+
+ // Add headers
+ connection.setRequestMethod("POST");
+ connection.addRequestProperty("Accept", "application/json");
+ connection.addRequestProperty("Connection", "close");
+ connection.addRequestProperty("Content-Encoding", "gzip"); // We gzip our request
+ connection.addRequestProperty("Content-Length", String.valueOf(compressedData.length));
+ connection.setRequestProperty("Content-Type",
+ "application/json"); // We send our data in JSON format
+ connection.setRequestProperty("User-Agent", "MC-Server/" + B_STATS_VERSION);
+
+ // Send data
+ connection.setDoOutput(true);
+ try (DataOutputStream outputStream = new DataOutputStream(connection.getOutputStream())) {
+ outputStream.write(compressedData);
+ outputStream.flush();
+ }
+
+ StringBuilder builder;
+ try (InputStream inputStream = connection.getInputStream();
+ BufferedReader bufferedReader = new BufferedReader(
+ new InputStreamReader(inputStream))) {
+
+ builder = new StringBuilder();
+ String line;
+ while ((line = bufferedReader.readLine()) != null) {
+ builder.append(line);
+ }
+ }
+ if (logResponseStatusText) {
+ plugin.getLogger()
+ .info("Sent data to bStats and received response: " + builder.toString());
+ }
+ }
+
+ /**
+ * Gzips the given String.
+ *
+ * @param str The string to gzip.
+ * @return The gzipped String.
+ * @throws IOException If the compression failed.
+ */
+ private static byte[] compress(final String str) throws IOException {
+ if (str == null) {
+ return null;
+ }
+ ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
+ GZIPOutputStream gzip = new GZIPOutputStream(outputStream);
+ gzip.write(str.getBytes(StandardCharsets.UTF_8));
+ gzip.close();
+ return outputStream.toByteArray();
+ }
+
+ /**
+ * Represents a custom chart.
+ */
+ public static abstract class CustomChart {
+
+ // The id of the chart
+ final String chartId;
+
+ /**
+ * Class constructor.
+ *
+ * @param chartId The id of the chart.
+ */
+ CustomChart(String chartId) {
+ if (chartId == null || chartId.isEmpty()) {
+ throw new IllegalArgumentException("ChartId cannot be null or empty!");
+ }
+ this.chartId = chartId;
+ }
+
+ private JSONObject getRequestJsonObject() {
+ JSONObject chart = new JSONObject();
+ chart.put("chartId", chartId);
+ try {
+ JSONObject data = getChartData();
+ if (data == null) {
+ // If the data is null we don't send the chart.
+ return null;
+ }
+ chart.put("data", data);
+ } catch (Throwable t) {
+ if (logFailedRequests) {
+ Bukkit.getLogger().log(Level.WARNING,
+ "Failed to get data for custom chart with id " + chartId, t);
+ }
+ return null;
+ }
+ return chart;
+ }
+
+ protected abstract JSONObject getChartData() throws Exception;
+
+ }
+
+
+ /**
+ * Represents a custom simple pie.
+ */
+ public static class SimplePie extends CustomChart {
+
+ private final Callable callable;
+
+ /**
+ * Class constructor.
+ *
+ * @param chartId The id of the chart.
+ * @param callable The callable which is used to request the chart data.
+ */
+ public SimplePie(String chartId, Callable callable) {
+ super(chartId);
+ this.callable = callable;
+ }
+
+ @Override protected JSONObject getChartData() throws Exception {
+ JSONObject data = new JSONObject();
+ String value = callable.call();
+ if (value == null || value.isEmpty()) {
+ // Null = skip the chart
+ return null;
+ }
+ data.put("value", value);
+ return data;
+ }
+ }
+
+
+ /**
+ * Represents a custom advanced pie.
+ */
+ public static class AdvancedPie extends CustomChart {
+
+ private final Callable