diff --git a/.github/ISSUE_TEMPLATE/bug---issue-report-for-fastasyncworldedit-1-13-2.md b/.github/ISSUE_TEMPLATE/bug---issue-report-for-fastasyncworldedit-1-13-2.md
index 47f004ca3..261b049fb 100644
--- a/.github/ISSUE_TEMPLATE/bug---issue-report-for-fastasyncworldedit-1-13-2.md
+++ b/.github/ISSUE_TEMPLATE/bug---issue-report-for-fastasyncworldedit-1-13-2.md
@@ -1,5 +1,5 @@
---
-name: Bug / Issue report for FastAsyncWorldEdit v1.15.2
+name: Bug / Issue report for FastAsyncWorldEdit v1.16.1
about: Bug / Issue report about this plugin
title: ''
labels: Requires Testing
@@ -7,9 +7,9 @@ assignees: ''
---
-# Bug report for FastAsyncWorldEdit 1.15.2
-
-
+# Bug report for FastAsyncWorldEdit 1.16.1
+
+
@@ -41,5 +41,5 @@ assignees: ''
- [] I included all information required in the sections above
- [] I made sure there are no duplicates of this report [(Use Search)](https://github.com/IntellectualSites/FastAsyncWorldEdit/issues?q=is%3Aissue)
-- [] I made sure I am using an up-to-date version of [FastAsyncWorldEdit for 1.15.2](https://ci.athion.net/job/FastAsyncWorldEdit-1.15/)
+- [] I made sure I am using an up-to-date version of [FastAsyncWorldEdit for 1.16.1](https://ci.athion.net/job/FastAsyncWorldEdit-1.16/)
- [] I made sure the bug/error is not caused by any other plugin
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
index ac23f5a75..58e192ab0 100644
--- a/.github/PULL_REQUEST_TEMPLATE.md
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -16,4 +16,4 @@ You can do so here: https://github.com/IntellectualSites/FastAsyncWorldEdit/issu
- [] I included all information required in the sections above
- [] I tested my changes and approved their functionality
- [] I ensured my changes do not break other parts of the code
-- [] I read and followed the [contribution guidelines](https://github.com/IntellectualSites/FastAsyncWorldEdit/blob/1.15/CONTRIBUTING.md)
+- [] I read and followed the [contribution guidelines](https://github.com/IntellectualSites/FastAsyncWorldEdit/blob/1.16/CONTRIBUTING.md)
diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml
index 96e52b293..016f67f78 100644
--- a/.github/workflows/gradle.yml
+++ b/.github/workflows/gradle.yml
@@ -3,10 +3,10 @@ name: Java CI
on:
push:
branches:
- - '1.15'
+ - '1.16'
pull_request:
branches:
- - '1.15'
+ - '1.16'
jobs:
test:
diff --git a/NOTICE.txt b/NOTICE.txt
new file mode 100644
index 000000000..f6ad72628
--- /dev/null
+++ b/NOTICE.txt
@@ -0,0 +1,18 @@
+This project uses code from the following projects. In some cases the code used may be modified.
+
+SnakeYAML
+
+Copyright (c) 2008, http://www.snakeyaml.org
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
diff --git a/README.md b/README.md
index 09b28f24b..8c90a3c07 100644
--- a/README.md
+++ b/README.md
@@ -11,20 +11,15 @@ FAWE is a fork of WorldEdit that has huge speed and memory improvements and cons
* [Spigot Page](https://www.spigotmc.org/threads/fast-async-worldedit.100104/)
* [Discord](https://discord.gg/KxkjDVg)
* [Wiki](https://wiki.intellectualsites.com/FastAsyncWorldEdit/index)
-* [Report Issue](https://github.com/IntellectualSites/FastAsyncWorldEdit-1.13/issues)
+* [Report Issue](https://github.com/IntellectualSites/FastAsyncWorldEdit/issues)
* [Crowdin](https://intellectualsites.crowdin.com/fastasyncworldedit)
+* [JavaDocs](https://ci.athion.net/job/FastAsyncWorldEdit-1.16/javadoc/)
## Downloads
-### 1.13+
+### 1.14+
* [Download](https://intellectualsites.github.io/download/fawe.html)
* [Jenkins](https://ci.athion.net/job/FastAsyncWorldEdit-1.16/)
-### < 1.12.2
-* [Download](https://intellectualsites.github.io/download/fawe.html)
-* [Jenkins](https://ci.athion.net/job/FastAsyncWorldEdit/)
-* [Repository](https://github.com/boy0001/FastAsyncWorldedit)
-* [JavaDoc](https://ci.athion.net/job/FastAsyncWorldEdit/javadoc/)
-
## Building
FAWE uses gradle to build
@@ -32,7 +27,7 @@ You can safely ignore `gradlew setupDecompWorkspace` if you are not planning to
```
$ gradlew setupDecompWorkspace
-$ gradlew build
+$ gradlew clean build -x test
```
The jar is located in `worldedit-bukkit/build/libs/FastAsyncWorldEdit-1.16-###.jar`
diff --git a/build.gradle.kts b/build.gradle.kts
index 84e6e066f..1c05b06ab 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -51,10 +51,10 @@ version = String.format("%s-%s", rootVersion, buildNumber)
if (!project.hasProperty("gitCommitHash")) {
apply(plugin = "org.ajoberstar.grgit")
ext["gitCommitHash"] = try {
- (ext["grgit"] as Grgit?)?.head()?.abbreviatedId
+ extensions.getByName("grgit").head()?.abbreviatedId
} catch (e: Exception) {
logger.warn("Error getting commit hash", e)
- "no_git_id"
+ "no.git.id"
}
}
diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts
index 138c405f0..60f5ff779 100644
--- a/buildSrc/build.gradle.kts
+++ b/buildSrc/build.gradle.kts
@@ -30,9 +30,9 @@ configurations.all {
resolutionStrategy {
// Fabric needs this.
force(
- "commons-io:commons-io:2.5",
- "org.ow2.asm:asm:7.1",
- "org.ow2.asm:asm-commons:7.1"
+ "commons-io:commons-io:2.6",
+ "org.ow2.asm:asm:8.0.1",
+ "org.ow2.asm:asm-commons:8.0.1"
)
}
}
@@ -48,13 +48,13 @@ val mixinVersion: String = properties.getProperty("mixin.version")
dependencies {
implementation(gradleApi())
implementation("gradle.plugin.net.minecrell:licenser:0.4.1")
- implementation("org.ajoberstar.grgit:grgit-gradle:3.1.1")
- implementation("com.github.jengelman.gradle.plugins:shadow:5.1.0")
+ implementation("org.ajoberstar.grgit:grgit-gradle:4.0.2")
+ implementation("com.github.jengelman.gradle.plugins:shadow:5.2.0")
implementation("net.ltgt.apt-eclipse:net.ltgt.apt-eclipse.gradle.plugin:0.21")
implementation("net.ltgt.apt-idea:net.ltgt.apt-idea.gradle.plugin:0.21")
- implementation("org.jfrog.buildinfo:build-info-extractor-gradle:4.9.7")
+ implementation("org.jfrog.buildinfo:build-info-extractor-gradle:4.16.0")
implementation("gradle.plugin.org.spongepowered:spongegradle:0.9.0")
- implementation("net.minecraftforge.gradle:ForgeGradle:3.0.168")
+ implementation("net.minecraftforge.gradle:ForgeGradle:3.0.179")
implementation("net.fabricmc:fabric-loom:$loomVersion")
implementation("net.fabricmc:sponge-mixin:$mixinVersion")
implementation("gradle.plugin.com.mendhak.gradlecrowdin:plugin:0.1.0")
diff --git a/buildSrc/src/main/kotlin/CommonConfig.kt b/buildSrc/src/main/kotlin/CommonConfig.kt
index 197e4bcde..f8fd2f797 100644
--- a/buildSrc/src/main/kotlin/CommonConfig.kt
+++ b/buildSrc/src/main/kotlin/CommonConfig.kt
@@ -10,7 +10,7 @@ fun Project.applyCommonConfiguration() {
mavenLocal()
maven { url = uri("https://mvn.intellectualsites.com/content/groups/public/") }
maven { url = uri("https://plotsquared.com/mvn/") }
- maven { url = uri("https://maven.sk89q.com/repo/") }
+ maven { url = uri("https://maven.enginehub.org/repo/") }
maven { url = uri("https://oss.sonatype.org/content/repositories/snapshots/") }
maven { url = uri("https://ci.athion.net/plugin/repository/tools/") }
maven { url = uri("https://repo.destroystokyo.com/repository/maven-public") }
@@ -21,7 +21,7 @@ fun Project.applyCommonConfiguration() {
}
configurations.all {
resolutionStrategy {
- cacheChangingModulesFor(5, "minutes")
+ cacheChangingModulesFor(5, "MINUTES")
}
}
}
diff --git a/buildSrc/src/main/kotlin/PlatformConfig.kt b/buildSrc/src/main/kotlin/PlatformConfig.kt
index 0c573871c..da14d923c 100644
--- a/buildSrc/src/main/kotlin/PlatformConfig.kt
+++ b/buildSrc/src/main/kotlin/PlatformConfig.kt
@@ -22,7 +22,7 @@ fun Project.applyPlatformAndCoreConfiguration() {
apply(plugin = "java")
apply(plugin = "idea")
apply(plugin = "maven")
- //apply(plugin = "checkstyle")
+// apply(plugin = "checkstyle")
apply(plugin = "com.github.johnrengelman.shadow")
ext["internalVersion"] = "$version;${rootProject.ext["gitCommitHash"]}"
@@ -34,7 +34,7 @@ fun Project.applyPlatformAndCoreConfiguration() {
// configure {
// configFile = rootProject.file("config/checkstyle/checkstyle.xml")
-// toolVersion = "7.6.1"
+// toolVersion = "8.34"
// }
tasks.withType().configureEach {
diff --git a/buildSrc/src/main/kotlin/Versions.kt b/buildSrc/src/main/kotlin/Versions.kt
index 4b3bb46e9..3985105db 100644
--- a/buildSrc/src/main/kotlin/Versions.kt
+++ b/buildSrc/src/main/kotlin/Versions.kt
@@ -3,7 +3,7 @@ import org.gradle.api.Project
object Versions {
const val TEXT = "3.0.4"
const val TEXT_EXTRAS = "3.0.5"
- const val PISTON = "0.5.5"
+ const val PISTON = "0.5.6"
const val AUTO_VALUE = "1.7"
const val JUNIT = "5.6.1"
const val MOCKITO = "3.3.3"
diff --git a/config/checkstyle/checkstyle-suppression.xml b/config/checkstyle/checkstyle-suppression.xml
new file mode 100644
index 000000000..a48ff1f81
--- /dev/null
+++ b/config/checkstyle/checkstyle-suppression.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/config/checkstyle/checkstyle.xml b/config/checkstyle/checkstyle.xml
index 8dbf07f8f..760dab104 100644
--- a/config/checkstyle/checkstyle.xml
+++ b/config/checkstyle/checkstyle.xml
@@ -1,73 +1,201 @@
-
+
-
-
-
-
-
-
-
-
-
+ "-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
+ "https://checkstyle.org/dtds/configuration_1_3.dtd">
-
+Checks based on Google Checks, modified for EngineHub.
+ -->
-
-
-
-
-
-
-
-
+
+
-
-
-
-
-
-
+
-
-
-
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/config/checkstyle/import-control.xml b/config/checkstyle/import-control.xml
deleted file mode 100644
index d15b7ac92..000000000
--- a/config/checkstyle/import-control.xml
+++ /dev/null
@@ -1,101 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/FaweBukkit.java b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/FaweBukkit.java
index 6a5327618..259486a00 100644
--- a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/FaweBukkit.java
+++ b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/FaweBukkit.java
@@ -29,12 +29,6 @@ import com.boydti.fawe.util.image.ImageViewer;
import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.bukkit.BukkitPlayer;
import io.papermc.lib.PaperLib;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.UUID;
-import java.util.function.Supplier;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@@ -47,6 +41,13 @@ import org.bukkit.plugin.PluginManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.UUID;
+import java.util.function.Supplier;
+
public class FaweBukkit implements IFawe, Listener {
private static final Logger log = LoggerFactory.getLogger(FaweBukkit.class);
@@ -83,18 +84,20 @@ public class FaweBukkit implements IFawe, Listener {
Bukkit.getServer().shutdown();
}
- chunksStretched = Integer.parseInt(Bukkit.getBukkitVersion().split("-")[0].split("\\.")[1]) >= 16;
-
+ chunksStretched =
+ Integer.parseInt(Bukkit.getBukkitVersion().split("-")[0].split("\\.")[1]) >= 16;
+
//Vault is Spigot/Paper only so this needs to be done in the Bukkit module
setupVault();
-
+
//PlotSquared support is limited to Spigot/Paper as of 02/20/2020
TaskManager.IMP.later(this::setupPlotSquared, 0);
-
+
// Registered delayed Event Listeners
TaskManager.IMP.task(() -> {
// Fix for ProtocolSupport
- Settings.IMP.PROTOCOL_SUPPORT_FIX = Bukkit.getPluginManager().isPluginEnabled("ProtocolSupport");
+ Settings.IMP.PROTOCOL_SUPPORT_FIX =
+ Bukkit.getPluginManager().isPluginEnabled("ProtocolSupport");
// This class
Bukkit.getPluginManager().registerEvents(FaweBukkit.this, FaweBukkit.this.plugin);
@@ -112,28 +115,31 @@ public class FaweBukkit implements IFawe, Listener {
}
}
- @Override
- public QueueHandler getQueueHandler() {
+ @Override public QueueHandler getQueueHandler() {
return new BukkitQueueHandler();
}
@Override
public synchronized ImageViewer getImageViewer(com.sk89q.worldedit.entity.Player player) {
- if (listeningImages && imageListener == null) return null;
+ if (listeningImages && imageListener == null) {
+ return null;
+ }
try {
listeningImages = true;
registerPacketListener();
PluginManager manager = Bukkit.getPluginManager();
if (manager.getPlugin("PacketListenerApi") == null) {
- File output = new File(plugin.getDataFolder().getParentFile(), "PacketListenerAPI_v3.7.6-SNAPSHOT.jar");
+ File output = new File(plugin.getDataFolder().getParentFile(),
+ "PacketListenerAPI_v3.7.6-SNAPSHOT.jar");
byte[] jarData = Jars.PL_v3_7_6.download();
try (FileOutputStream fos = new FileOutputStream(output)) {
fos.write(jarData);
}
}
if (manager.getPlugin("MapManager") == null) {
- File output = new File(plugin.getDataFolder().getParentFile(), "MapManager_v1.7.8-SNAPSHOT.jar");
+ File output = new File(plugin.getDataFolder().getParentFile(),
+ "MapManager_v1.7.8-SNAPSHOT.jar");
byte[] jarData = Jars.MM_v1_7_8.download();
try (FileOutputStream fos = new FileOutputStream(output)) {
fos.write(jarData);
@@ -144,17 +150,16 @@ public class FaweBukkit implements IFawe, Listener {
this.imageListener = new BukkitImageListener(plugin);
}
return viewer;
- } catch (Throwable ignore) {}
+ } catch (Throwable ignore) {
+ }
return null;
}
- @Override
- public void debug(final String message) {
+ @Override public void debug(final String message) {
Bukkit.getConsoleSender().sendMessage(message);
}
- @Override
- public File getDirectory() {
+ @Override public File getDirectory() {
return plugin.getDataFolder();
}
@@ -172,9 +177,6 @@ public class FaweBukkit implements IFawe, Listener {
return tmp;
}
- /**
- * Vault isn't required, but used for setting player permissions (WorldEdit bypass)
- */
private void setupVault() {
try {
this.vault = new VaultUtil();
@@ -182,8 +184,7 @@ public class FaweBukkit implements IFawe, Listener {
}
}
- @Override
- public String getDebugInfo() {
+ @Override public String getDebugInfo() {
StringBuilder msg = new StringBuilder();
msg.append("Server Version: ").append(Bukkit.getVersion()).append("\n");
msg.append("Plugins: \n");
@@ -195,10 +196,9 @@ public class FaweBukkit implements IFawe, Listener {
}
/**
- * The task manager handles sync/async tasks
+ * The task manager handles sync/async tasks.
*/
- @Override
- public TaskManager getTaskManager() {
+ @Override public TaskManager getTaskManager() {
return new BukkitTaskMan(plugin);
}
@@ -209,9 +209,9 @@ public class FaweBukkit implements IFawe, Listener {
/**
* A mask manager handles region restrictions e.g., PlotSquared plots / WorldGuard regions
*/
- @Override
- public Collection getMaskManagers() {
- final Plugin worldguardPlugin = Bukkit.getServer().getPluginManager().getPlugin("WorldGuard");
+ @Override public Collection getMaskManagers() {
+ final Plugin worldguardPlugin =
+ Bukkit.getServer().getPluginManager().getPlugin("WorldGuard");
final ArrayList managers = new ArrayList<>();
if (worldguardPlugin != null && worldguardPlugin.isEnabled()) {
try {
@@ -236,7 +236,8 @@ public class FaweBukkit implements IFawe, Listener {
} catch (Throwable ignored) {
}
}
- final Plugin griefpreventionPlugin = Bukkit.getServer().getPluginManager().getPlugin("GriefPrevention");
+ final Plugin griefpreventionPlugin =
+ Bukkit.getServer().getPluginManager().getPlugin("GriefPrevention");
if (griefpreventionPlugin != null && griefpreventionPlugin.isEnabled()) {
try {
managers.add(new GriefPreventionFeature(griefpreventionPlugin));
@@ -258,8 +259,7 @@ public class FaweBukkit implements IFawe, Listener {
private volatile boolean keepUnloaded;
- @EventHandler(priority = EventPriority.MONITOR)
- public void onWorldLoad(WorldLoadEvent event) {
+ @EventHandler(priority = EventPriority.MONITOR) public void onWorldLoad(WorldLoadEvent event) {
if (keepUnloaded) {
org.bukkit.World world = event.getWorld();
world.setKeepSpawnInMemory(false);
@@ -282,38 +282,34 @@ public class FaweBukkit implements IFawe, Listener {
wePlayer.unregister();
}
- @Override
- public String getPlatform() {
+ @Override public String getPlatform() {
return "Bukkit";
}
- @Override
- public UUID getUUID(String name) {
+ @Override public UUID getUUID(String name) {
return Bukkit.getOfflinePlayer(name).getUniqueId();
}
- @Override
- public String getName(UUID uuid) {
+ @Override public String getName(UUID uuid) {
return Bukkit.getOfflinePlayer(uuid).getName();
}
- @Override
- public Preloader getPreloader() {
+ @Override public Preloader getPreloader() {
if (PaperLib.isPaper()) {
return new AsyncPreloader();
}
return null;
}
- @Override
- public boolean isChunksStretched() {
+ @Override public boolean isChunksStretched() {
return chunksStretched;
}
private void setupPlotSquared() {
Plugin plotSquared = this.plugin.getServer().getPluginManager().getPlugin("PlotSquared");
- if (plotSquared == null)
+ if (plotSquared == null) {
return;
+ }
if (plotSquared.getClass().getPackage().toString().contains("intellectualsites")) {
WEManager.IMP.managers
.add(new com.boydti.fawe.bukkit.regions.plotsquaredv4.PlotSquaredFeature());
diff --git a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_14/BukkitGetBlocks_1_14.java b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_14/BukkitGetBlocks_1_14.java
index fd5902df1..4df159b0b 100644
--- a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_14/BukkitGetBlocks_1_14.java
+++ b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_14/BukkitGetBlocks_1_14.java
@@ -1,7 +1,5 @@
package com.boydti.fawe.bukkit.adapter.mc1_14;
-import static org.slf4j.LoggerFactory.getLogger;
-
import com.boydti.fawe.Fawe;
import com.boydti.fawe.FaweCache;
import com.boydti.fawe.beta.IChunkSet;
@@ -28,21 +26,6 @@ import com.sk89q.worldedit.internal.Constants;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.block.BlockTypes;
-import java.util.AbstractSet;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.Set;
-import java.util.UUID;
-import java.util.concurrent.Callable;
-import java.util.concurrent.Future;
-import java.util.function.Function;
-import java.util.stream.Collectors;
-import java.util.stream.StreamSupport;
import net.minecraft.server.v1_14_R1.BiomeBase;
import net.minecraft.server.v1_14_R1.BlockPosition;
import net.minecraft.server.v1_14_R1.Chunk;
@@ -72,6 +55,25 @@ import org.jetbrains.annotations.NotNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.util.AbstractSet;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.UUID;
+import java.util.concurrent.Callable;
+import java.util.concurrent.Future;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+import java.util.stream.StreamSupport;
+
+import static org.slf4j.LoggerFactory.getLogger;
+
+@SuppressWarnings("checkstyle:TypeName")
public class BukkitGetBlocks_1_14 extends CharGetBlocks {
private static final Logger log = LoggerFactory.getLogger(BukkitGetBlocks_1_14.class);
@@ -79,26 +81,27 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
public ChunkSection[] sections;
public Chunk nmsChunk;
public WorldServer world;
- public int X, Z;
+ public int chunkX;
+ public int chunkZ;
public NibbleArray[] blockLight = new NibbleArray[16];
public NibbleArray[] skyLight = new NibbleArray[16];
- public BukkitGetBlocks_1_14(World world, int X, int Z) {
- this(((CraftWorld) world).getHandle(), X, Z);
+ public BukkitGetBlocks_1_14(World world, int chunkX, int chunkZ) {
+ this(((CraftWorld) world).getHandle(), chunkX, chunkZ);
}
- public BukkitGetBlocks_1_14(WorldServer world, int X, int Z) {
+ public BukkitGetBlocks_1_14(WorldServer world, int chunkX, int chunkZ) {
this.world = world;
- this.X = X;
- this.Z = Z;
+ this.chunkX = chunkX;
+ this.chunkZ = chunkZ;
}
public int getX() {
- return X;
+ return chunkX;
}
public int getZ() {
- return Z;
+ return chunkZ;
}
@Override
@@ -109,16 +112,21 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
@Override
public CompoundTag getTile(int x, int y, int z) {
- TileEntity tileEntity = getChunk().getTileEntity(new BlockPosition((x & 15) + (X << 4), y, (z & 15) + (Z << 4)));
+ TileEntity tileEntity = getChunk().getTileEntity(
+ new BlockPosition((x & 15) + (chunkX << 4), y, (z & 15) + (chunkZ << 4)));
if (tileEntity == null) {
return null;
}
- return new LazyCompoundTag_1_14(Suppliers.memoize(() -> tileEntity.save(new NBTTagCompound())));
+ return new LazyCompoundTag_1_14(
+ Suppliers.memoize(() -> tileEntity.save(new NBTTagCompound())));
}
- private static final Function posNms2We = v -> BlockVector3.at(v.getX(), v.getY(), v.getZ());
+ private static final Function posNms2We =
+ v -> BlockVector3.at(v.getX(), v.getY(), v.getZ());
- private final static Function nmsTile2We = tileEntity -> new LazyCompoundTag_1_14(Suppliers.memoize(() -> tileEntity.save(new NBTTagCompound())));
+ private static final Function nmsTile2We =
+ tileEntity -> new LazyCompoundTag_1_14(
+ Suppliers.memoize(() -> tileEntity.save(new NBTTagCompound())));
@Override
public Map getTiles() {
@@ -135,19 +143,23 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
if (skyLight[layer] == null) {
//getDataLayerData
SectionPosition sectionPosition = SectionPosition.a(nmsChunk.getPos(), layer);
- NibbleArray nibbleArray = world.getChunkProvider().getLightEngine().a(EnumSkyBlock.SKY).a(sectionPosition);
+ NibbleArray nibbleArray =
+ world.getChunkProvider().getLightEngine().a(EnumSkyBlock.SKY).a(sectionPosition);
// If the server hasn't generated the section's NibbleArray yet, it will be null
if (nibbleArray == null) {
- byte[] a = new byte[2048];
- // Safe enough to assume if it's not created, it's under the sky. Unlikely to be created before lighting is fixed anyway.
- Arrays.fill(a, (byte) 15);
- nibbleArray = new NibbleArray(a);
- ((LightEngine) world.getChunkProvider().getLightEngine()).a(EnumSkyBlock.SKY, sectionPosition, nibbleArray);
+ byte[] a = new byte[2048];
+ // Safe enough to assume if it's not created, it's under the sky. Unlikely to be created before lighting is fixed anyway.
+ Arrays.fill(a, (byte) 15);
+ nibbleArray = new NibbleArray(a);
+ ((LightEngine) world.getChunkProvider().getLightEngine())
+ .a(EnumSkyBlock.SKY, sectionPosition, nibbleArray);
}
skyLight[layer] = nibbleArray;
}
long l = BlockPosition.a(x, y, z);
- return skyLight[layer].a(SectionPosition.b(BlockPosition.b(l)), SectionPosition.b(BlockPosition.c(l)), SectionPosition.b(BlockPosition.d(l)));
+ return skyLight[layer]
+ .a(SectionPosition.b(BlockPosition.b(l)), SectionPosition.b(BlockPosition.c(l)),
+ SectionPosition.b(BlockPosition.d(l)));
}
@Override
@@ -156,19 +168,23 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
if (blockLight[layer] == null) {
//getDataLayerData
SectionPosition sectionPosition = SectionPosition.a(nmsChunk.getPos(), layer);
- NibbleArray nibbleArray = world.getChunkProvider().getLightEngine().a(EnumSkyBlock.BLOCK).a(sectionPosition);
+ NibbleArray nibbleArray =
+ world.getChunkProvider().getLightEngine().a(EnumSkyBlock.BLOCK).a(sectionPosition);
// If the server hasn't generated the section's NibbleArray yet, it will be null
if (nibbleArray == null) {
byte[] a = new byte[2048];
// Safe enough to assume if it's not created, it's under the sky. Unlikely to be created before lighting is fixed anyway.
Arrays.fill(a, (byte) 15);
nibbleArray = new NibbleArray(a);
- ((LightEngine) world.getChunkProvider().getLightEngine()).a(EnumSkyBlock.BLOCK, sectionPosition, nibbleArray);
+ ((LightEngine) world.getChunkProvider().getLightEngine())
+ .a(EnumSkyBlock.BLOCK, sectionPosition, nibbleArray);
}
blockLight[layer] = nibbleArray;
}
long l = BlockPosition.a(x, y, z);
- return blockLight[layer].a(SectionPosition.b(BlockPosition.b(l)), SectionPosition.b(BlockPosition.c(l)), SectionPosition.b(BlockPosition.d(l)));
+ return blockLight[layer]
+ .a(SectionPosition.b(BlockPosition.b(l)), SectionPosition.b(BlockPosition.c(l)),
+ SectionPosition.b(BlockPosition.d(l)));
}
@Override
@@ -196,7 +212,9 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
List[] slices = getChunk().getEntitySlices();
int size = 0;
for (List slice : slices) {
- if (slice != null) size += slice.size();
+ if (slice != null) {
+ size += slice.size();
+ }
}
if (slices.length == 0) {
return Collections.emptySet();
@@ -238,19 +256,21 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
@NotNull
@Override
public Iterator iterator() {
- Iterable result = StreamSupport
- .stream(Iterables.concat(slices).spliterator(), false).map(input -> {
- BukkitImplAdapter adapter = WorldEditPlugin.getInstance()
- .getBukkitImplAdapter();
- NBTTagCompound tag = new NBTTagCompound();
- return (CompoundTag) adapter.toNative(input.save(tag));
- }).collect(Collectors.toList());
+ Iterable result =
+ StreamSupport.stream(Iterables.concat(slices).spliterator(), false)
+ .map(input -> {
+ BukkitImplAdapter adapter =
+ WorldEditPlugin.getInstance().getBukkitImplAdapter();
+ NBTTagCompound tag = new NBTTagCompound();
+ return (CompoundTag) adapter.toNative(input.save(tag));
+ }).collect(Collectors.toList());
return result.iterator();
}
};
}
- private void updateGet(BukkitGetBlocks_1_14 get, Chunk nmsChunk, ChunkSection[] sections, ChunkSection section, char[] arr, int layer) {
+ private void updateGet(BukkitGetBlocks_1_14 get, Chunk nmsChunk, ChunkSection[] sections,
+ ChunkSection section, char[] arr, int layer) {
synchronized (get) {
if (this.nmsChunk != nmsChunk) {
this.nmsChunk = nmsChunk;
@@ -271,15 +291,16 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
entity.die();
}
- public Chunk ensureLoaded(net.minecraft.server.v1_14_R1.World nmsWorld, int X, int Z) {
- return BukkitAdapter_1_14.ensureLoaded(nmsWorld, X, Z);
+ public Chunk ensureLoaded(net.minecraft.server.v1_14_R1.World nmsWorld, int chunkX,
+ int chunkZ) {
+ return BukkitAdapter_1_14.ensureLoaded(nmsWorld, chunkX, chunkZ);
}
@Override
public > T call(IChunkSet set, Runnable finalizer) {
try {
WorldServer nmsWorld = world;
- Chunk nmsChunk = ensureLoaded(nmsWorld, X, Z);
+ Chunk nmsChunk = ensureLoaded(nmsWorld, chunkX, chunkZ);
boolean fastmode = set.isFastMode() && Settings.IMP.QUEUE.NO_TICK_FASTMODE;
// Remove existing tiles
@@ -308,7 +329,9 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
ChunkSection[] sections = nmsChunk.getSections();
for (int layer = 0; layer < 16; layer++) {
- if (!set.hasSection(layer)) continue;
+ if (!set.hasSection(layer)) {
+ continue;
+ }
bitMask |= 1 << layer;
@@ -317,13 +340,16 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
ChunkSection existingSection = sections[layer];
if (existingSection == null) {
newSection = BukkitAdapter_1_14.newChunkSection(layer, setArr, fastmode);
- if (BukkitAdapter_1_14.setSectionAtomic(sections, null, newSection, layer)) {
+ if (BukkitAdapter_1_14
+ .setSectionAtomic(sections, null, newSection, layer)) {
updateGet(this, nmsChunk, sections, newSection, setArr, layer);
continue;
} else {
existingSection = sections[layer];
if (existingSection == null) {
- log.error("Skipping invalid null section. chunk:" + X + "," + Z + " layer: " + layer);
+ log.error(
+ "Skipping invalid null section. chunk:" + chunkX + "," + chunkZ
+ + " layer: " + layer);
continue;
}
}
@@ -348,9 +374,12 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
} else if (lock.isModified()) {
this.reset(layer);
}
- newSection = BukkitAdapter_1_14.newChunkSection(layer, this::load, setArr, fastmode);
- if (!BukkitAdapter_1_14.setSectionAtomic(sections, existingSection, newSection, layer)) {
- log.error("Failed to set chunk section:" + X + "," + Z + " layer: " + layer);
+ newSection = BukkitAdapter_1_14
+ .newChunkSection(layer, this::load, setArr, fastmode);
+ if (!BukkitAdapter_1_14
+ .setSectionAtomic(sections, existingSection, newSection, layer)) {
+ log.error("Failed to set chunk section:" + chunkX + "," + chunkZ
+ + " layer: " + layer);
continue;
} else {
updateGet(this, nmsChunk, sections, newSection, setArr, layer);
@@ -398,12 +427,14 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
Runnable[] syncTasks = null;
- int bx = X << 4;
- int bz = Z << 4;
+ int bx = chunkX << 4;
+ int bz = chunkZ << 4;
Set entityRemoves = set.getEntityRemoves();
if (entityRemoves != null && !entityRemoves.isEmpty()) {
- if (syncTasks == null) syncTasks = new Runnable[3];
+ if (syncTasks == null) {
+ syncTasks = new Runnable[3];
+ }
syncTasks[2] = () -> {
final List[] entities = nmsChunk.getEntitySlices();
@@ -425,7 +456,9 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
Set entities = set.getEntities();
if (entities != null && !entities.isEmpty()) {
- if (syncTasks == null) syncTasks = new Runnable[2];
+ if (syncTasks == null) {
+ syncTasks = new Runnable[2];
+ }
syncTasks[1] = () -> {
for (final CompoundTag nativeTag : entities) {
@@ -434,7 +467,8 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
final ListTag posTag = (ListTag) entityTagMap.get("Pos");
final ListTag rotTag = (ListTag) entityTagMap.get("Rotation");
if (idTag == null || posTag == null || rotTag == null) {
- getLogger(BukkitGetBlocks_1_14.class).debug("Unknown entity tag: " + nativeTag);
+ getLogger(BukkitGetBlocks_1_14.class)
+ .debug("Unknown entity tag: " + nativeTag);
continue;
}
final double x = posTag.getDouble(0);
@@ -455,7 +489,8 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
}
entity.f(tag);
entity.setLocation(x, y, z, yaw, pitch);
- nmsWorld.addEntity(entity, CreatureSpawnEvent.SpawnReason.CUSTOM);
+ nmsWorld
+ .addEntity(entity, CreatureSpawnEvent.SpawnReason.CUSTOM);
}
}
}
@@ -466,7 +501,9 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
// set tiles
Map tiles = set.getTiles();
if (tiles != null && !tiles.isEmpty()) {
- if (syncTasks == null) syncTasks = new Runnable[1];
+ if (syncTasks == null) {
+ syncTasks = new Runnable[1];
+ }
syncTasks[0] = () -> {
for (final Map.Entry entry : tiles.entrySet()) {
@@ -484,8 +521,10 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
tileEntity = nmsWorld.getTileEntity(pos);
}
if (tileEntity != null) {
- BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter();
- final NBTTagCompound tag = (NBTTagCompound) adapter.fromNative(nativeTag);
+ BukkitImplAdapter adapter =
+ WorldEditPlugin.getInstance().getBukkitImplAdapter();
+ final NBTTagCompound tag =
+ (NBTTagCompound) adapter.fromNative(nativeTag);
tag.set("x", new NBTTagInt(x));
tag.set("y", new NBTTagInt(y));
tag.set("z", new NBTTagInt(z));
@@ -508,8 +547,11 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
nmsChunk.mustNotSave = false;
nmsChunk.markDirty();
// send to player
- BukkitAdapter_1_14.sendChunk(nmsWorld, X, Z, finalMask, finalLightUpdate);
- if (finalizer != null) finalizer.run();
+ BukkitAdapter_1_14
+ .sendChunk(nmsWorld, chunkX, chunkZ, finalMask, finalLightUpdate);
+ if (finalizer != null) {
+ finalizer.run();
+ }
};
}
if (syncTasks != null) {
@@ -526,7 +568,9 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
}
}
if (callback == null) {
- if (finalizer != null) finalizer.run();
+ if (finalizer != null) {
+ finalizer.run();
+ }
return null;
} else {
return queueHandler.async(callback, null);
@@ -539,7 +583,9 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
return (T) (Future) queueHandler.sync(chain);
} else {
if (callback == null) {
- if (finalizer != null) finalizer.run();
+ if (finalizer != null) {
+ finalizer.run();
+ }
} else {
callback.run();
}
@@ -571,11 +617,13 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
lock.setModified(false);
// Efficiently convert ChunkSection to raw data
try {
- FAWE_Spigot_v1_14_R4 adapter = ((FAWE_Spigot_v1_14_R4) WorldEditPlugin.getInstance().getBukkitImplAdapter());
+ FAWE_Spigot_v1_14_R4 adapter =
+ ((FAWE_Spigot_v1_14_R4) WorldEditPlugin.getInstance().getBukkitImplAdapter());
final DataPaletteBlock blocks = section.getBlocks();
final DataBits bits = (DataBits) BukkitAdapter_1_14.fieldBits.get(blocks);
- final DataPalette palette = (DataPalette) BukkitAdapter_1_14.fieldPalette.get(blocks);
+ final DataPalette palette =
+ (DataPalette) BukkitAdapter_1_14.fieldPalette.get(blocks);
final int bitsPerEntry = bits.c();
final long[] blockStates = bits.a();
@@ -689,7 +737,7 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
synchronized (this) {
tmp = nmsChunk;
if (tmp == null) {
- nmsChunk = tmp = ensureLoaded(this.world, X, Z);
+ nmsChunk = tmp = ensureLoaded(this.world, chunkX, chunkZ);
}
}
}
@@ -702,12 +750,14 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
continue;
}
SectionPosition sectionPosition = SectionPosition.a(nmsChunk.getPos(), Y);
- NibbleArray nibble = world.getChunkProvider().getLightEngine().a(skyBlock).a(sectionPosition);
+ NibbleArray nibble =
+ world.getChunkProvider().getLightEngine().a(skyBlock).a(sectionPosition);
if (nibble == null) {
byte[] a = new byte[2048];
Arrays.fill(a, skyBlock == EnumSkyBlock.SKY ? (byte) 15 : (byte) 0);
nibble = new NibbleArray(a);
- ((LightEngine) world.getChunkProvider().getLightEngine()).a(skyBlock, sectionPosition, nibble);
+ ((LightEngine) world.getChunkProvider().getLightEngine())
+ .a(skyBlock, sectionPosition, nibble);
}
synchronized (nibble) {
for (int i = 0; i < 4096; i++) {
@@ -739,7 +789,9 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
try {
final DataPaletteBlock blocksExisting = existing.getBlocks();
- final DataPalette palette = (DataPalette) BukkitAdapter_1_14.fieldPalette.get(blocksExisting);
+ final DataPalette palette =
+ (DataPalette) BukkitAdapter_1_14.fieldPalette
+ .get(blocksExisting);
int paletteSize;
if (palette instanceof DataPaletteLinear) {
diff --git a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_16_1/BukkitGetBlocks_1_16_1.java b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_16_1/BukkitGetBlocks_1_16_1.java
index 9433308c2..515f5e07b 100644
--- a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_16_1/BukkitGetBlocks_1_16_1.java
+++ b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_16_1/BukkitGetBlocks_1_16_1.java
@@ -105,19 +105,18 @@ public class BukkitGetBlocks_1_16_1 extends CharGetBlocks {
return AdaptedMap.immutable(nmsTiles, posNms2We, nmsTile2We);
}
- @Override
- public int getSkyLight(int x, int y, int z) {
+ @Override public int getSkyLight(int x, int y, int z) {
int layer = y >> 4;
if (skyLight[layer] == null) {
SectionPosition sectionPosition = SectionPosition.a(nmsChunk.getPos(), layer);
NibbleArray nibbleArray = world.getChunkProvider().getLightEngine().a(EnumSkyBlock.SKY).a(sectionPosition);
// If the server hasn't generated the section's NibbleArray yet, it will be null
if (nibbleArray == null) {
- byte[] a = new byte[2048];
- // Safe enough to assume if it's not created, it's under the sky. Unlikely to be created before lighting is fixed anyway.
- Arrays.fill(a, (byte) 15);
- nibbleArray = new NibbleArray(a);
- ((LightEngine) world.getChunkProvider().getLightEngine()).a(EnumSkyBlock.SKY, sectionPosition, nibbleArray, true);
+ byte[] a = new byte[2048];
+ // Safe enough to assume if it's not created, it's under the sky. Unlikely to be created before lighting is fixed anyway.
+ Arrays.fill(a, (byte) 15);
+ nibbleArray = new NibbleArray(a);
+ ((LightEngine) world.getChunkProvider().getLightEngine()).a(EnumSkyBlock.SKY, sectionPosition, nibbleArray, true);
}
skyLight[layer] = nibbleArray;
}
@@ -125,21 +124,20 @@ public class BukkitGetBlocks_1_16_1 extends CharGetBlocks {
return skyLight[layer].a(SectionPosition.b(BlockPosition.b(l)), SectionPosition.b(BlockPosition.c(l)), SectionPosition.b(BlockPosition.d(l)));
}
- @Override
- public int getEmmittedLight(int x, int y, int z) {
+ @Override public int getEmmittedLight(int x, int y, int z) {
int layer = y >> 4;
- if (skyLight[layer] == null) {
+ if (blockLight[layer] == null) {
SectionPosition sectionPosition = SectionPosition.a(nmsChunk.getPos(), layer);
NibbleArray nibbleArray = world.getChunkProvider().getLightEngine().a(EnumSkyBlock.BLOCK).a(sectionPosition);
// If the server hasn't generated the section's NibbleArray yet, it will be null
if (nibbleArray == null) {
- byte[] a = new byte[2048];
- // Safe enough to assume if it's not created, it's under the sky. Unlikely to be created before lighting is fixed anyway.
- Arrays.fill(a, (byte) 15);
- nibbleArray = new NibbleArray(a);
- ((LightEngine) world.getChunkProvider().getLightEngine()).a(EnumSkyBlock.BLOCK, sectionPosition, nibbleArray, true);
+ byte[] a = new byte[2048];
+ // Safe enough to assume if it's not created, it's under the sky. Unlikely to be created before lighting is fixed anyway.
+ Arrays.fill(a, (byte) 15);
+ nibbleArray = new NibbleArray(a);
+ ((LightEngine) world.getChunkProvider().getLightEngine()).a(EnumSkyBlock.BLOCK, sectionPosition, nibbleArray, true);
}
- skyLight[layer] = nibbleArray;
+ blockLight[layer] = nibbleArray;
}
long l = BlockPosition.a(x, y, z);
return blockLight[layer].a(SectionPosition.b(BlockPosition.b(l)), SectionPosition.b(BlockPosition.c(l)), SectionPosition.b(BlockPosition.d(l)));
diff --git a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/regions/plotsquared/FaweRegionManager.java b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/regions/plotsquared/FaweRegionManager.java
index 4660c20e4..d127afca2 100644
--- a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/regions/plotsquared/FaweRegionManager.java
+++ b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/regions/plotsquared/FaweRegionManager.java
@@ -16,6 +16,7 @@ import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.MaxChangedBlocksException;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.bukkit.BukkitAdapter;
+import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
import com.sk89q.worldedit.extent.clipboard.Clipboard;
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats;
import com.sk89q.worldedit.function.FlatRegionFunction;
@@ -24,6 +25,7 @@ import com.sk89q.worldedit.function.operation.ForwardExtentCopy;
import com.sk89q.worldedit.function.operation.Operations;
import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.function.visitor.FlatRegionVisitor;
+import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.CuboidRegion;
import com.sk89q.worldedit.regions.Region;
@@ -41,7 +43,7 @@ import static org.bukkit.Bukkit.getWorld;
public class FaweRegionManager extends RegionManager {
- private RegionManager parent;
+ private final RegionManager parent;
public FaweRegionManager(RegionManager parent) {
this.parent = parent;
@@ -59,6 +61,9 @@ public class FaweRegionManager extends RegionManager {
@Override
public boolean setCuboids(final PlotArea area, final Set regions, final Pattern blocks, final int minY, final int maxY) {
+ if (!com.boydti.fawe.config.Settings.IMP.PLOTSQUARED_INTEGRATION.CUBOIDS) {
+ return parent.setCuboids(area, regions, blocks, minY, maxY);
+ }
TaskManager.IMP.async(() -> {
synchronized (FaweRegionManager.class) {
World world = BukkitAdapter.adapt(getWorld(area.getWorldName()));
@@ -80,7 +85,7 @@ public class FaweRegionManager extends RegionManager {
@Override
public boolean notifyClear(PlotManager manager) {
- if (!(manager instanceof HybridPlotManager)) {
+ if (!com.boydti.fawe.config.Settings.IMP.PLOTSQUARED_INTEGRATION.CLEAR || !(manager instanceof HybridPlotManager)) {
return false;
}
final HybridPlotWorld hpw = ((HybridPlotManager) manager).getHybridPlotWorld();
@@ -89,7 +94,7 @@ public class FaweRegionManager extends RegionManager {
@Override
public boolean handleClear(final Plot plot, final Runnable whenDone, final PlotManager manager) {
- if (!(manager instanceof HybridPlotManager)) {
+ if (!com.boydti.fawe.config.Settings.IMP.PLOTSQUARED_INTEGRATION.CLEAR || !(manager instanceof HybridPlotManager)) {
return false;
}
TaskManager.IMP.async(() -> {
@@ -108,21 +113,29 @@ public class FaweRegionManager extends RegionManager {
final Pattern filling = hybridPlotWorld.MAIN_BLOCK.toPattern();
final Pattern plotfloor = hybridPlotWorld.TOP_BLOCK.toPattern();
+ final BiomeType biome = hybridPlotWorld.getPlotBiome();
- BlockVector3 pos1 = plot.getBottomAbs().getBlockVector3();
- BlockVector3 pos2 = plot.getExtendedTopAbs().getBlockVector3();
+ BlockVector3 pos1 = BlockVector3.ZERO;
+ BlockVector3 pos2 = BlockVector3.at(hybridPlotWorld.PLOT_WIDTH - 1, 255, hybridPlotWorld.PLOT_WIDTH - 1);
- Region bedrockRegion = new CuboidRegion(pos1.withY(0), pos2.withY(0));
+ Region bedrockRegion = new CuboidRegion(pos1, pos2.withY(0));
Region fillingRegion = new CuboidRegion(pos1.withY(1), pos2.withY(hybridPlotWorld.PLOT_HEIGHT - 1));
- Region floorRegion = new CuboidRegion(pos1.withY(hybridPlotWorld.PLOT_HEIGHT),
- pos2.withY(hybridPlotWorld.PLOT_HEIGHT));
- Region airRegion = new CuboidRegion(pos1.withY(hybridPlotWorld.PLOT_HEIGHT + 1),
- pos2.withY(manager.getWorldHeight()));
+ Region floorRegion = new CuboidRegion(pos1.withY(hybridPlotWorld.PLOT_HEIGHT), pos2.withY(hybridPlotWorld.PLOT_HEIGHT));
+ Region airRegion = new CuboidRegion(pos1.withY(hybridPlotWorld.PLOT_HEIGHT + 1), pos2.withY(manager.getWorldHeight()));
- editSession.setBlocks(bedrockRegion, bedrock);
- editSession.setBlocks(fillingRegion, filling);
- editSession.setBlocks(floorRegion, plotfloor);
- editSession.setBlocks(airRegion, air);
+ Clipboard clipboard = new BlockArrayClipboard(new CuboidRegion(pos1, pos2));
+
+ clipboard.setBlocks(bedrockRegion, bedrock);
+ clipboard.setBlocks(fillingRegion, filling);
+ clipboard.setBlocks(floorRegion, plotfloor);
+ clipboard.setBlocks(airRegion, air);
+ for (int x = pos1.getX(); x <= pos2.getX(); x ++) {
+ for (int z = pos1.getZ(); z <= pos2.getZ(); z ++) {
+ clipboard.setBiome(BlockVector2.at(x, z), biome);
+ }
+ }
+
+ clipboard.paste(editSession, plot.getBottomAbs().getBlockVector3().withY(0), true, false, true);
}
if (hybridPlotWorld.PLOT_SCHEMATIC) {
@@ -149,13 +162,15 @@ public class FaweRegionManager extends RegionManager {
@Override
public void swap(final Location pos1, final Location pos2, final Location pos3, final Location pos4, final Runnable whenDone) {
+ if (!com.boydti.fawe.config.Settings.IMP.PLOTSQUARED_INTEGRATION.COPY_AND_SWAP) {
+ parent.swap(pos1, pos2, pos3, pos4, whenDone);
+ }
TaskManager.IMP.async(() -> {
synchronized (FaweRegionManager.class) {
//todo because of the following code this should proably be in the Bukkit module
World pos1World = BukkitAdapter.adapt(getWorld(pos1.getWorld()));
World pos3World = BukkitAdapter.adapt(getWorld(pos3.getWorld()));
- WorldEdit.getInstance().getEditSessionFactory().getEditSession(
- pos1World,-1);
+ WorldEdit.getInstance().getEditSessionFactory().getEditSession(pos1World,-1);
EditSession sessionA = new EditSessionBuilder(pos1World).checkMemory(false).fastmode(true).limitUnlimited().changeSetNull().autoQueue(false).build();
EditSession sessionB = new EditSessionBuilder(pos3World).checkMemory(false).fastmode(true).limitUnlimited().changeSetNull().autoQueue(false).build();
CuboidRegion regionA = new CuboidRegion(BlockVector3.at(pos1.getX(), pos1.getY(), pos1.getZ()), BlockVector3.at(pos2.getX(), pos2.getY(), pos2.getZ()));
@@ -177,6 +192,9 @@ public class FaweRegionManager extends RegionManager {
@Override
public void setBiome(CuboidRegion region, int extendBiome, BiomeType biome, String world, Runnable whenDone) {
+ if (!com.boydti.fawe.config.Settings.IMP.PLOTSQUARED_INTEGRATION.SET_BIOME) {
+ parent.setBiome(region, extendBiome, biome, world, whenDone);
+ }
region.expand(BlockVector3.at(extendBiome, 0, extendBiome));
region.expand(BlockVector3.at(-extendBiome, 0, -extendBiome));
TaskManager.IMP.async(() -> {
@@ -197,6 +215,9 @@ public class FaweRegionManager extends RegionManager {
@Override
public boolean copyRegion(final Location pos1, final Location pos2, final Location pos3, final Runnable whenDone) {
+ if (!com.boydti.fawe.config.Settings.IMP.PLOTSQUARED_INTEGRATION.COPY_AND_SWAP) {
+ return parent.copyRegion(pos1, pos2, pos3, whenDone);
+ }
TaskManager.IMP.async(() -> {
synchronized (FaweRegionManager.class) {
World pos1World = BukkitAdapter.adapt(getWorld(pos1.getWorld()));
@@ -222,11 +243,8 @@ public class FaweRegionManager extends RegionManager {
TaskManager.IMP.async(() -> {
synchronized (FaweRegionManager.class) {
World pos1World = BukkitAdapter.adapt(getWorld(pos1.getWorld()));
- try (EditSession editSession = new EditSessionBuilder(pos1World).checkMemory(false)
- .fastmode(true).limitUnlimited().changeSetNull().autoQueue(false).build()) {
- CuboidRegion region = new CuboidRegion(
- BlockVector3.at(pos1.getX(), pos1.getY(), pos1.getZ()),
- BlockVector3.at(pos2.getX(), pos2.getY(), pos2.getZ()));
+ try (EditSession editSession = new EditSessionBuilder(pos1World).checkMemory(false).fastmode(true).limitUnlimited().changeSetNull().autoQueue(false).build()) {
+ CuboidRegion region = new CuboidRegion(BlockVector3.at(pos1.getX(), pos1.getY(), pos1.getZ()), BlockVector3.at(pos2.getX(), pos2.getY(), pos2.getZ()));
editSession.regenerate(region);
editSession.flushQueue();
}
diff --git a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/regions/plotsquared/PlotSquaredFeature.java b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/regions/plotsquared/PlotSquaredFeature.java
index e51494aed..e54c68125 100644
--- a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/regions/plotsquared/PlotSquaredFeature.java
+++ b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/regions/plotsquared/PlotSquaredFeature.java
@@ -39,7 +39,7 @@ public class PlotSquaredFeature extends FaweMaskManager {
public PlotSquaredFeature() {
super("PlotSquared");
log.debug("Optimizing PlotSquared");
- if (com.boydti.fawe.config.Settings.IMP.PLOTSQUARED_HOOK) {
+ if (com.boydti.fawe.config.Settings.IMP.ENABLED_COMPONENTS.PLOTSQUARED_HOOK) {
Settings.Enabled_Components.WORLDEDIT_RESTRICTIONS = false;
try {
setupBlockQueue();
diff --git a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/regions/plotsquaredv4/FaweChunkManager.java b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/regions/plotsquaredv4/FaweChunkManager.java
index b4b11f439..2d3e9b613 100644
--- a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/regions/plotsquaredv4/FaweChunkManager.java
+++ b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/regions/plotsquaredv4/FaweChunkManager.java
@@ -2,6 +2,7 @@ package com.boydti.fawe.bukkit.regions.plotsquaredv4;
import static org.bukkit.Bukkit.getWorld;
+import com.boydti.fawe.config.Settings;
import com.boydti.fawe.util.EditSessionBuilder;
import com.boydti.fawe.util.TaskManager;
import com.github.intellectualsites.plotsquared.plot.object.Location;
@@ -49,6 +50,9 @@ public class FaweChunkManager extends ChunkManager {
@Override
public void swap(final Location pos1, final Location pos2, final Location pos3, final Location pos4, final Runnable whenDone) {
+ if (!Settings.IMP.PLOTSQUARED_INTEGRATION.COPY_AND_SWAP) {
+ parent.swap(pos1, pos2, pos3, pos4, whenDone);
+ }
TaskManager.IMP.async(() -> {
synchronized (FaweChunkManager.class) {
//todo because of the following code this should proably be in the Bukkit module
@@ -77,6 +81,9 @@ public class FaweChunkManager extends ChunkManager {
@Override
public boolean copyRegion(final Location pos1, final Location pos2, final Location pos3, final Runnable whenDone) {
+ if (!Settings.IMP.PLOTSQUARED_INTEGRATION.COPY_AND_SWAP) {
+ return parent.copyRegion(pos1, pos2, pos3, whenDone);
+ }
TaskManager.IMP.async(() -> {
synchronized (FaweChunkManager.class) {
World pos1World = BukkitAdapter.adapt(getWorld(pos1.getWorld()));
diff --git a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/regions/plotsquaredv4/PlotSquaredFeature.java b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/regions/plotsquaredv4/PlotSquaredFeature.java
index d1df6b58d..059fe87c8 100644
--- a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/regions/plotsquaredv4/PlotSquaredFeature.java
+++ b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/regions/plotsquaredv4/PlotSquaredFeature.java
@@ -41,7 +41,7 @@ public class PlotSquaredFeature extends FaweMaskManager {
public PlotSquaredFeature() {
super("PlotSquared");
log.debug("Optimizing PlotSquared");
- if (com.boydti.fawe.config.Settings.IMP.PLOTSQUARED_HOOK) {
+ if (com.boydti.fawe.config.Settings.IMP.ENABLED_COMPONENTS.PLOTSQUARED_HOOK) {
Settings.Enabled_Components.WORLDEDIT_RESTRICTIONS = false;
try {
setupBlockQueue();
diff --git a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/util/BukkitReflectionUtils.java b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/util/BukkitReflectionUtils.java
index d62e54853..aa91f4a60 100644
--- a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/util/BukkitReflectionUtils.java
+++ b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/util/BukkitReflectionUtils.java
@@ -8,16 +8,16 @@ import java.lang.reflect.Method;
public class BukkitReflectionUtils {
/**
- * prefix of bukkit classes
+ * Prefix of Bukkit classes.
*/
private static volatile String preClassB = null;
/**
- * prefix of minecraft classes
+ * Prefix of Minecraft classes.
*/
private static volatile String preClassM = null;
/**
- * check server version and class names
+ * Check server version and class names.
*/
public static void init() {
final Server server = Bukkit.getServer();
@@ -50,18 +50,22 @@ public class BukkitReflectionUtils {
* @return RefClass object
* @throws RuntimeException if no class found
*/
- public static ReflectionUtils.RefClass getRefClass(final String... classes) throws RuntimeException {
+ public static ReflectionUtils.RefClass getRefClass(final String... classes)
+ throws RuntimeException {
if (preClassM == null) {
init();
}
for (String className : classes) {
try {
- className = className.replace("{cb}", preClassB).replace("{nms}", preClassM).replace("{nm}", "net.minecraft");
+ className = className.replace("{cb}", preClassB).replace("{nms}", preClassM)
+ .replace("{nm}", "net.minecraft");
return ReflectionUtils.getRefClass(Class.forName(className));
} catch (final ClassNotFoundException ignored) {
}
}
- throw new RuntimeException("no class found: " + classes[0].replace("{cb}", preClassB).replace("{nms}", preClassM).replace("{nm}", "net.minecraft"));
+ throw new RuntimeException(
+ "no class found: " + classes[0].replace("{cb}", preClassB).replace("{nms}", preClassM)
+ .replace("{nm}", "net.minecraft"));
}
public static Class> getNmsClass(final String name) {
diff --git a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/wrapper/AsyncBlock.java b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/wrapper/AsyncBlock.java
index 5211c618a..dc7bfd742 100644
--- a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/wrapper/AsyncBlock.java
+++ b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/wrapper/AsyncBlock.java
@@ -9,10 +9,8 @@ import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockID;
import com.sk89q.worldedit.world.block.BlockState;
-import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.block.BlockTypes;
import com.sk89q.worldedit.world.block.BlockTypesCache;
-import java.util.Collections;
import org.bukkit.FluidCollisionMode;
import org.bukkit.Location;
import org.bukkit.Material;
@@ -31,8 +29,8 @@ import org.bukkit.util.Vector;
import org.jetbrains.annotations.NotNull;
import java.util.Collection;
+import java.util.Collections;
import java.util.List;
-import org.jetbrains.annotations.Nullable;
public class AsyncBlock implements Block {
@@ -72,27 +70,33 @@ public class AsyncBlock implements Block {
return world.getBlock(x, y, z).getBlockType().getInternalId();
}
- @NotNull @Override
+ @NotNull
+ @Override
public AsyncBlock getRelative(int modX, int modY, int modZ) {
return new AsyncBlock(world, x + modX, y + modY, z + modZ);
}
- @NotNull @Override
+ @NotNull
+ @Override
public AsyncBlock getRelative(BlockFace face) {
return this.getRelative(face.getModX(), face.getModY(), face.getModZ());
}
- @NotNull @Override
+ @NotNull
+ @Override
public AsyncBlock getRelative(BlockFace face, int distance) {
- return this.getRelative(face.getModX() * distance, face.getModY() * distance, face.getModZ() * distance);
+ return this.getRelative(face.getModX() * distance, face.getModY() * distance,
+ face.getModZ() * distance);
}
- @NotNull @Override
+ @NotNull
+ @Override
public Material getType() {
return getBlockData().getMaterial();
}
- @NotNull @Override
+ @NotNull
+ @Override
public BlockData getBlockData() {
return BukkitAdapter.adapt(world.getBlock(x, y, z));
}
@@ -137,7 +141,8 @@ public class AsyncBlock implements Block {
return (byte) 15;
}
- @NotNull @Override
+ @NotNull
+ @Override
public AsyncWorld getWorld() {
return world;
}
@@ -157,14 +162,15 @@ public class AsyncBlock implements Block {
return z;
}
- @NotNull @Override
+ @NotNull
+ @Override
public Location getLocation() {
return new Location(world, x, y, z);
}
@Override
public Location getLocation(Location loc) {
- if(loc != null) {
+ if (loc != null) {
loc.setWorld(this.getWorld());
loc.setX(this.x);
loc.setY(this.y);
@@ -173,7 +179,8 @@ public class AsyncBlock implements Block {
return loc;
}
- @NotNull @Override
+ @NotNull
+ @Override
public AsyncChunk getChunk() {
return world.getChunkAt(x >> 4, z >> 4);
}
@@ -219,7 +226,8 @@ public class AsyncBlock implements Block {
return null;
}
- @NotNull @Override
+ @NotNull
+ @Override
public AsyncBlockState getState() {
BaseBlock state = world.getFullBlock(x, y, z);
switch (state.getBlockType().getInternalId()) {
@@ -247,7 +255,8 @@ public class AsyncBlock implements Block {
return getState();
}
- @NotNull @Override
+ @NotNull
+ @Override
public Biome getBiome() {
return world.getAdapter().adapt(world.getBiomeType(x, y, z));
}
@@ -339,13 +348,15 @@ public class AsyncBlock implements Block {
public boolean breakNaturally(@NotNull ItemStack tool, boolean value) {
return TaskManager.IMP.sync(() -> getUnsafeBlock().breakNaturally(tool));
}
-
- @NotNull @Override
+
+ @NotNull
+ @Override
public Collection getDrops() {
return TaskManager.IMP.sync(() -> getUnsafeBlock().getDrops());
}
- @NotNull @Override
+ @NotNull
+ @Override
public Collection getDrops(@NotNull ItemStack tool) {
return TaskManager.IMP.sync(() -> getUnsafeBlock().getDrops(tool));
}
@@ -355,7 +366,8 @@ public class AsyncBlock implements Block {
this.getUnsafeBlock().setMetadata(metadataKey, newMetadataValue);
}
- @NotNull @Override
+ @NotNull
+ @Override
public List getMetadata(@NotNull String metadataKey) {
return this.getUnsafeBlock().getMetadata(metadataKey);
}
@@ -376,11 +388,13 @@ public class AsyncBlock implements Block {
}
@Override
- public RayTraceResult rayTrace(@NotNull Location arg0, @NotNull Vector arg1, double arg2, @NotNull FluidCollisionMode arg3) {
+ public RayTraceResult rayTrace(@NotNull Location arg0, @NotNull Vector arg1, double arg2,
+ @NotNull FluidCollisionMode arg3) {
return this.getUnsafeBlock().rayTrace(arg0, arg1, arg2, arg3);
}
- @NotNull @Override
+ @NotNull
+ @Override
public BoundingBox getBoundingBox() {
return this.getUnsafeBlock().getBoundingBox();
}
diff --git a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/wrapper/AsyncBlockState.java b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/wrapper/AsyncBlockState.java
index 8b171a9a6..c8ab44cfe 100644
--- a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/wrapper/AsyncBlockState.java
+++ b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/wrapper/AsyncBlockState.java
@@ -1,19 +1,14 @@
package com.boydti.fawe.bukkit.wrapper;
-import com.boydti.fawe.FaweCache;
import com.sk89q.jnbt.CompoundTag;
-import java.util.List;
-
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockType;
-import com.sk89q.worldedit.world.block.BlockTypes;
import com.sk89q.worldedit.world.block.BlockTypesCache;
import org.bukkit.Chunk;
import org.bukkit.Location;
import org.bukkit.Material;
-import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.BlockState;
import org.bukkit.block.data.BlockData;
@@ -22,6 +17,8 @@ import org.bukkit.metadata.MetadataValue;
import org.bukkit.plugin.Plugin;
import org.jetbrains.annotations.NotNull;
+import java.util.List;
+
public class AsyncBlockState implements BlockState {
private BaseBlock state;
@@ -165,7 +162,8 @@ public class AsyncBlockState implements BlockState {
@Override
public void setRawData(byte data) {
int combinedId = getTypeId() + (data << BlockTypesCache.BIT_OFFSET);
- state = com.sk89q.worldedit.world.block.BlockState.getFromInternalId(combinedId).toBaseBlock(state.getNbtData());
+ state = com.sk89q.worldedit.world.block.BlockState.getFromInternalId(combinedId)
+ .toBaseBlock(state.getNbtData());
this.blockData = BukkitAdapter.adapt(state);
}
diff --git a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/wrapper/AsyncChunk.java b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/wrapper/AsyncChunk.java
index 2256cec7f..d2e3cb30b 100644
--- a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/wrapper/AsyncChunk.java
+++ b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/wrapper/AsyncChunk.java
@@ -1,10 +1,8 @@
package com.boydti.fawe.bukkit.wrapper;
import com.boydti.fawe.Fawe;
-import com.boydti.fawe.object.RunnableVal;
import com.boydti.fawe.util.MathMan;
import com.boydti.fawe.util.TaskManager;
-import java.util.function.Supplier;
import org.bukkit.Chunk;
import org.bukkit.ChunkSnapshot;
import org.bukkit.World;
@@ -15,6 +13,7 @@ import org.bukkit.plugin.Plugin;
import org.jetbrains.annotations.NotNull;
import java.util.Collection;
+import java.util.function.Supplier;
public class AsyncChunk implements Chunk {
@@ -68,11 +67,14 @@ public class AsyncChunk implements Chunk {
}
@Override
- public ChunkSnapshot getChunkSnapshot(boolean includeMaxblocky, boolean includeBiome, boolean includeBiomeTempRain) {
+ public ChunkSnapshot getChunkSnapshot(boolean includeMaxblocky, boolean includeBiome,
+ boolean includeBiomeTempRain) {
if (Fawe.isMainThread()) {
- return world.getChunkAt(x, z).getChunkSnapshot(includeMaxblocky, includeBiome, includeBiomeTempRain);
+ return world.getChunkAt(x, z)
+ .getChunkSnapshot(includeMaxblocky, includeBiome, includeBiomeTempRain);
}
- return whenLoaded(() -> world.getChunkAt(x, z).getChunkSnapshot(includeBiome, includeBiome, includeBiomeTempRain));
+ return whenLoaded(() -> world.getChunkAt(x, z)
+ .getChunkSnapshot(includeBiome, includeBiome, includeBiomeTempRain));
}
private T whenLoaded(Supplier task) {
diff --git a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/wrapper/AsyncWorld.java b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/wrapper/AsyncWorld.java
index 847b17a62..63b98efb8 100644
--- a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/wrapper/AsyncWorld.java
+++ b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/wrapper/AsyncWorld.java
@@ -13,14 +13,6 @@ import com.sk89q.worldedit.extent.PassthroughExtent;
import com.sk89q.worldedit.function.operation.Operation;
import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.block.BlockState;
-import java.io.File;
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.UUID;
-import java.util.concurrent.CompletableFuture;
-import java.util.function.Predicate;
import org.bukkit.BlockChangeDelegate;
import org.bukkit.Bukkit;
import org.bukkit.Chunk;
@@ -69,14 +61,24 @@ import org.bukkit.util.Vector;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
+import java.io.File;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.UUID;
+import java.util.concurrent.CompletableFuture;
+import java.util.function.Predicate;
+
/**
* Modify the world from an async thread
- * - Use world.commit() to execute all the changes
- * - Any Chunk/Block/BlockState objects returned should also be safe to use from the same async thread
- * - Only block read,write and biome write are fast, other methods will perform slower async
- * -
- * @see #wrap(World)
- * @see #create(WorldCreator)
+ * - Use world.commit() to execute all the changes
+ * - Any Chunk/Block/BlockState objects returned should also be safe to use from the same async thread
+ * - Only block read,write and biome write are fast, other methods will perform slower async
+ * -
+ *
+ * @see #wrap(World)
+ * @see #create(WorldCreator)
*/
public class AsyncWorld extends PassthroughExtent implements World {
@@ -84,14 +86,15 @@ public class AsyncWorld extends PassthroughExtent implements World {
private BukkitImplAdapter adapter;
@Override
- public void spawnParticle(@NotNull Particle particle, double v, double v1, double v2, int i, double v3, double v4, double v5, double v6, T t) {
+ public void spawnParticle(@NotNull Particle particle, double v, double v1, double v2, int i,
+ double v3, double v4, double v5, double v6, T t) {
parent.spawnParticle(particle, v, v1, v2, i, v3, v4, v5, v6, t);
}
/**
- * @deprecated use {@link #wrap(World)} instead
- * @param parent Parent world
+ * @param parent Parent world
* @param autoQueue
+ * @deprecated use {@link #wrap(World)} instead
*/
@Deprecated
public AsyncWorld(World parent, boolean autoQueue) {
@@ -103,9 +106,9 @@ public class AsyncWorld extends PassthroughExtent implements World {
}
/**
- * @deprecated use {@link #wrap(World)} instead
* @param parent
* @param extent
+ * @deprecated use {@link #wrap(World)} instead
*/
@Deprecated
public AsyncWorld(World parent, Extent extent) {
@@ -115,7 +118,8 @@ public class AsyncWorld extends PassthroughExtent implements World {
}
/**
- * Wrap a world for async usage
+ * Wrap a world for async usage.
+ *
* @param world
* @return
*/
@@ -137,7 +141,8 @@ public class AsyncWorld extends PassthroughExtent implements World {
/**
* Create a world async (untested)
- * - Only optimized for 1.10
+ * - Only optimized for 1.10
+ *
* @param creator
* @return
*/
@@ -173,47 +178,56 @@ public class AsyncWorld extends PassthroughExtent implements World {
}
@Override
- public void spawnParticle(@NotNull Particle particle, @NotNull Location location, int i, T t) {
+ public void spawnParticle(@NotNull Particle particle, @NotNull Location location, int i,
+ T t) {
parent.spawnParticle(particle, location, i, t);
}
@Override
- public void spawnParticle(@NotNull Particle particle, double x, double y, double z, int count, T data) {
+ public void spawnParticle(@NotNull Particle particle, double x, double y, double z,
+ int count, T data) {
parent.spawnParticle(particle, x, y, z, count, data);
}
@Override
- public void spawnParticle(@NotNull Particle particle, @NotNull Location location, int count, double offsetX, double offsetY, double offsetZ) {
+ public void spawnParticle(@NotNull Particle particle, @NotNull Location location, int count,
+ double offsetX, double offsetY, double offsetZ) {
parent.spawnParticle(particle, location, count, offsetX, offsetY, offsetZ);
}
@Override
- public void spawnParticle(@NotNull Particle particle, double v, double v1, double v2, int i, double v3, double v4, double v5) {
+ public void spawnParticle(@NotNull Particle particle, double v, double v1, double v2, int i,
+ double v3, double v4, double v5) {
parent.spawnParticle(particle, v, v1, v2, i, v3, v4, v5);
}
@Override
- public void spawnParticle(@NotNull Particle particle, @NotNull Location location, int i, double v, double v1, double v2, T t) {
+ public void spawnParticle(@NotNull Particle particle, @NotNull Location location, int i,
+ double v, double v1, double v2, T t) {
parent.spawnParticle(particle, location, i, v, v1, v2, t);
}
@Override
- public void spawnParticle(@NotNull Particle particle, double v, double v1, double v2, int i, double v3, double v4, double v5, T t) {
+ public void spawnParticle(@NotNull Particle particle, double v, double v1, double v2, int i,
+ double v3, double v4, double v5, T t) {
parent.spawnParticle(particle, v, v1, v2, i, v3, v4, v5, t);
}
@Override
- public void spawnParticle(@NotNull Particle particle, @NotNull Location location, int i, double v, double v1, double v2, double v3) {
+ public void spawnParticle(@NotNull Particle particle, @NotNull Location location, int i,
+ double v, double v1, double v2, double v3) {
parent.spawnParticle(particle, location, i, v, v1, v2, v3);
}
@Override
- public void spawnParticle(@NotNull Particle particle, double v, double v1, double v2, int i, double v3, double v4, double v5, double v6) {
+ public void spawnParticle(@NotNull Particle particle, double v, double v1, double v2, int i,
+ double v3, double v4, double v5, double v6) {
parent.spawnParticle(particle, v, v1, v2, i, v3, v4, v5, v6);
}
@Override
- public void spawnParticle(@NotNull Particle particle, @NotNull Location location, int i, double v, double v1, double v2, double v3, T t) {
+ public void spawnParticle(@NotNull Particle particle, @NotNull Location location, int i,
+ double v, double v1, double v2, double v3, T t) {
parent.spawnParticle(particle, location, i, v, v1, v2, v3, t);
}
@@ -236,7 +250,9 @@ public class AsyncWorld extends PassthroughExtent implements World {
public int getHighestBlockYAt(int x, int z) {
for (int y = getMaxHeight() - 1; y >= 0; y--) {
BlockState state = this.getBlock(x, y, z);
- if (!state.getMaterial().isAir()) return y;
+ if (!state.getMaterial().isAir()) {
+ return y;
+ }
}
return 0;
}
@@ -259,7 +275,7 @@ public class AsyncWorld extends PassthroughExtent implements World {
@Override
public int getHighestBlockYAt(int i, int i1, @NotNull HeightMap heightMap) {
- return parent.getHighestBlockYAt(i,i1, heightMap);
+ return parent.getHighestBlockYAt(i, i1, heightMap);
}
@Override
@@ -410,17 +426,20 @@ public class AsyncWorld extends PassthroughExtent implements World {
}
@Override
- public @NotNull Item dropItemNaturally(final @NotNull Location location, final @NotNull ItemStack item) {
+ public @NotNull Item dropItemNaturally(final @NotNull Location location,
+ final @NotNull ItemStack item) {
return TaskManager.IMP.sync(() -> parent.dropItemNaturally(location, item));
}
@Override
- public @NotNull Arrow spawnArrow(final @NotNull Location location, final @NotNull Vector direction, final float speed, final float spread) {
+ public @NotNull Arrow spawnArrow(final @NotNull Location location,
+ final @NotNull Vector direction, final float speed, final float spread) {
return TaskManager.IMP.sync(() -> parent.spawnArrow(location, direction, speed, spread));
}
@Override
- public @NotNull T spawnArrow(@NotNull Location location, @NotNull Vector direction, float speed, float spread, @NotNull Class clazz) {
+ public @NotNull T spawnArrow(@NotNull Location location,
+ @NotNull Vector direction, float speed, float spread, @NotNull Class clazz) {
return parent.spawnArrow(location, direction, speed, spread, clazz);
}
@@ -430,7 +449,8 @@ public class AsyncWorld extends PassthroughExtent implements World {
}
@Override
- public boolean generateTree(final @NotNull Location loc, final @NotNull TreeType type, final @NotNull BlockChangeDelegate delegate) {
+ public boolean generateTree(final @NotNull Location loc, final @NotNull TreeType type,
+ final @NotNull BlockChangeDelegate delegate) {
return TaskManager.IMP.sync(() -> parent.generateTree(loc, type, delegate));
}
@@ -466,7 +486,8 @@ public class AsyncWorld extends PassthroughExtent implements World {
}
@Override
- public @NotNull Collection getEntitiesByClass(final @NotNull Class cls) {
+ public @NotNull Collection getEntitiesByClass(
+ final @NotNull Class cls) {
return TaskManager.IMP.sync(() -> parent.getEntitiesByClass(cls));
}
@@ -481,7 +502,8 @@ public class AsyncWorld extends PassthroughExtent implements World {
}
@Override
- public @NotNull Collection getNearbyEntities(final @NotNull Location location, final double x, final double y, final double z) {
+ public @NotNull Collection getNearbyEntities(final @NotNull Location location,
+ final double x, final double y, final double z) {
return TaskManager.IMP.sync(() -> parent.getNearbyEntities(location, x, y, z));
}
@@ -576,17 +598,17 @@ public class AsyncWorld extends PassthroughExtent implements World {
}
@Override
- public boolean createExplosion(final double x, final double y, final double z, final float power, final boolean setFire, final boolean breakBlocks) {
- return TaskManager.IMP.sync(
- () ->
- parent.createExplosion(x, y, z, power, setFire, breakBlocks));
+ public boolean createExplosion(final double x, final double y, final double z,
+ final float power, final boolean setFire, final boolean breakBlocks) {
+ return TaskManager.IMP
+ .sync(() -> parent.createExplosion(x, y, z, power, setFire, breakBlocks));
}
@Override
public boolean createExplosion(double x, double y, double z, float power, boolean setFire,
boolean breakBlocks, @Nullable Entity source) {
- return TaskManager.IMP.sync(
- () -> parent.createExplosion(x, y, z, power, setFire, breakBlocks, source));
+ return TaskManager.IMP
+ .sync(() -> parent.createExplosion(x, y, z, power, setFire, breakBlocks, source));
}
@Override
@@ -641,33 +663,40 @@ public class AsyncWorld extends PassthroughExtent implements World {
}
@Override
- public @NotNull T spawn(final @NotNull Location location, final @NotNull Class clazz) throws IllegalArgumentException {
+ public @NotNull T spawn(final @NotNull Location location,
+ final @NotNull Class clazz) throws IllegalArgumentException {
return TaskManager.IMP.sync(() -> parent.spawn(location, clazz));
}
@Override
- public @NotNull T spawn(@NotNull Location location, @NotNull Class clazz, Consumer function) throws IllegalArgumentException {
+ public @NotNull T spawn(@NotNull Location location, @NotNull Class clazz,
+ Consumer function) throws IllegalArgumentException {
return TaskManager.IMP.sync(() -> parent.spawn(location, clazz, function));
}
@Override
- public @NotNull T spawn(@NotNull Location location, @NotNull Class clazz, @Nullable Consumer function, CreatureSpawnEvent.@NotNull SpawnReason reason) throws IllegalArgumentException {
+ public @NotNull T spawn(@NotNull Location location, @NotNull Class clazz,
+ @Nullable Consumer function, CreatureSpawnEvent.@NotNull SpawnReason reason)
+ throws IllegalArgumentException {
return null;
}
@Override
- public @NotNull FallingBlock spawnFallingBlock(@NotNull Location location, @NotNull MaterialData data) throws IllegalArgumentException {
+ public @NotNull FallingBlock spawnFallingBlock(@NotNull Location location,
+ @NotNull MaterialData data) throws IllegalArgumentException {
return TaskManager.IMP.sync(() -> parent.spawnFallingBlock(location, data));
}
@Override
@Deprecated
- public @NotNull FallingBlock spawnFallingBlock(@NotNull Location location, @NotNull Material material, byte data) throws IllegalArgumentException {
+ public @NotNull FallingBlock spawnFallingBlock(@NotNull Location location,
+ @NotNull Material material, byte data) throws IllegalArgumentException {
return TaskManager.IMP.sync(() -> parent.spawnFallingBlock(location, material, data));
}
@Override
- public @NotNull FallingBlock spawnFallingBlock(@NotNull Location location, @NotNull BlockData blockData) throws IllegalArgumentException {
+ public @NotNull FallingBlock spawnFallingBlock(@NotNull Location location,
+ @NotNull BlockData blockData) throws IllegalArgumentException {
return TaskManager.IMP.sync(() -> parent.spawnFallingBlock(location, blockData));
}
@@ -677,7 +706,8 @@ public class AsyncWorld extends PassthroughExtent implements World {
}
@Override
- public void playEffect(final @NotNull Location location, final @NotNull Effect effect, final int data, final int radius) {
+ public void playEffect(final @NotNull Location location, final @NotNull Effect effect,
+ final int data, final int radius) {
TaskManager.IMP.sync(new RunnableVal
*
- * @param data
- * Java object to be serialized to YAML
+ * @param data Java object to be serialized to YAML
* @return YAML String
*/
public String dumpAsMap(Object data) {
@@ -326,10 +283,9 @@ public class Yaml {
/**
* Serialize the representation tree into Events.
*
- * @see Processing Overview
- * @param data
- * representation tree
+ * @param data representation tree
* @return Event list
+ * @see Processing Overview
*/
public List serialize(Node data) {
SilentEmitter emitter = new SilentEmitter();
@@ -360,8 +316,7 @@ public class Yaml {
* Parse the only YAML document in a String and produce the corresponding
* Java object. (Because the encoding in known BOM is not respected.)
*
- * @param yaml
- * YAML data to load from (BOM must not be present)
+ * @param yaml YAML data to load from (BOM must not be present)
* @return parsed object
*/
public Object load(String yaml) {
@@ -372,8 +327,7 @@ public class Yaml {
* Parse the only YAML document in a stream and produce the corresponding
* Java object.
*
- * @param io
- * data to load from (BOM is respected and removed)
+ * @param io data to load from (BOM is respected and removed)
* @return parsed object
*/
public Object load(InputStream io) {
@@ -384,8 +338,7 @@ public class Yaml {
* Parse the only YAML document in a stream and produce the corresponding
* Java object.
*
- * @param io
- * data to load from (BOM must not be present)
+ * @param io data to load from (BOM must not be present)
* @return parsed object
*/
public Object load(Reader io) {
@@ -396,12 +349,9 @@ public class Yaml {
* Parse the only YAML document in a stream and produce the corresponding
* Java object.
*
- * @param
- * Class is defined by the second argument
- * @param io
- * data to load from (BOM must not be present)
- * @param type
- * Class of the object to be created
+ * @param Class is defined by the second argument
+ * @param io data to load from (BOM must not be present)
+ * @param type Class of the object to be created
* @return parsed object
*/
@SuppressWarnings("unchecked")
@@ -413,12 +363,9 @@ public class Yaml {
* Parse the only YAML document in a String and produce the corresponding
* Java object. (Because the encoding in known BOM is not respected.)
*
- * @param
- * Class is defined by the second argument
- * @param yaml
- * YAML data to load from (BOM must not be present)
- * @param type
- * Class of the object to be created
+ * @param Class is defined by the second argument
+ * @param yaml YAML data to load from (BOM must not be present)
+ * @param type Class of the object to be created
* @return parsed object
*/
@SuppressWarnings("unchecked")
@@ -430,12 +377,9 @@ public class Yaml {
* Parse the only YAML document in a stream and produce the corresponding
* Java object.
*
- * @param
- * Class is defined by the second argument
- * @param input
- * data to load from (BOM is respected and removed)
- * @param type
- * Class of the object to be created
+ * @param Class is defined by the second argument
+ * @param input data to load from (BOM is respected and removed)
+ * @param type Class of the object to be created
* @return parsed object
*/
@SuppressWarnings("unchecked")
@@ -453,10 +397,9 @@ public class Yaml {
* Parse all YAML documents in a String and produce corresponding Java
* objects. The documents are parsed only when the iterator is invoked.
*
- * @param yaml
- * YAML data to load from (BOM must not be present)
+ * @param yaml YAML data to load from (BOM must not be present)
* @return an iterator over the parsed Java objects in this String in proper
- * sequence
+ * sequence
*/
public Iterable loadAll(Reader yaml) {
Composer composer = new Composer(new ParserImpl(new StreamReader(yaml)), resolver);
@@ -494,10 +437,9 @@ public class Yaml {
* objects. (Because the encoding in known BOM is not respected.) The
* documents are parsed only when the iterator is invoked.
*
- * @param yaml
- * YAML data to load from (BOM must not be present)
+ * @param yaml YAML data to load from (BOM must not be present)
* @return an iterator over the parsed Java objects in this String in proper
- * sequence
+ * sequence
*/
public Iterable loadAll(String yaml) {
return loadAll(new StringReader(yaml));
@@ -507,10 +449,9 @@ public class Yaml {
* Parse all YAML documents in a stream and produce corresponding Java
* objects. The documents are parsed only when the iterator is invoked.
*
- * @param yaml
- * YAML data to load from (BOM is respected and ignored)
+ * @param yaml YAML data to load from (BOM is respected and ignored)
* @return an iterator over the parsed Java objects in this stream in proper
- * sequence
+ * sequence
*/
public Iterable loadAll(InputStream yaml) {
return loadAll(new UnicodeReader(yaml));
@@ -520,11 +461,10 @@ public class Yaml {
* Parse the first YAML document in a stream and produce the corresponding
* representation tree. (This is the opposite of the represent() method)
*
- * @see Figure 3.1. Processing
- * Overview
- * @param yaml
- * YAML document
+ * @param yaml YAML document
* @return parsed root Node for the specified YAML document
+ * @see Figure 3.1. Processing
+ * Overview
*/
public Node compose(Reader yaml) {
Composer composer = new Composer(new ParserImpl(new StreamReader(yaml)), resolver);
@@ -536,10 +476,9 @@ public class Yaml {
* Parse all YAML documents in a stream and produce corresponding
* representation trees.
*
- * @see Processing Overview
- * @param yaml
- * stream of YAML documents
+ * @param yaml stream of YAML documents
* @return parsed root Nodes for all the specified YAML documents
+ * @see Processing Overview
*/
public Iterable composeAll(Reader yaml) {
final Composer composer = new Composer(new ParserImpl(new StreamReader(yaml)), resolver);
@@ -576,13 +515,10 @@ public class Yaml {
* Add an implicit scalar detector. If an implicit scalar value matches the
* given regexp, the corresponding tag is assigned to the scalar.
*
- * @param tag
- * tag to assign to the node
- * @param regexp
- * regular expression to match against
- * @param first
- * a sequence of possible initial characters or null (which means
- * any).
+ * @param tag tag to assign to the node
+ * @param regexp regular expression to match against
+ * @param first a sequence of possible initial characters or null (which means
+ * any).
*/
public void addImplicitResolver(Tag tag, Pattern regexp, String first) {
resolver.addImplicitResolver(tag, regexp, first);
@@ -607,8 +543,7 @@ public class Yaml {
/**
* Set a meaningful name to be shown in toString()
*
- * @param name
- * human readable name
+ * @param name human readable name
*/
public void setName(String name) {
this.name = name;
@@ -617,10 +552,9 @@ public class Yaml {
/**
* Parse a YAML stream and produce parsing events.
*
- * @see Processing Overview
- * @param yaml
- * YAML document(s)
+ * @param yaml YAML document(s)
* @return parsed events
+ * @see Processing Overview
*/
public Iterable parse(Reader yaml) {
final Parser parser = new ParserImpl(new StreamReader(yaml));
diff --git a/worldedit-core/src/main/java/com/boydti/fawe/configuration/file/FileConfiguration.java b/worldedit-core/src/main/java/com/boydti/fawe/configuration/file/FileConfiguration.java
index 3f3c8ec1b..79a915b67 100644
--- a/worldedit-core/src/main/java/com/boydti/fawe/configuration/file/FileConfiguration.java
+++ b/worldedit-core/src/main/java/com/boydti/fawe/configuration/file/FileConfiguration.java
@@ -3,6 +3,7 @@ package com.boydti.fawe.configuration.file;
import com.boydti.fawe.configuration.Configuration;
import com.boydti.fawe.configuration.InvalidConfigurationException;
import com.boydti.fawe.configuration.MemoryConfiguration;
+
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
diff --git a/worldedit-core/src/main/java/com/boydti/fawe/configuration/file/YamlConfiguration.java b/worldedit-core/src/main/java/com/boydti/fawe/configuration/file/YamlConfiguration.java
index a3b6647d7..e42b2ebcd 100644
--- a/worldedit-core/src/main/java/com/boydti/fawe/configuration/file/YamlConfiguration.java
+++ b/worldedit-core/src/main/java/com/boydti/fawe/configuration/file/YamlConfiguration.java
@@ -3,16 +3,20 @@ package com.boydti.fawe.configuration.file;
import com.boydti.fawe.configuration.Configuration;
import com.boydti.fawe.configuration.ConfigurationSection;
import com.boydti.fawe.configuration.InvalidConfigurationException;
+import com.sk89q.worldedit.util.YAMLConfiguration;
+import org.yaml.snakeyaml.DumperOptions;
+import org.yaml.snakeyaml.Yaml;
+import org.yaml.snakeyaml.error.YAMLException;
+import org.yaml.snakeyaml.representer.Representer;
+
import java.io.File;
import java.io.IOException;
import java.io.Reader;
import java.nio.file.Files;
import java.nio.file.StandardCopyOption;
import java.util.Map;
-import org.yaml.snakeyaml.DumperOptions;
-import org.yaml.snakeyaml.Yaml;
-import org.yaml.snakeyaml.error.YAMLException;
-import org.yaml.snakeyaml.representer.Representer;
+
+import static org.slf4j.LoggerFactory.getLogger;
/**
* An implementation of {@link com.boydti.fawe.configuration.Configuration} which saves all files in Yaml.
@@ -27,12 +31,16 @@ public class YamlConfiguration extends FileConfiguration {
/**
* Creates a new {@link com.boydti.fawe.configuration.file.YamlConfiguration}, loading from the given file.
+ *
*
* Any errors loading the Configuration will be logged and then ignored.
* If the specified input is not a valid config, a blank config will be
* returned.
+ *
+ *
*
* The encoding used may follow the system dependent default.
+ *
*
* @param file Input file
* @return Resulting configuration
@@ -71,10 +79,12 @@ public class YamlConfiguration extends FileConfiguration {
/**
* Creates a new {@link com.boydti.fawe.configuration.file.YamlConfiguration}, loading from the given reader.
+ *
*
* Any errors loading the Configuration will be logged and then ignored.
* If the specified input is not a valid config, a blank config will be
* returned.
+ *
*
* @param reader input
* @return resulting configuration
@@ -90,8 +100,7 @@ public class YamlConfiguration extends FileConfiguration {
try {
config.load(reader);
} catch (final IOException | InvalidConfigurationException ex) {
- System.out.println("Cannot load configuration from stream");
- ex.printStackTrace();
+ getLogger(YAMLConfiguration.class).error("Cannot load configuration from stream", ex);
}
return config;
diff --git a/worldedit-core/src/main/java/com/boydti/fawe/configuration/file/YamlConfigurationOptions.java b/worldedit-core/src/main/java/com/boydti/fawe/configuration/file/YamlConfigurationOptions.java
index f1351a8fa..f84d30310 100644
--- a/worldedit-core/src/main/java/com/boydti/fawe/configuration/file/YamlConfigurationOptions.java
+++ b/worldedit-core/src/main/java/com/boydti/fawe/configuration/file/YamlConfigurationOptions.java
@@ -1,8 +1,7 @@
package com.boydti.fawe.configuration.file;
/**
- * Various settings for controlling the input and output of a {@link
- * com.boydti.fawe.configuration.file.YamlConfiguration}
+ * Various settings for controlling the input and output of a {@link YamlConfiguration}.
*/
public class YamlConfigurationOptions extends FileConfigurationOptions {
private int indent = 2;
@@ -42,8 +41,10 @@ public class YamlConfigurationOptions extends FileConfigurationOptions {
/**
* Gets how much spaces should be used to indent each line.
+ *
*
* The minimum value this may be is 2, and the maximum is 9.
+ *
*/
public class AboveVisitor extends RecursiveVisitor {
@@ -20,9 +19,9 @@ public class AboveVisitor extends RecursiveVisitor {
/**
* Create a new visitor.
*
- * @param mask the mask
+ * @param mask the mask
* @param function the function
- * @param baseY the base Y
+ * @param baseY the base Y
*/
public AboveVisitor(Mask mask, RegionFunction function, int baseY) {
this(mask, function, baseY, Integer.MAX_VALUE);
@@ -34,14 +33,9 @@ public class AboveVisitor extends RecursiveVisitor {
this.baseY = baseY;
- setDirections(
- BlockVector3.UNIT_MINUS_X,
- BlockVector3.UNIT_MINUS_Y,
- BlockVector3.UNIT_MINUS_Z,
- BlockVector3.UNIT_X,
- BlockVector3.UNIT_Y,
- BlockVector3.UNIT_Z
- );
+ setDirections(BlockVector3.UNIT_MINUS_X, BlockVector3.UNIT_MINUS_Y,
+ BlockVector3.UNIT_MINUS_Z, BlockVector3.UNIT_X, BlockVector3.UNIT_Y,
+ BlockVector3.UNIT_Z);
}
@Override
diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/visitor/DFSRecursiveVisitor.java b/worldedit-core/src/main/java/com/boydti/fawe/object/visitor/DFSRecursiveVisitor.java
index 6b9506184..6d294437e 100644
--- a/worldedit-core/src/main/java/com/boydti/fawe/object/visitor/DFSRecursiveVisitor.java
+++ b/worldedit-core/src/main/java/com/boydti/fawe/object/visitor/DFSRecursiveVisitor.java
@@ -1,11 +1,11 @@
package com.boydti.fawe.object.visitor;
-import static com.google.common.base.Preconditions.checkNotNull;
-
import com.sk89q.worldedit.function.RegionFunction;
import com.sk89q.worldedit.function.mask.Mask;
import com.sk89q.worldedit.math.BlockVector3;
+import static com.google.common.base.Preconditions.checkNotNull;
+
/**
* An implementation of an {@link com.sk89q.worldedit.function.visitor.BreadthFirstSearch} that uses
* a mask to determine where a block should be visited.
diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/visitor/DFSVisitor.java b/worldedit-core/src/main/java/com/boydti/fawe/object/visitor/DFSVisitor.java
index 32edff280..152e0ef4e 100644
--- a/worldedit-core/src/main/java/com/boydti/fawe/object/visitor/DFSVisitor.java
+++ b/worldedit-core/src/main/java/com/boydti/fawe/object/visitor/DFSVisitor.java
@@ -11,6 +11,7 @@ import com.sk89q.worldedit.util.formatting.text.Component;
import com.sk89q.worldedit.util.formatting.text.TextComponent;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
+
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.HashSet;
diff --git a/worldedit-core/src/main/java/com/boydti/fawe/regions/FaweMask.java b/worldedit-core/src/main/java/com/boydti/fawe/regions/FaweMask.java
index ed3f9d99d..e8f7ee586 100644
--- a/worldedit-core/src/main/java/com/boydti/fawe/regions/FaweMask.java
+++ b/worldedit-core/src/main/java/com/boydti/fawe/regions/FaweMask.java
@@ -1,8 +1,6 @@
package com.boydti.fawe.regions;
import com.sk89q.worldedit.entity.Player;
-import com.sk89q.worldedit.math.BlockVector3;
-import com.sk89q.worldedit.regions.CuboidRegion;
import com.sk89q.worldedit.regions.IDelegateRegion;
import com.sk89q.worldedit.regions.Region;
diff --git a/worldedit-core/src/main/java/com/boydti/fawe/util/BrushCache.java b/worldedit-core/src/main/java/com/boydti/fawe/util/BrushCache.java
index f484c043c..550c722e9 100644
--- a/worldedit-core/src/main/java/com/boydti/fawe/util/BrushCache.java
+++ b/worldedit-core/src/main/java/com/boydti/fawe/util/BrushCache.java
@@ -1,7 +1,5 @@
package com.boydti.fawe.util;
-import static org.slf4j.LoggerFactory.getLogger;
-
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.sk89q.jnbt.CompoundTag;
@@ -11,6 +9,7 @@ import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.blocks.BaseItem;
import com.sk89q.worldedit.command.tool.BrushTool;
import com.sk89q.worldedit.entity.Player;
+
import java.util.HashMap;
import java.util.Map;
import java.util.WeakHashMap;
diff --git a/worldedit-core/src/main/java/com/boydti/fawe/util/CachedTextureUtil.java b/worldedit-core/src/main/java/com/boydti/fawe/util/CachedTextureUtil.java
index 8913e4c11..252a927ea 100644
--- a/worldedit-core/src/main/java/com/boydti/fawe/util/CachedTextureUtil.java
+++ b/worldedit-core/src/main/java/com/boydti/fawe/util/CachedTextureUtil.java
@@ -2,6 +2,7 @@ package com.boydti.fawe.util;
import com.sk89q.worldedit.world.block.BlockType;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
+
import java.io.FileNotFoundException;
public class CachedTextureUtil extends DelegateTextureUtil {
diff --git a/worldedit-core/src/main/java/com/boydti/fawe/util/DelegateTextureUtil.java b/worldedit-core/src/main/java/com/boydti/fawe/util/DelegateTextureUtil.java
index 2fca05f4e..c84aa83cf 100644
--- a/worldedit-core/src/main/java/com/boydti/fawe/util/DelegateTextureUtil.java
+++ b/worldedit-core/src/main/java/com/boydti/fawe/util/DelegateTextureUtil.java
@@ -2,6 +2,7 @@ package com.boydti.fawe.util;
import com.sk89q.worldedit.world.block.BlockType;
+
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileNotFoundException;
diff --git a/worldedit-core/src/main/java/com/boydti/fawe/util/EditSessionBuilder.java b/worldedit-core/src/main/java/com/boydti/fawe/util/EditSessionBuilder.java
index 153ae6442..152ec2475 100644
--- a/worldedit-core/src/main/java/com/boydti/fawe/util/EditSessionBuilder.java
+++ b/worldedit-core/src/main/java/com/boydti/fawe/util/EditSessionBuilder.java
@@ -9,13 +9,22 @@ import com.boydti.fawe.beta.implementation.processors.LimitProcessor;
import com.boydti.fawe.beta.implementation.queue.ParallelQueueExtent;
import com.boydti.fawe.config.Settings;
import com.boydti.fawe.logging.rollback.RollbackOptimizedHistory;
-import com.boydti.fawe.object.*;
+import com.boydti.fawe.object.FaweLimit;
+import com.boydti.fawe.object.HistoryExtent;
+import com.boydti.fawe.object.NullChangeSet;
+import com.boydti.fawe.object.RegionWrapper;
+import com.boydti.fawe.object.RelightMode;
import com.boydti.fawe.object.brush.visualization.VirtualWorld;
import com.boydti.fawe.object.changeset.AbstractChangeSet;
import com.boydti.fawe.object.changeset.BlockBagChangeSet;
import com.boydti.fawe.object.changeset.DiskStorageHistory;
import com.boydti.fawe.object.changeset.MemoryOptimizedHistory;
-import com.boydti.fawe.object.extent.*;
+import com.boydti.fawe.object.extent.FaweRegionExtent;
+import com.boydti.fawe.object.extent.MultiRegionExtent;
+import com.boydti.fawe.object.extent.NullExtent;
+import com.boydti.fawe.object.extent.SingleRegionExtent;
+import com.boydti.fawe.object.extent.SlowExtent;
+import com.boydti.fawe.object.extent.StripNBTExtent;
import com.boydti.fawe.wrappers.WorldWrapper;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.WorldEdit;
@@ -30,8 +39,8 @@ import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.sk89q.worldedit.world.World;
import org.jetbrains.annotations.NotNull;
-import javax.annotation.Nullable;
import java.util.UUID;
+import javax.annotation.Nullable;
import static com.google.common.base.Preconditions.checkNotNull;
diff --git a/worldedit-core/src/main/java/com/boydti/fawe/util/ExtentTraverser.java b/worldedit-core/src/main/java/com/boydti/fawe/util/ExtentTraverser.java
index 80eb91bdb..9e4676782 100644
--- a/worldedit-core/src/main/java/com/boydti/fawe/util/ExtentTraverser.java
+++ b/worldedit-core/src/main/java/com/boydti/fawe/util/ExtentTraverser.java
@@ -2,11 +2,10 @@ package com.boydti.fawe.util;
import com.sk89q.worldedit.extent.AbstractDelegateExtent;
import com.sk89q.worldedit.extent.Extent;
+import org.jetbrains.annotations.NotNull;
import java.lang.reflect.Field;
-import org.jetbrains.annotations.NotNull;
-
public class ExtentTraverser {
private final T root;
private final ExtentTraverser parent;
diff --git a/worldedit-core/src/main/java/com/boydti/fawe/util/ImgurUtility.java b/worldedit-core/src/main/java/com/boydti/fawe/util/ImgurUtility.java
index fd79082e9..08fd7333f 100644
--- a/worldedit-core/src/main/java/com/boydti/fawe/util/ImgurUtility.java
+++ b/worldedit-core/src/main/java/com/boydti/fawe/util/ImgurUtility.java
@@ -4,7 +4,14 @@ import com.boydti.fawe.object.io.FastByteArrayOutputStream;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
-import java.io.*;
+import java.io.BufferedInputStream;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
diff --git a/worldedit-core/src/main/java/com/boydti/fawe/util/IncendoPaster.java b/worldedit-core/src/main/java/com/boydti/fawe/util/IncendoPaster.java
index 1d4cae98f..d843a0efd 100644
--- a/worldedit-core/src/main/java/com/boydti/fawe/util/IncendoPaster.java
+++ b/worldedit-core/src/main/java/com/boydti/fawe/util/IncendoPaster.java
@@ -6,14 +6,25 @@ import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.sk89q.worldedit.util.paste.Paster;
-import java.io.*;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
import java.lang.management.ManagementFactory;
import java.lang.management.RuntimeMXBean;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;
import java.nio.file.Files;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
import java.util.concurrent.Callable;
import java.util.concurrent.TimeUnit;
@@ -230,7 +241,7 @@ public final class IncendoPaster implements Paster {
b.append("OS Arch: ").append(System.getProperty("os.arch")).append('\n');
b.append("# Okay :D Great. You are now ready to create your bug report!");
b.append("\n# You can do so at https://github.com/IntellectualSites/FastAsyncWorldEdit/issues");
- b.append("\n# or via our Discord at https://discord.gg/ngZCzbU");
+ b.append("\n# or via our Discord at https://discord.gg/KxkjDVg");
incendoPaster.addFile(new IncendoPaster.PasteFile("information", b.toString()));
try {
diff --git a/worldedit-core/src/main/java/com/boydti/fawe/util/Jars.java b/worldedit-core/src/main/java/com/boydti/fawe/util/Jars.java
index 837e99ea4..260245178 100644
--- a/worldedit-core/src/main/java/com/boydti/fawe/util/Jars.java
+++ b/worldedit-core/src/main/java/com/boydti/fawe/util/Jars.java
@@ -1,7 +1,5 @@
package com.boydti.fawe.util;
-import static org.slf4j.LoggerFactory.getLogger;
-
import java.io.DataInputStream;
import java.io.IOException;
import java.net.URL;
@@ -9,6 +7,8 @@ import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Base64;
+import static org.slf4j.LoggerFactory.getLogger;
+
public enum Jars {
MM_v1_7_8(
diff --git a/worldedit-core/src/main/java/com/boydti/fawe/util/MainUtil.java b/worldedit-core/src/main/java/com/boydti/fawe/util/MainUtil.java
index fb2a8af58..90e36a915 100644
--- a/worldedit-core/src/main/java/com/boydti/fawe/util/MainUtil.java
+++ b/worldedit-core/src/main/java/com/boydti/fawe/util/MainUtil.java
@@ -2,12 +2,21 @@ package com.boydti.fawe.util;
import com.boydti.fawe.Fawe;
import com.boydti.fawe.config.Settings;
-import com.boydti.fawe.object.*;
+import com.boydti.fawe.object.FaweInputStream;
+import com.boydti.fawe.object.FaweOutputStream;
+import com.boydti.fawe.object.RegionWrapper;
+import com.boydti.fawe.object.RunnableVal;
+import com.boydti.fawe.object.RunnableVal2;
import com.boydti.fawe.object.changeset.FaweStreamChangeSet;
import com.boydti.fawe.object.io.AbstractDelegateOutputStream;
import com.github.luben.zstd.ZstdInputStream;
import com.github.luben.zstd.ZstdOutputStream;
-import com.sk89q.jnbt.*;
+import com.sk89q.jnbt.CompoundTag;
+import com.sk89q.jnbt.DoubleTag;
+import com.sk89q.jnbt.IntTag;
+import com.sk89q.jnbt.ListTag;
+import com.sk89q.jnbt.StringTag;
+import com.sk89q.jnbt.Tag;
import com.sk89q.worldedit.entity.Entity;
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat;
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats;
@@ -16,31 +25,65 @@ import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.util.formatting.text.Component;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import it.unimi.dsi.fastutil.io.FastBufferedInputStream;
-import net.jpountz.lz4.*;
+import net.jpountz.lz4.LZ4BlockInputStream;
+import net.jpountz.lz4.LZ4BlockOutputStream;
+import net.jpountz.lz4.LZ4Compressor;
+import net.jpountz.lz4.LZ4Factory;
+import net.jpountz.lz4.LZ4FastDecompressor;
+import net.jpountz.lz4.LZ4InputStream;
+import net.jpountz.lz4.LZ4Utils;
import org.jetbrains.annotations.NotNull;
-import javax.annotation.Nullable;
-import javax.imageio.ImageIO;
-import java.awt.*;
+import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
-import java.io.*;
+import java.io.BufferedOutputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
import java.lang.reflect.Array;
-import java.net.*;
+import java.net.HttpURLConnection;
+import java.net.MalformedURLException;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.net.URLConnection;
import java.nio.channels.Channels;
import java.nio.channels.FileChannel;
import java.nio.channels.ReadableByteChannel;
import java.nio.charset.StandardCharsets;
-import java.nio.file.*;
+import java.nio.file.FileVisitResult;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.SimpleFileVisitor;
+import java.nio.file.StandardCopyOption;
import java.nio.file.attribute.BasicFileAttributes;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Comparator;
import java.util.List;
-import java.util.*;
+import java.util.Map;
+import java.util.Scanner;
+import java.util.UUID;
import java.util.concurrent.ForkJoinPool;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicLong;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.regex.Pattern;
-import java.util.zip.*;
+import java.util.zip.DataFormatException;
+import java.util.zip.Deflater;
+import java.util.zip.GZIPInputStream;
+import java.util.zip.Inflater;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipInputStream;
+import javax.annotation.Nullable;
+import javax.imageio.ImageIO;
import static java.lang.System.arraycopy;
import static org.slf4j.LoggerFactory.getLogger;
diff --git a/worldedit-core/src/main/java/com/boydti/fawe/util/MemUtil.java b/worldedit-core/src/main/java/com/boydti/fawe/util/MemUtil.java
index 285572885..7cb9a5aa7 100644
--- a/worldedit-core/src/main/java/com/boydti/fawe/util/MemUtil.java
+++ b/worldedit-core/src/main/java/com/boydti/fawe/util/MemUtil.java
@@ -1,6 +1,7 @@
package com.boydti.fawe.util;
import com.boydti.fawe.config.Settings;
+
import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.atomic.AtomicBoolean;
diff --git a/worldedit-core/src/main/java/com/boydti/fawe/util/RandomTextureUtil.java b/worldedit-core/src/main/java/com/boydti/fawe/util/RandomTextureUtil.java
index c8d2ae500..d87f00310 100644
--- a/worldedit-core/src/main/java/com/boydti/fawe/util/RandomTextureUtil.java
+++ b/worldedit-core/src/main/java/com/boydti/fawe/util/RandomTextureUtil.java
@@ -1,7 +1,6 @@
package com.boydti.fawe.util;
import com.sk89q.worldedit.world.block.BlockType;
-import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import java.io.FileNotFoundException;
diff --git a/worldedit-core/src/main/java/com/boydti/fawe/util/ReflectionUtils.java b/worldedit-core/src/main/java/com/boydti/fawe/util/ReflectionUtils.java
index dfd78f0aa..71572dbcb 100644
--- a/worldedit-core/src/main/java/com/boydti/fawe/util/ReflectionUtils.java
+++ b/worldedit-core/src/main/java/com/boydti/fawe/util/ReflectionUtils.java
@@ -1,6 +1,7 @@
package com.boydti.fawe.util;
-import com.boydti.fawe.Fawe;
+import org.jetbrains.annotations.NotNull;
+
import java.lang.invoke.MethodHandles;
import java.lang.reflect.AccessibleObject;
import java.lang.reflect.Constructor;
@@ -13,8 +14,6 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
-import java.util.Map;
-import org.jetbrains.annotations.NotNull;
public class ReflectionUtils {
diff --git a/worldedit-core/src/main/java/com/boydti/fawe/util/TaskManager.java b/worldedit-core/src/main/java/com/boydti/fawe/util/TaskManager.java
index 3c7d1703a..9ab14751c 100644
--- a/worldedit-core/src/main/java/com/boydti/fawe/util/TaskManager.java
+++ b/worldedit-core/src/main/java/com/boydti/fawe/util/TaskManager.java
@@ -1,15 +1,11 @@
package com.boydti.fawe.util;
-import static org.slf4j.LoggerFactory.getLogger;
-
import com.boydti.fawe.Fawe;
import com.boydti.fawe.beta.implementation.queue.QueueHandler;
import com.boydti.fawe.config.Settings;
import com.boydti.fawe.object.RunnableVal;
-
import org.jetbrains.annotations.NotNull;
-import javax.annotation.Nullable;
import java.util.Collection;
import java.util.Iterator;
import java.util.concurrent.ExecutionException;
@@ -17,6 +13,9 @@ import java.util.concurrent.ForkJoinPool;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.Supplier;
+import javax.annotation.Nullable;
+
+import static org.slf4j.LoggerFactory.getLogger;
public abstract class TaskManager {
@@ -25,16 +24,15 @@ public abstract class TaskManager {
private final ForkJoinPool pool = new ForkJoinPool();
/**
- * Run a repeating task on the main thread
+ * Run a repeating task on the main thread.
*
- * @param runnable
+ * @param runnable the task to run
* @param interval in ticks
- * @return
*/
public abstract int repeat(@NotNull final Runnable runnable, final int interval);
/**
- * Run a repeating task asynchronously
+ * Run a repeating task asynchronously.
*
* @param runnable the task to run
* @param interval in ticks
@@ -43,34 +41,31 @@ public abstract class TaskManager {
public abstract int repeatAsync(@NotNull final Runnable runnable, final int interval);
/**
- * Run a task asynchronously
+ * Run a task asynchronously.
*
* @param runnable the task to run
*/
public abstract void async(@NotNull final Runnable runnable);
/**
- * Run a task on the main thread
+ * Run a task on the main thread.
*
* @param runnable the task to run
*/
public abstract void task(@NotNull final Runnable runnable);
/**
- * Get the public ForkJoinPool
+ * Get the public ForkJoinPool.
* - ONLY SUBMIT SHORT LIVED TASKS
* - DO NOT USE SLEEP/WAIT/LOCKS IN ANY SUBMITTED TASKS
*
- * @return
*/
public ForkJoinPool getPublicForkJoinPool() {
return pool;
}
/**
- * Run a bunch of tasks in parallel using the shared thread pool
- *
- * @param runnables
+ * Run a bunch of tasks in parallel using the shared thread pool.
*/
public void parallel(Collection runnables) {
for (Runnable run : runnables) {
@@ -80,7 +75,7 @@ public abstract class TaskManager {
}
/**
- * Run a bunch of tasks in parallel
+ * Run a bunch of tasks in parallel.
*
* @param runnables the tasks to run
* @param numThreads number of threads (null = config.yml parallel threads)
@@ -136,9 +131,7 @@ public abstract class TaskManager {
}
/**
- * Disable async catching for a specific task
- *
- * @param run
+ * Disable async catching for a specific task.
*/
public void runUnsafe(Runnable run) {
QueueHandler queue = Fawe.get().getQueueHandler();
@@ -152,7 +145,7 @@ public abstract class TaskManager {
}
/**
- * Run a task on the current thread or asynchronously
+ * Run a task on the current thread or asynchronously.
* - If it's already the main thread, it will just call run()
*
* @param runnable the task to run
@@ -167,7 +160,7 @@ public abstract class TaskManager {
}
/**
- * Run a task as soon as possible on the main thread
+ * Run a task as soon as possible on the main thread.
* - Non blocking if not calling from the main thread
*
* @param runnable the task to run
@@ -181,7 +174,7 @@ public abstract class TaskManager {
}
/**
- * Run a task as soon as possible not on the main thread
+ * Run a task as soon as possible not on the main thread.
*
* @param runnable the task to run
* @see Fawe#isMainThread()
@@ -191,9 +184,9 @@ public abstract class TaskManager {
}
/**
- * Run a task on the main thread at the next tick or now async
+ * Run a task on the main thread at the next tick or now async.
*
- * @param runnable the task to run.
+ * @param runnable the task to run.
* @param async whether the task should run on the main thread
*/
public void taskSoonMain(@NotNull final Runnable runnable, boolean async) {
@@ -206,7 +199,7 @@ public abstract class TaskManager {
/**
- * Run a task later on the main thread
+ * Run a task later on the main thread.
*
* @param runnable the task to run
* @param delay in ticks
@@ -214,7 +207,7 @@ public abstract class TaskManager {
public abstract void later(@NotNull final Runnable runnable, final int delay);
/**
- * Run a task later asynchronously
+ * Run a task later asynchronously.
*
* @param runnable the task to run
* @param delay in ticks
@@ -222,7 +215,7 @@ public abstract class TaskManager {
public abstract void laterAsync(@NotNull final Runnable runnable, final int delay);
/**
- * Cancel a task
+ * Cancel a task.
*
* @param task the id of the task to cancel
*/
@@ -289,12 +282,9 @@ public abstract class TaskManager {
}
/**
- * Run a task on the main thread when the TPS is high enough, and wait for execution to finish:
+ * Run a task on the main thread when the TPS is high enough, and wait for execution to finish.
* - Useful if you need to access something from the Bukkit API from another thread
* - Usually wait time is around 25ms
- *
- * @param function
- * @return
*/
public T syncWhenFree(@NotNull final RunnableVal function) {
if (Fawe.isMainThread()) {
@@ -309,7 +299,7 @@ public abstract class TaskManager {
}
/**
- * Run a task on the main thread when the TPS is high enough, and wait for execution to finish:
+ * Run a task on the main thread when the TPS is high enough, and wait for execution to finish.
* - Useful if you need to access something from the Bukkit API from another thread
* - Usually wait time is around 25ms
*/
@@ -325,24 +315,18 @@ public abstract class TaskManager {
}
/**
- * Quickly run a task on the main thread, and wait for execution to finish:
+ * Quickly run a task on the main thread, and wait for execution to finish.
* - Useful if you need to access something from the Bukkit API from another thread
- * - Usually wait time is around 25ms
- *
- * @param function
- * @return
+ * - Usually wait time is around 25ms
*/
public T sync(@NotNull final RunnableVal function) {
return sync((Supplier) function);
}
/**
- * Quickly run a task on the main thread, and wait for execution to finish:
+ * Quickly run a task on the main thread, and wait for execution to finish.
* - Useful if you need to access something from the Bukkit API from another thread
* - Usually wait time is around 25ms
- *
- * @param function
- * @return
*/
public T sync(final Supplier function) {
if (Fawe.isMainThread()) {
diff --git a/worldedit-core/src/main/java/com/boydti/fawe/util/TextureUtil.java b/worldedit-core/src/main/java/com/boydti/fawe/util/TextureUtil.java
index c92afc2f8..877bc3a43 100644
--- a/worldedit-core/src/main/java/com/boydti/fawe/util/TextureUtil.java
+++ b/worldedit-core/src/main/java/com/boydti/fawe/util/TextureUtil.java
@@ -1,7 +1,5 @@
package com.boydti.fawe.util;
-import static org.slf4j.LoggerFactory.getLogger;
-
import com.boydti.fawe.Fawe;
import com.boydti.fawe.beta.implementation.filter.block.SingleFilterBlock;
import com.boydti.fawe.config.Settings;
@@ -9,7 +7,6 @@ import com.boydti.fawe.util.image.ImageUtil;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.google.gson.stream.JsonReader;
-import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.extent.clipboard.Clipboard;
import com.sk89q.worldedit.function.mask.Mask;
import com.sk89q.worldedit.math.BlockVector3;
@@ -21,6 +18,7 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import it.unimi.dsi.fastutil.ints.IntArraySet;
import it.unimi.dsi.fastutil.longs.LongArrayList;
+
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileNotFoundException;
@@ -45,6 +43,8 @@ import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import javax.imageio.ImageIO;
+import static org.slf4j.LoggerFactory.getLogger;
+
// TODO FIXME
public class TextureUtil implements TextureHolder {
diff --git a/worldedit-core/src/main/java/com/boydti/fawe/util/WEManager.java b/worldedit-core/src/main/java/com/boydti/fawe/util/WEManager.java
index 3512829bc..10f821331 100644
--- a/worldedit-core/src/main/java/com/boydti/fawe/util/WEManager.java
+++ b/worldedit-core/src/main/java/com/boydti/fawe/util/WEManager.java
@@ -8,20 +8,19 @@ import com.boydti.fawe.regions.FaweMask;
import com.boydti.fawe.regions.FaweMaskManager;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.entity.Player;
-import com.sk89q.worldedit.extension.platform.PlatformCommandManager;
import com.sk89q.worldedit.extent.AbstractDelegateExtent;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.util.formatting.text.TextComponent;
-import java.lang.reflect.Field;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import java.util.ArrayDeque;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
public class WEManager {
diff --git a/worldedit-core/src/main/java/com/boydti/fawe/util/image/ImageUtil.java b/worldedit-core/src/main/java/com/boydti/fawe/util/image/ImageUtil.java
index 2a07dff0b..0a67f42cf 100644
--- a/worldedit-core/src/main/java/com/boydti/fawe/util/image/ImageUtil.java
+++ b/worldedit-core/src/main/java/com/boydti/fawe/util/image/ImageUtil.java
@@ -7,7 +7,6 @@ import com.boydti.fawe.util.MathMan;
import com.sk89q.worldedit.extension.input.InputParseException;
import com.sk89q.worldedit.extension.platform.binding.ProvideBindings;
-import javax.annotation.Nullable;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.Transparency;
@@ -20,6 +19,7 @@ import java.io.InputStream;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
+import javax.annotation.Nullable;
public class ImageUtil {
diff --git a/worldedit-core/src/main/java/com/boydti/fawe/web/SchemSync.java b/worldedit-core/src/main/java/com/boydti/fawe/web/SchemSync.java
index b721ee2b3..e4e35b203 100644
--- a/worldedit-core/src/main/java/com/boydti/fawe/web/SchemSync.java
+++ b/worldedit-core/src/main/java/com/boydti/fawe/web/SchemSync.java
@@ -8,6 +8,7 @@ import com.boydti.fawe.util.MainUtil;
import com.sk89q.worldedit.LocalConfiguration;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.command.UtilityCommands;
+
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.File;
diff --git a/worldedit-core/src/main/java/com/boydti/fawe/wrappers/LocationMaskedPlayerWrapper.java b/worldedit-core/src/main/java/com/boydti/fawe/wrappers/LocationMaskedPlayerWrapper.java
index b33f4558a..5b3a2e41a 100644
--- a/worldedit-core/src/main/java/com/boydti/fawe/wrappers/LocationMaskedPlayerWrapper.java
+++ b/worldedit-core/src/main/java/com/boydti/fawe/wrappers/LocationMaskedPlayerWrapper.java
@@ -1,17 +1,8 @@
package com.boydti.fawe.wrappers;
-import com.boydti.fawe.Fawe;
-import com.boydti.fawe.object.RunnableVal;
-import com.boydti.fawe.util.EditSessionBuilder;
-import com.boydti.fawe.util.TaskManager;
-import com.sk89q.worldedit.EditSession;
-import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.entity.Player;
-import com.sk89q.worldedit.extent.Extent;
-import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.Vector3;
import com.sk89q.worldedit.util.Location;
-import com.sk89q.worldedit.world.block.BlockTypes;
public class LocationMaskedPlayerWrapper extends AsyncPlayer {
private final boolean allowTeleport;
@@ -129,4 +120,4 @@ public class LocationMaskedPlayerWrapper extends AsyncPlayer {
update();
}
}
-}
\ No newline at end of file
+}
diff --git a/worldedit-core/src/main/java/com/boydti/fawe/wrappers/WorldWrapper.java b/worldedit-core/src/main/java/com/boydti/fawe/wrappers/WorldWrapper.java
index 812b440dc..bd10a23f6 100644
--- a/worldedit-core/src/main/java/com/boydti/fawe/wrappers/WorldWrapper.java
+++ b/worldedit-core/src/main/java/com/boydti/fawe/wrappers/WorldWrapper.java
@@ -5,7 +5,6 @@ import com.boydti.fawe.beta.implementation.packet.ChunkPacket;
import com.boydti.fawe.object.RunnableVal;
import com.boydti.fawe.util.ExtentTraverser;
import com.boydti.fawe.util.TaskManager;
-
import com.sk89q.jnbt.CompoundTag;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.MaxChangedBlocksException;
@@ -24,7 +23,11 @@ import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.Vector3;
import com.sk89q.worldedit.regions.Region;
-import com.sk89q.worldedit.util.*;
+import com.sk89q.worldedit.util.Direction;
+import com.sk89q.worldedit.util.Location;
+import com.sk89q.worldedit.util.SideEffect;
+import com.sk89q.worldedit.util.SideEffectSet;
+import com.sk89q.worldedit.util.TreeGenerator;
import com.sk89q.worldedit.world.AbstractWorld;
import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.biome.BiomeType;
@@ -34,9 +37,9 @@ import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.weather.WeatherType;
-import javax.annotation.Nullable;
import java.util.List;
import java.util.Set;
+import javax.annotation.Nullable;
public class WorldWrapper extends AbstractWorld {
diff --git a/worldedit-core/src/main/java/com/sk89q/jnbt/CompoundTag.java b/worldedit-core/src/main/java/com/sk89q/jnbt/CompoundTag.java
index faa23c1df..8e81e8862 100644
--- a/worldedit-core/src/main/java/com/sk89q/jnbt/CompoundTag.java
+++ b/worldedit-core/src/main/java/com/sk89q/jnbt/CompoundTag.java
@@ -22,6 +22,7 @@ package com.sk89q.jnbt;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.math.Vector3;
import com.sk89q.worldedit.util.Location;
+
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
diff --git a/worldedit-core/src/main/java/com/sk89q/jnbt/CompoundTagBuilder.java b/worldedit-core/src/main/java/com/sk89q/jnbt/CompoundTagBuilder.java
index 6b5776619..7a8e95b7d 100644
--- a/worldedit-core/src/main/java/com/sk89q/jnbt/CompoundTagBuilder.java
+++ b/worldedit-core/src/main/java/com/sk89q/jnbt/CompoundTagBuilder.java
@@ -19,11 +19,11 @@
package com.sk89q.jnbt;
-import static com.google.common.base.Preconditions.checkNotNull;
-
import java.util.HashMap;
import java.util.Map;
+import static com.google.common.base.Preconditions.checkNotNull;
+
/**
* Helps create compound tags.
*/
diff --git a/worldedit-core/src/main/java/com/sk89q/jnbt/CompressedCompoundTag.java b/worldedit-core/src/main/java/com/sk89q/jnbt/CompressedCompoundTag.java
index 0ef0aa680..3a661b437 100644
--- a/worldedit-core/src/main/java/com/sk89q/jnbt/CompressedCompoundTag.java
+++ b/worldedit-core/src/main/java/com/sk89q/jnbt/CompressedCompoundTag.java
@@ -1,9 +1,10 @@
package com.sk89q.jnbt;
+import net.jpountz.lz4.LZ4BlockInputStream;
+
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
-import net.jpountz.lz4.LZ4BlockInputStream;
public abstract class CompressedCompoundTag extends CompoundTag {
private T in;
diff --git a/worldedit-core/src/main/java/com/sk89q/jnbt/DoubleTag.java b/worldedit-core/src/main/java/com/sk89q/jnbt/DoubleTag.java
index f18d648b7..1a4bd9399 100644
--- a/worldedit-core/src/main/java/com/sk89q/jnbt/DoubleTag.java
+++ b/worldedit-core/src/main/java/com/sk89q/jnbt/DoubleTag.java
@@ -21,7 +21,6 @@ package com.sk89q.jnbt;
/**
* The {@code TAG_Double} tag.
- *
*/
public final class DoubleTag extends NumberTag {
@Override
diff --git a/worldedit-core/src/main/java/com/sk89q/jnbt/ListTag.java b/worldedit-core/src/main/java/com/sk89q/jnbt/ListTag.java
index ed309870a..17c471ade 100644
--- a/worldedit-core/src/main/java/com/sk89q/jnbt/ListTag.java
+++ b/worldedit-core/src/main/java/com/sk89q/jnbt/ListTag.java
@@ -19,14 +19,13 @@
package com.sk89q.jnbt;
-import static com.google.common.base.Preconditions.checkNotNull;
-
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
-
import javax.annotation.Nullable;
+import static com.google.common.base.Preconditions.checkNotNull;
+
/**
* The {@code TAG_List} tag.
*/
@@ -79,7 +78,7 @@ public final class ListTag extends Tag {
/**
* Get the tag if it exists at the given index.
- *
+ *
* @param index the index
* @return the tag or null
*/
@@ -424,7 +423,7 @@ public final class ListTag extends Tag {
@Override
public ArrayList toRaw() {
- ArrayList raw = new ArrayList<>();
+ ArrayList raw = new ArrayList<>();
if (this.value.isEmpty()) {
return raw;
}
diff --git a/worldedit-core/src/main/java/com/sk89q/jnbt/ListTagBuilder.java b/worldedit-core/src/main/java/com/sk89q/jnbt/ListTagBuilder.java
index ab2b41399..42dfa5017 100644
--- a/worldedit-core/src/main/java/com/sk89q/jnbt/ListTagBuilder.java
+++ b/worldedit-core/src/main/java/com/sk89q/jnbt/ListTagBuilder.java
@@ -19,13 +19,13 @@
package com.sk89q.jnbt;
-import static com.google.common.base.Preconditions.checkNotNull;
-
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
+import static com.google.common.base.Preconditions.checkNotNull;
+
/**
* Helps create list tags.
*/
diff --git a/worldedit-core/src/main/java/com/sk89q/jnbt/LongTag.java b/worldedit-core/src/main/java/com/sk89q/jnbt/LongTag.java
index bf4911a9c..4525cd719 100644
--- a/worldedit-core/src/main/java/com/sk89q/jnbt/LongTag.java
+++ b/worldedit-core/src/main/java/com/sk89q/jnbt/LongTag.java
@@ -21,7 +21,6 @@ package com.sk89q.jnbt;
/**
* The {@code TAG_Long} tag.
- *
*/
public final class LongTag extends NumberTag {
@Override
diff --git a/worldedit-core/src/main/java/com/sk89q/jnbt/NBTConstants.java b/worldedit-core/src/main/java/com/sk89q/jnbt/NBTConstants.java
index c73ab5184..50b4d6263 100644
--- a/worldedit-core/src/main/java/com/sk89q/jnbt/NBTConstants.java
+++ b/worldedit-core/src/main/java/com/sk89q/jnbt/NBTConstants.java
@@ -29,10 +29,19 @@ public final class NBTConstants {
public static final Charset CHARSET = StandardCharsets.UTF_8;
- public static final int TYPE_END = 0, TYPE_BYTE = 1, TYPE_SHORT = 2,
- TYPE_INT = 3, TYPE_LONG = 4, TYPE_FLOAT = 5, TYPE_DOUBLE = 6,
- TYPE_BYTE_ARRAY = 7, TYPE_STRING = 8, TYPE_LIST = 9,
- TYPE_COMPOUND = 10, TYPE_INT_ARRAY = 11, TYPE_LONG_ARRAY = 12;
+ public static final int TYPE_END = 0;
+ public static final int TYPE_BYTE = 1;
+ public static final int TYPE_SHORT = 2;
+ public static final int TYPE_INT = 3;
+ public static final int TYPE_LONG = 4;
+ public static final int TYPE_FLOAT = 5;
+ public static final int TYPE_DOUBLE = 6;
+ public static final int TYPE_BYTE_ARRAY = 7;
+ public static final int TYPE_STRING = 8;
+ public static final int TYPE_LIST = 9;
+ public static final int TYPE_COMPOUND = 10;
+ public static final int TYPE_INT_ARRAY = 11;
+ public static final int TYPE_LONG_ARRAY = 12;
/**
* Default private constructor.
@@ -40,44 +49,44 @@ public final class NBTConstants {
private NBTConstants() {
}
-
+
/**
* Convert a type ID to its corresponding {@link Tag} class.
- *
+ *
* @param id type ID
* @return tag class
* @throws IllegalArgumentException thrown if the tag ID is not valid
*/
public static Class extends Tag> getClassFromType(int id) {
switch (id) {
- case TYPE_END:
- return EndTag.class;
- case TYPE_BYTE:
- return ByteTag.class;
- case TYPE_SHORT:
- return ShortTag.class;
- case TYPE_INT:
- return IntTag.class;
- case TYPE_LONG:
- return LongTag.class;
- case TYPE_FLOAT:
- return FloatTag.class;
- case TYPE_DOUBLE:
- return DoubleTag.class;
- case TYPE_BYTE_ARRAY:
- return ByteArrayTag.class;
- case TYPE_STRING:
- return StringTag.class;
- case TYPE_LIST:
- return ListTag.class;
- case TYPE_COMPOUND:
- return CompoundTag.class;
- case TYPE_INT_ARRAY:
- return IntArrayTag.class;
- case TYPE_LONG_ARRAY:
- return LongArrayTag.class;
- default:
- throw new IllegalArgumentException("Unknown tag type ID of " + id);
+ case TYPE_END:
+ return EndTag.class;
+ case TYPE_BYTE:
+ return ByteTag.class;
+ case TYPE_SHORT:
+ return ShortTag.class;
+ case TYPE_INT:
+ return IntTag.class;
+ case TYPE_LONG:
+ return LongTag.class;
+ case TYPE_FLOAT:
+ return FloatTag.class;
+ case TYPE_DOUBLE:
+ return DoubleTag.class;
+ case TYPE_BYTE_ARRAY:
+ return ByteArrayTag.class;
+ case TYPE_STRING:
+ return StringTag.class;
+ case TYPE_LIST:
+ return ListTag.class;
+ case TYPE_COMPOUND:
+ return CompoundTag.class;
+ case TYPE_INT_ARRAY:
+ return IntArrayTag.class;
+ case TYPE_LONG_ARRAY:
+ return LongArrayTag.class;
+ default:
+ throw new IllegalArgumentException("Unknown tag type ID of " + id);
}
}
diff --git a/worldedit-core/src/main/java/com/sk89q/jnbt/NBTInputStream.java b/worldedit-core/src/main/java/com/sk89q/jnbt/NBTInputStream.java
index 5418eca52..94334259f 100644
--- a/worldedit-core/src/main/java/com/sk89q/jnbt/NBTInputStream.java
+++ b/worldedit-core/src/main/java/com/sk89q/jnbt/NBTInputStream.java
@@ -36,10 +36,12 @@ import java.util.Map;
* This class reads NBT, or Named Binary Tag
* streams, and produces an object graph of subclasses of the {@code Tag}
* object.
- *
- *
*/
public final class NBTInputStream implements Closeable {
@@ -48,7 +50,7 @@ public final class NBTInputStream implements Closeable {
/**
* Creates a new {@code NBTInputStream}, which will source its data
* from the specified input stream.
- *
+ *
* @param is the input stream
*/
public NBTInputStream(InputStream is) {
@@ -61,7 +63,7 @@ public final class NBTInputStream implements Closeable {
/**
* Reads an NBT tag from the stream.
- *
+ *
* @return The tag that was read.
* @throws IOException if an I/O error occurs.
*/
@@ -89,7 +91,9 @@ public final class NBTInputStream implements Closeable {
public void readNamedTagLazy(StreamDelegate scope) throws IOException {
try {
int type = is.readByte();
- if (type == NBTConstants.TYPE_END) return;
+ if (type == NBTConstants.TYPE_END) {
+ return;
+ }
StreamDelegate child = scope.get(is);
if (child != null) {
@@ -540,7 +544,7 @@ public final class NBTInputStream implements Closeable {
case NBTConstants.TYPE_END:
if (depth == 0) {
throw new IOException(
- "TAG_End found without a TAG_Compound/TAG_List tag preceding it.");
+ "TAG_End found without a TAG_Compound/TAG_List tag preceding it.");
} else {
return new EndTag();
}
@@ -569,6 +573,7 @@ public final class NBTInputStream implements Closeable {
case NBTConstants.TYPE_LIST:
int childType = is.readByte();
length = is.readInt();
+
List tagList = new ArrayList<>();
for (int i = 0; i < length; ++i) {
Tag tag = readTagPayload(childType, depth + 1);
@@ -590,6 +595,7 @@ public final class NBTInputStream implements Closeable {
tagMap.put(namedTag.getName(), tag);
}
}
+
return new CompoundTag(tagMap);
case NBTConstants.TYPE_INT_ARRAY:
length = is.readInt();
diff --git a/worldedit-core/src/main/java/com/sk89q/jnbt/NBTOutputStream.java b/worldedit-core/src/main/java/com/sk89q/jnbt/NBTOutputStream.java
index 99b0acdf0..9a79de34c 100644
--- a/worldedit-core/src/main/java/com/sk89q/jnbt/NBTOutputStream.java
+++ b/worldedit-core/src/main/java/com/sk89q/jnbt/NBTOutputStream.java
@@ -21,8 +21,6 @@ package com.sk89q.jnbt;
import com.boydti.fawe.object.io.LittleEndianOutputStream;
-import static com.google.common.base.Preconditions.checkNotNull;
-
import java.io.Closeable;
import java.io.DataOutput;
import java.io.DataOutputStream;
@@ -32,13 +30,17 @@ import java.io.OutputStream;
import java.util.List;
import java.util.Map;
+import static com.google.common.base.Preconditions.checkNotNull;
+
/**
* This class writes NBT, or Named Binary Tag
* {@code Tag} objects to an underlying {@code OutputStream}.
*
- *
*/
public final class NBTOutputStream extends OutputStream implements Closeable, DataOutput {
@@ -167,12 +169,12 @@ public final class NBTOutputStream extends OutputStream implements Closeable, Da
}
public void writeNamedTagName(String name, int type) throws IOException {
-// byte[] nameBytes = name.getBytes(NBTConstants.CHARSET);
+ // byte[] nameBytes = name.getBytes(NBTConstants.CHARSET);
os.writeByte(type);
os.writeUTF(name);
-// os.writeShort(nameBytes.length);
-// os.write(nameBytes);
+ // os.writeShort(nameBytes.length);
+ // os.write(nameBytes);
}
public void writeLazyCompoundTag(String name, LazyWrite next) throws IOException {
diff --git a/worldedit-core/src/main/java/com/sk89q/jnbt/NBTUtils.java b/worldedit-core/src/main/java/com/sk89q/jnbt/NBTUtils.java
index 1941d9508..cb765d2d7 100644
--- a/worldedit-core/src/main/java/com/sk89q/jnbt/NBTUtils.java
+++ b/worldedit-core/src/main/java/com/sk89q/jnbt/NBTUtils.java
@@ -19,13 +19,13 @@
package com.sk89q.jnbt;
-import static com.google.common.base.Preconditions.checkNotNull;
-
import com.sk89q.worldedit.math.Vector3;
import com.sk89q.worldedit.world.storage.InvalidFormatException;
import java.util.Map;
+import static com.google.common.base.Preconditions.checkNotNull;
+
/**
* A class which contains NBT-related utility methods.
*
@@ -126,34 +126,34 @@ public final class NBTUtils {
*/
public static Class extends Tag> getTypeClass(int type) {
switch (type) {
- case NBTConstants.TYPE_END:
- return EndTag.class;
- case NBTConstants.TYPE_BYTE:
- return ByteTag.class;
- case NBTConstants.TYPE_SHORT:
- return ShortTag.class;
- case NBTConstants.TYPE_INT:
- return IntTag.class;
- case NBTConstants.TYPE_LONG:
- return LongTag.class;
- case NBTConstants.TYPE_FLOAT:
- return FloatTag.class;
- case NBTConstants.TYPE_DOUBLE:
- return DoubleTag.class;
- case NBTConstants.TYPE_BYTE_ARRAY:
- return ByteArrayTag.class;
- case NBTConstants.TYPE_STRING:
- return StringTag.class;
- case NBTConstants.TYPE_LIST:
- return ListTag.class;
- case NBTConstants.TYPE_COMPOUND:
- return CompoundTag.class;
- case NBTConstants.TYPE_INT_ARRAY:
- return IntArrayTag.class;
- case NBTConstants.TYPE_LONG_ARRAY:
- return LongArrayTag.class;
- default:
- throw new IllegalArgumentException("Invalid tag type : " + type
+ case NBTConstants.TYPE_END:
+ return EndTag.class;
+ case NBTConstants.TYPE_BYTE:
+ return ByteTag.class;
+ case NBTConstants.TYPE_SHORT:
+ return ShortTag.class;
+ case NBTConstants.TYPE_INT:
+ return IntTag.class;
+ case NBTConstants.TYPE_LONG:
+ return LongTag.class;
+ case NBTConstants.TYPE_FLOAT:
+ return FloatTag.class;
+ case NBTConstants.TYPE_DOUBLE:
+ return DoubleTag.class;
+ case NBTConstants.TYPE_BYTE_ARRAY:
+ return ByteArrayTag.class;
+ case NBTConstants.TYPE_STRING:
+ return StringTag.class;
+ case NBTConstants.TYPE_LIST:
+ return ListTag.class;
+ case NBTConstants.TYPE_COMPOUND:
+ return CompoundTag.class;
+ case NBTConstants.TYPE_INT_ARRAY:
+ return IntArrayTag.class;
+ case NBTConstants.TYPE_LONG_ARRAY:
+ return LongArrayTag.class;
+ default:
+ throw new IllegalArgumentException("Invalid tag type : " + type
+ ".");
}
}
@@ -179,7 +179,7 @@ public final class NBTUtils {
* @param key the key to look for
* @param expected the expected NBT class type
* @return child tag
- * @throws InvalidFormatException
+ * @throws InvalidFormatException if the format of the items is invalid
*/
public static T getChildTag(Map items, String key, Class expected) throws InvalidFormatException {
if (!items.containsKey(key)) {
diff --git a/worldedit-core/src/main/java/com/sk89q/minecraft/util/commands/CommandException.java b/worldedit-core/src/main/java/com/sk89q/minecraft/util/commands/CommandException.java
index 4345793d1..d5ba775a0 100644
--- a/worldedit-core/src/main/java/com/sk89q/minecraft/util/commands/CommandException.java
+++ b/worldedit-core/src/main/java/com/sk89q/minecraft/util/commands/CommandException.java
@@ -19,14 +19,13 @@
package com.sk89q.minecraft.util.commands;
-import static com.google.common.base.Preconditions.checkNotNull;
-
import java.util.ArrayList;
import java.util.List;
import java.util.ListIterator;
-
import javax.annotation.Nullable;
+import static com.google.common.base.Preconditions.checkNotNull;
+
public class CommandException extends Exception {
private List commandStack = new ArrayList<>();
diff --git a/worldedit-core/src/main/java/com/sk89q/util/StringUtil.java b/worldedit-core/src/main/java/com/sk89q/util/StringUtil.java
index 8231d3aa8..8353db02e 100644
--- a/worldedit-core/src/main/java/com/sk89q/util/StringUtil.java
+++ b/worldedit-core/src/main/java/com/sk89q/util/StringUtil.java
@@ -149,7 +149,7 @@ public final class StringUtil {
* @param initialIndex the initial index to start form
* @return a new string
*/
- public static String joinString(Collection> str, String delimiter,int initialIndex) {
+ public static String joinString(Collection> str, String delimiter, int initialIndex) {
if (str.isEmpty()) {
return "";
}
@@ -310,8 +310,9 @@ public final class StringUtil {
return parseListInQuotes(input, delimiter, quoteOpen, quoteClose, false);
}
- public static List parseListInQuotes(String[] input, char delimiter, char quoteOpen, char quoteClose, boolean appendLeftover) {
- List parsableBlocks = new ArrayList<>();
+ public static List parseListInQuotes(String[] input, char delimiter, char quoteOpen,
+ char quoteClose, boolean appendLeftover) {
+ List parsableBlocks = new ArrayList<>();
StringBuilder buffer = new StringBuilder();
for (String split : input) {
if (split.indexOf(quoteOpen) != -1 && split.indexOf(quoteClose) == -1) {
diff --git a/worldedit-core/src/main/java/com/sk89q/util/yaml/YAMLNode.java b/worldedit-core/src/main/java/com/sk89q/util/yaml/YAMLNode.java
index cca293ddf..d2527bdbf 100644
--- a/worldedit-core/src/main/java/com/sk89q/util/yaml/YAMLNode.java
+++ b/worldedit-core/src/main/java/com/sk89q/util/yaml/YAMLNode.java
@@ -28,7 +28,6 @@ import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
-
import javax.annotation.Nullable;
/**
@@ -62,7 +61,7 @@ public class YAMLNode {
/**
* Gets a property at a location. This will either return an Object
- * or null, with null meaning no configuration value exists at
+ * or null, with null meaning that no configuration value exists at
* that location. This could potentially return a default value (not yet
* implemented) as defined by a plugin, if this is a plugin-tied
* configuration.
@@ -274,7 +273,9 @@ public class YAMLNode {
public Vector3 getVector(String path, Vector3 def) {
Vector3 v = getVector(path);
if (v == null) {
- if (writeDefaults) setProperty(path, def);
+ if (writeDefaults) {
+ setProperty(path, def);
+ }
return def;
}
return v;
@@ -292,7 +293,9 @@ public class YAMLNode {
public String getString(String path, String def) {
String o = getString(path);
if (o == null) {
- if (writeDefaults) setProperty(path, def);
+ if (writeDefaults) {
+ setProperty(path, def);
+ }
return def;
}
return o;
@@ -329,7 +332,9 @@ public class YAMLNode {
public int getInt(String path, int def) {
Integer o = castInt(getProperty(path));
if (o == null) {
- if (writeDefaults) setProperty(path, def);
+ if (writeDefaults) {
+ setProperty(path, def);
+ }
return def;
} else {
return o;
@@ -367,7 +372,9 @@ public class YAMLNode {
public double getDouble(String path, double def) {
Double o = castDouble(getProperty(path));
if (o == null) {
- if (writeDefaults) setProperty(path, def);
+ if (writeDefaults) {
+ setProperty(path, def);
+ }
return def;
} else {
return o;
@@ -403,7 +410,9 @@ public class YAMLNode {
public boolean getBoolean(String path, boolean def) {
Boolean o = castBoolean(getProperty(path));
if (o == null) {
- if (writeDefaults) setProperty(path, def);
+ if (writeDefaults) {
+ setProperty(path, def);
+ }
return def;
} else {
return o;
@@ -419,7 +428,9 @@ public class YAMLNode {
*/
@SuppressWarnings("unchecked")
public List getKeys(String path) {
- if (path == null) return new ArrayList<>(root.keySet());
+ if (path == null) {
+ return new ArrayList<>(root.keySet());
+ }
Object o = getProperty(path);
if (o == null) {
return null;
@@ -464,7 +475,9 @@ public class YAMLNode {
public List getStringList(String path, List def) {
List raw = getList(path);
if (raw == null) {
- if (writeDefaults && def != null) setProperty(path, def);
+ if (writeDefaults && def != null) {
+ setProperty(path, def);
+ }
return def != null ? def : new ArrayList<>();
}
@@ -494,7 +507,9 @@ public class YAMLNode {
public List getIntList(String path, List def) {
List raw = getList(path);
if (raw == null) {
- if (writeDefaults && def != null) setProperty(path, def);
+ if (writeDefaults && def != null) {
+ setProperty(path, def);
+ }
return def != null ? def : new ArrayList<>();
}
@@ -523,7 +538,9 @@ public class YAMLNode {
public List getDoubleList(String path, List def) {
List raw = getList(path);
if (raw == null) {
- if (writeDefaults && def != null) setProperty(path, def);
+ if (writeDefaults && def != null) {
+ setProperty(path, def);
+ }
return def != null ? def : new ArrayList<>();
}
@@ -552,7 +569,9 @@ public class YAMLNode {
public List getBooleanList(String path, List def) {
List raw = getList(path);
if (raw == null) {
- if (writeDefaults && def != null) setProperty(path, def);
+ if (writeDefaults && def != null) {
+ setProperty(path, def);
+ }
return def != null ? def : new ArrayList<>();
}
@@ -672,7 +691,9 @@ public class YAMLNode {
public List getNodeList(String path, List def) {
List raw = getList(path);
if (raw == null) {
- if (writeDefaults && def != null) setProperty(path, def);
+ if (writeDefaults && def != null) {
+ setProperty(path, def);
+ }
return def != null ? def : new ArrayList<>();
}
diff --git a/worldedit-core/src/main/java/com/sk89q/util/yaml/YAMLProcessor.java b/worldedit-core/src/main/java/com/sk89q/util/yaml/YAMLProcessor.java
index 48eb06e69..f67e6bd1a 100644
--- a/worldedit-core/src/main/java/com/sk89q/util/yaml/YAMLProcessor.java
+++ b/worldedit-core/src/main/java/com/sk89q/util/yaml/YAMLProcessor.java
@@ -110,10 +110,10 @@ public class YAMLProcessor extends YAMLNode {
* @throws java.io.IOException on load error
*/
public void load() throws IOException {
-
try (InputStream stream = getInputStream()) {
- if (stream == null)
+ if (stream == null) {
throw new IOException("Stream is null!");
+ }
read(yaml.load(new UnicodeReader(stream)));
} catch (YAMLProcessorException e) {
root = new LinkedHashMap<>();
@@ -172,8 +172,9 @@ public class YAMLProcessor extends YAMLNode {
parent.mkdirs();
}
try (OutputStream stream = getOutputStream()) {
- if (stream == null)
+ if (stream == null) {
return false;
+ }
OutputStreamWriter writer = new OutputStreamWriter(stream, StandardCharsets.UTF_8);
if (header != null) {
writer.append(header);
@@ -247,7 +248,7 @@ public class YAMLProcessor extends YAMLNode {
*
* @param key the property key
* @param comment the comment. May be {@code null}, in which case the comment
- * is removed.
+ * is removed.
*/
public void setComment(String key, String... comment) {
if (comment != null && comment.length > 0) {
@@ -285,10 +286,11 @@ public class YAMLProcessor extends YAMLNode {
}
/**
- * This method returns an empty ConfigurationNode for using as a
- * default in methods that select a node from a node list.
+ * Get an empty ConfigurationNode for using as a default in methods that
+ * select a node from a node list.
*
- * @param writeDefaults true to write default values when a property is requested that doesn't exist
+ * @param writeDefaults true to write default values when a property is
+ * requested that doesn't exist
* @return a node
*/
public static YAMLNode getEmptyNode(boolean writeDefaults) {
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java
index 10e01fe01..26eb0421f 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java
@@ -19,12 +19,6 @@
package com.sk89q.worldedit;
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.sk89q.worldedit.regions.Regions.asFlatRegion;
-import static com.sk89q.worldedit.regions.Regions.maximumBlockY;
-import static com.sk89q.worldedit.regions.Regions.minimumBlockY;
-
import com.boydti.fawe.FaweCache;
import com.boydti.fawe.config.Caption;
import com.boydti.fawe.config.Settings;
@@ -135,6 +129,11 @@ import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.block.BlockTypes;
import com.sk89q.worldedit.world.registry.LegacyMapper;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
@@ -145,10 +144,12 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkNotNull;
+import static com.sk89q.worldedit.regions.Regions.asFlatRegion;
+import static com.sk89q.worldedit.regions.Regions.maximumBlockY;
+import static com.sk89q.worldedit.regions.Regions.minimumBlockY;
/**
* An {@link Extent} that handles history, {@link BlockBag}s, change limits,
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSessionFactory.java b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSessionFactory.java
index 88b22bf1b..d6e3906e1 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSessionFactory.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSessionFactory.java
@@ -19,14 +19,14 @@
package com.sk89q.worldedit;
-import static com.google.common.base.Preconditions.checkNotNull;
-
import com.sk89q.worldedit.event.extent.EditSessionEvent;
import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.extent.inventory.BlockBag;
import com.sk89q.worldedit.util.eventbus.EventBus;
import com.sk89q.worldedit.world.World;
+import static com.google.common.base.Preconditions.checkNotNull;
+
/**
* Creates new {@link EditSession}s. To get an instance of this factory,
* use {@link WorldEdit#getEditSessionFactory()}.
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/LocalConfiguration.java b/worldedit-core/src/main/java/com/sk89q/worldedit/LocalConfiguration.java
index 492c799f2..5e705aa3b 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/LocalConfiguration.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/LocalConfiguration.java
@@ -29,7 +29,6 @@ import com.sk89q.worldedit.util.io.file.ArchiveNioSupports;
import com.sk89q.worldedit.util.logging.LogFormat;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.block.BlockType;
-import com.sk89q.worldedit.world.block.BlockTypes;
import com.sk89q.worldedit.world.registry.LegacyMapper;
import com.sk89q.worldedit.world.snapshot.SnapshotRepository;
import com.sk89q.worldedit.world.snapshot.experimental.SnapshotDatabase;
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java b/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java
index eeb297713..a636db1c3 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java
@@ -36,7 +36,6 @@ import com.boydti.fawe.util.StringMan;
import com.boydti.fawe.util.TextureHolder;
import com.boydti.fawe.util.TextureUtil;
import com.boydti.fawe.wrappers.WorldWrapper;
-import com.google.common.collect.Lists;
import com.sk89q.jchronic.Chronic;
import com.sk89q.jchronic.Options;
import com.sk89q.jchronic.utils.Span;
@@ -81,7 +80,6 @@ import com.sk89q.worldedit.world.item.ItemTypes;
import com.sk89q.worldedit.world.snapshot.experimental.Snapshot;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
-import javax.annotation.Nullable;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/WorldEdit.java b/worldedit-core/src/main/java/com/sk89q/worldedit/WorldEdit.java
index ac5b9d04b..11515af92 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/WorldEdit.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/WorldEdit.java
@@ -19,12 +19,12 @@
package com.sk89q.worldedit;
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.sk89q.worldedit.event.platform.Interaction.HIT;
-import static com.sk89q.worldedit.event.platform.Interaction.OPEN;
-
+import com.google.common.base.Throwables;
+import com.google.common.collect.HashMultimap;
import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Lists;
+import com.google.common.collect.SetMultimap;
import com.google.common.util.concurrent.ListeningExecutorService;
import com.google.common.util.concurrent.MoreExecutors;
import com.sk89q.worldedit.blocks.BaseItem;
@@ -44,6 +44,7 @@ import com.sk89q.worldedit.extent.inventory.BlockBag;
import com.sk89q.worldedit.function.mask.Mask;
import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.internal.expression.Expression;
+import com.sk89q.worldedit.internal.expression.invoke.ReturnException;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.scripting.CraftScriptContext;
import com.sk89q.worldedit.scripting.CraftScriptEngine;
@@ -68,6 +69,9 @@ import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.registry.BundledBlockData;
import com.sk89q.worldedit.world.registry.BundledItemData;
import com.sk89q.worldedit.world.registry.LegacyMapper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import java.io.DataInputStream;
import java.io.File;
import java.io.FileInputStream;
@@ -84,8 +88,9 @@ import java.util.Map;
import javax.annotation.Nullable;
import javax.script.ScriptException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.sk89q.worldedit.event.platform.Interaction.HIT;
+import static com.sk89q.worldedit.event.platform.Interaction.OPEN;
/**
* The entry point and container for a working implementation of WorldEdit.
@@ -111,8 +116,7 @@ public final class WorldEdit {
private final PlatformManager platformManager = new PlatformManager(this);
private final EditSessionFactory editSessionFactory = new EditSessionFactory.EditSessionFactoryImpl(eventBus);
private final SessionManager sessions = new SessionManager(this);
- private final ListeningExecutorService executorService = MoreExecutors.listeningDecorator(
- EvenMoreExecutors.newBoundedCachedThreadPool(0, 1, 20, "WorldEdit Task Executor - %s"));
+ private final ListeningExecutorService executorService = MoreExecutors.listeningDecorator(EvenMoreExecutors.newBoundedCachedThreadPool(0, 1, 20, "WorldEdit Task Executor - %s"));
private final Supervisor supervisor = new SimpleSupervisor();
private final TranslationManager translationManager = new TranslationManager(this);
@@ -288,7 +292,9 @@ public final class WorldEdit {
* @throws FilenameException thrown if the filename is invalid
*/
private File getSafeFile(@Nullable Actor actor, File dir, String filename, String defaultExt, String[] extensions, boolean isSave) throws FilenameException {
- if (extensions != null && (extensions.length == 1 && extensions[0] == null)) extensions = null;
+ if (extensions != null && (extensions.length == 1 && extensions[0] == null)) {
+ extensions = null;
+ }
File f;
@@ -388,7 +394,7 @@ public final class WorldEdit {
* Checks to see if the specified radius is within bounds.
*
* @param radius the radius
- * @throws MaxRadiusException
+ * @throws MaxRadiusException if the radius is bigger than the configured radius
*/
public void checkMaxRadius(double radius) throws MaxRadiusException {
if (getConfiguration().maxRadius > 0 && radius > getConfiguration().maxRadius) {
@@ -400,7 +406,7 @@ public final class WorldEdit {
* Checks to see if the specified brush radius is within bounds.
*
* @param radius the radius
- * @throws MaxBrushRadiusException
+ * @throws MaxBrushRadiusException if the radius is bigger than the configured radius
*/
public void checkMaxBrushRadius(double radius) throws MaxBrushRadiusException {
if (getConfiguration().maxBrushRadius > 0 && radius > getConfiguration().maxBrushRadius) {
@@ -474,6 +480,38 @@ public final class WorldEdit {
throw new UnknownDirectionException(dir.name());
}
+ private static final Map NAME_TO_DIRECTION_MAP;
+
+ static {
+ SetMultimap directionNames = HashMultimap.create();
+ for (Direction direction : Direction.valuesOf(
+ Direction.Flag.CARDINAL | Direction.Flag.UPRIGHT
+ )) {
+ String name = direction.name().toLowerCase(Locale.ROOT);
+ for (int i = 1; i <= name.length(); i++) {
+ directionNames.put(direction, name.substring(0, i));
+ }
+ }
+ ImmutableMap.Builder nameToDirectionMap = ImmutableMap.builder();
+ for (Direction direction : directionNames.keySet()) {
+ directionNames.get(direction).forEach(name ->
+ nameToDirectionMap.put(name, direction)
+ );
+ }
+ for (Direction direction : ImmutableList.of(Direction.NORTH, Direction.SOUTH)) {
+ for (Direction diagonal : ImmutableList.of(Direction.WEST, Direction.EAST)) {
+ for (String dirName : directionNames.get(direction)) {
+ for (String diagName : directionNames.get(diagonal)) {
+ nameToDirectionMap.put(dirName + diagName, Direction.valueOf(
+ direction.name() + diagonal.name()
+ ));
+ }
+ }
+ }
+ }
+ NAME_TO_DIRECTION_MAP = nameToDirectionMap.build();
+ }
+
/**
* Get the direction vector for a player's direction.
*
@@ -483,68 +521,32 @@ public final class WorldEdit {
* @throws UnknownDirectionException thrown if the direction is not known, or a relative direction is used with null player
*/
private Direction getPlayerDirection(@Nullable Player player, String dirStr) throws UnknownDirectionException {
- final Direction dir;
-
- switch (dirStr.charAt(0)) {
- case 'w':
- dir = Direction.WEST;
- break;
-
- case 'e':
- dir = Direction.EAST;
- break;
-
- case 's':
- if (dirStr.indexOf('w') > 0) {
- return Direction.SOUTHWEST;
- }
-
- if (dirStr.indexOf('e') > 0) {
- return Direction.SOUTHEAST;
- }
- dir = Direction.SOUTH;
- break;
-
- case 'n':
- if (dirStr.indexOf('w') > 0) {
- return Direction.NORTHWEST;
- }
-
- if (dirStr.indexOf('e') > 0) {
- return Direction.NORTHEAST;
- }
- dir = Direction.NORTH;
- break;
-
- case 'u':
- dir = Direction.UP;
- break;
-
- case 'd':
- dir = Direction.DOWN;
- break;
-
- case 'm': // me
- case 'f': // forward
- dir = getDirectionRelative(player, 0);
- break;
-
- case 'b': // back
- dir = getDirectionRelative(player, 180);
- break;
-
- case 'l': // left
- dir = getDirectionRelative(player, -90);
- break;
-
- case 'r': // right
- dir = getDirectionRelative(player, 90);
- break;
-
- default:
- throw new UnknownDirectionException(dirStr);
+ Direction byName = NAME_TO_DIRECTION_MAP.get(dirStr);
+ if (byName != null) {
+ return byName;
+ }
+ switch (dirStr) {
+ case "m":
+ case "me":
+ case "f":
+ case "forward":
+ return getDirectionRelative(player, 0);
+
+ case "b":
+ case "back":
+ return getDirectionRelative(player, 180);
+
+ case "l":
+ case "left":
+ return getDirectionRelative(player, -90);
+
+ case "r":
+ case "right":
+ return getDirectionRelative(player, 90);
+
+ default:
+ throw new UnknownDirectionException(dirStr);
}
- return dir;
}
private Direction getDirectionRelative(Player player, int yawOffset) throws UnknownDirectionException {
@@ -622,8 +624,21 @@ public final class WorldEdit {
* @param clicked the clicked block
* @return false if you want the action to go through
*/
+ @Deprecated
public boolean handleBlockRightClick(Player player, Location clicked) {
- BlockInteractEvent event = new BlockInteractEvent(player, clicked, OPEN);
+ return handleBlockRightClick(player, clicked, null);
+ }
+
+ /**
+ * Called on right click.
+ *
+ * @param player the player
+ * @param clicked the clicked block
+ * @param face The clicked face
+ * @return false if you want the action to go through
+ */
+ public boolean handleBlockRightClick(Player player, Location clicked, @Nullable Direction face) {
+ BlockInteractEvent event = new BlockInteractEvent(player, clicked, face, OPEN);
getEventBus().post(event);
return event.isCancelled();
}
@@ -635,8 +650,21 @@ public final class WorldEdit {
* @param clicked the clicked block
* @return false if you want the action to go through
*/
+ @Deprecated
public boolean handleBlockLeftClick(Player player, Location clicked) {
- BlockInteractEvent event = new BlockInteractEvent(player, clicked, HIT);
+ return handleBlockLeftClick(player, clicked, null);
+ }
+
+ /**
+ * Called on left click.
+ *
+ * @param player the player
+ * @param clicked the clicked block
+ * @param face The clicked face
+ * @return false if you want the action to go through
+ */
+ public boolean handleBlockLeftClick(Player player, Location clicked, @Nullable Direction face) {
+ BlockInteractEvent event = new BlockInteractEvent(player, clicked, face, HIT);
getEventBus().post(event);
return event.isCancelled();
}
@@ -708,8 +736,11 @@ public final class WorldEdit {
try {
engine.evaluate(script, filename, vars);
} catch (ScriptException e) {
- player.printError(TranslatableComponent.of("worldedit.script.failed", TextComponent.of(e.getMessage(), TextColor.WHITE)));
- logger.warn("Failed to execute script", e);
+ // non-exceptional return check
+ if (!(Throwables.getRootCause(e) instanceof ReturnException)) {
+ player.printError(TranslatableComponent.of("worldedit.script.failed", TextComponent.of(e.getMessage(), TextColor.WHITE)));
+ logger.warn("Failed to execute script", e);
+ }
} catch (NumberFormatException | WorldEditException e) {
throw e;
} catch (Throwable e) {
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/WorldEditException.java b/worldedit-core/src/main/java/com/sk89q/worldedit/WorldEditException.java
index 4f96d53be..844ca1ecd 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/WorldEditException.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/WorldEditException.java
@@ -19,15 +19,37 @@
package com.sk89q.worldedit;
+import com.sk89q.worldedit.util.formatting.WorldEditText;
+import com.sk89q.worldedit.util.formatting.text.Component;
+import com.sk89q.worldedit.util.formatting.text.TextComponent;
+
+import java.util.Locale;
+
/**
* Parent for all WorldEdit exceptions.
*/
public abstract class WorldEditException extends RuntimeException {
+ private final Component message;
+
/**
* Create a new exception.
*/
protected WorldEditException() {
+ this.message = null;
+ }
+
+ /**
+ * Create a new exception with a message.
+ *
+ * @param message the message
+ * @deprecated Use component version
+ */
+ @Deprecated
+ protected WorldEditException(String message) {
+ super(message);
+
+ this.message = TextComponent.of(message);
}
/**
@@ -35,8 +57,24 @@ public abstract class WorldEditException extends RuntimeException {
*
* @param message the message
*/
- protected WorldEditException(String message) {
- super(message);
+ protected WorldEditException(Component message) {
+ super(WorldEditText.reduceToText(message, Locale.getDefault()));
+
+ this.message = message;
+ }
+
+ /**
+ * Create a new exception with a message and a cause.
+ *
+ * @param message the message
+ * @param cause the cause
+ * @deprecated Use component version
+ */
+ @Deprecated
+ protected WorldEditException(String message, Throwable cause) {
+ super(message, cause);
+
+ this.message = TextComponent.of(message);
}
/**
@@ -45,8 +83,10 @@ public abstract class WorldEditException extends RuntimeException {
* @param message the message
* @param cause the cause
*/
- protected WorldEditException(String message, Throwable cause) {
- super(message, cause);
+ protected WorldEditException(Component message, Throwable cause) {
+ super(WorldEditText.reduceToText(message, Locale.getDefault()), cause);
+
+ this.message = message;
}
/**
@@ -56,5 +96,16 @@ public abstract class WorldEditException extends RuntimeException {
*/
protected WorldEditException(Throwable cause) {
super(cause);
+
+ this.message = null;
+ }
+
+ /**
+ * Get the message of this exception as a rich text component.
+ *
+ * @return The rich message
+ */
+ public Component getRichMessage() {
+ return this.message;
}
}
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/WorldEditManifest.java b/worldedit-core/src/main/java/com/sk89q/worldedit/WorldEditManifest.java
index febe7cac4..aaf5235d7 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/WorldEditManifest.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/WorldEditManifest.java
@@ -19,7 +19,6 @@
package com.sk89q.worldedit;
-import javax.annotation.Nullable;
import java.io.IOException;
import java.io.UncheckedIOException;
import java.net.JarURLConnection;
@@ -27,6 +26,7 @@ import java.net.URL;
import java.util.function.Supplier;
import java.util.jar.Attributes;
import java.util.jar.Manifest;
+import javax.annotation.Nullable;
/**
* Represents WorldEdit info from the MANIFEST.MF file.
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/BaseItem.java b/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/BaseItem.java
index 3401af293..15578b4ae 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/BaseItem.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/BaseItem.java
@@ -19,13 +19,14 @@
package com.sk89q.worldedit.blocks;
-import static com.google.common.base.Preconditions.checkNotNull;
import com.sk89q.jnbt.CompoundTag;
import com.sk89q.worldedit.world.NbtValued;
import com.sk89q.worldedit.world.item.ItemType;
import javax.annotation.Nullable;
+import static com.google.common.base.Preconditions.checkNotNull;
+
/**
* Represents an item, without an amount value. See {@link BaseItemStack}
* for an instance with stack amount information.
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/Blocks.java b/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/Blocks.java
index 1f65c6a19..6dd2f62f8 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/Blocks.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/Blocks.java
@@ -65,13 +65,17 @@ public final class Blocks {
states.forEach((key, value) -> {
@SuppressWarnings("unchecked")
Property prop = (Property) existing.get(key);
- if (prop == null) return;
+ if (prop == null) {
+ return;
+ }
Object val = null;
try {
val = prop.getValueFor(value);
} catch (IllegalArgumentException ignored) {
}
- if (val == null) return;
+ if (val == null) {
+ return;
+ }
newMap.put(prop, val);
});
return newMap;
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/ApplyBrushCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/ApplyBrushCommands.java
index 49058f17d..8c8855e88 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/ApplyBrushCommands.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/ApplyBrushCommands.java
@@ -19,9 +19,6 @@
package com.sk89q.worldedit.command;
-import static java.util.Objects.requireNonNull;
-import static org.enginehub.piston.part.CommandParts.arg;
-
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.sk89q.worldedit.LocalSession;
@@ -47,7 +44,6 @@ import com.sk89q.worldedit.util.formatting.text.TextComponent;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
import com.sk89q.worldedit.util.formatting.text.format.TextDecoration;
-import java.util.stream.Collectors;
import org.enginehub.piston.CommandManager;
import org.enginehub.piston.CommandManagerService;
import org.enginehub.piston.CommandParameters;
@@ -58,6 +54,11 @@ import org.enginehub.piston.inject.Key;
import org.enginehub.piston.part.CommandArgument;
import org.enginehub.piston.part.SubCommandPart;
+import java.util.stream.Collectors;
+
+import static java.util.Objects.requireNonNull;
+import static org.enginehub.piston.part.CommandParts.arg;
+
@CommandContainer(superTypes = CommandPermissionsConditionGenerator.Registration.class)
public class ApplyBrushCommands {
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/BiomeCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/BiomeCommands.java
index d144bfb33..c0083ecab 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/BiomeCommands.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/BiomeCommands.java
@@ -19,17 +19,14 @@
package com.sk89q.worldedit.command;
-import static com.sk89q.worldedit.command.util.Logging.LogMode.REGION;
-
-import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.command.util.CommandPermissions;
-import com.sk89q.worldedit.command.util.WorldEditAsyncCommandBuilder;
import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator;
import com.sk89q.worldedit.command.util.Logging;
+import com.sk89q.worldedit.command.util.WorldEditAsyncCommandBuilder;
import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.extension.platform.Capability;
@@ -51,21 +48,25 @@ import com.sk89q.worldedit.util.formatting.component.PaginationBox;
import com.sk89q.worldedit.util.formatting.component.TextUtils;
import com.sk89q.worldedit.util.formatting.text.Component;
import com.sk89q.worldedit.util.formatting.text.TextComponent;
+import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.sk89q.worldedit.util.formatting.text.event.HoverEvent;
import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.biome.BiomeData;
import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.registry.BiomeRegistry;
-import java.util.HashSet;
-import java.util.Set;
-import java.util.stream.Collectors;
import org.enginehub.piston.annotation.Command;
import org.enginehub.piston.annotation.CommandContainer;
-import java.util.List;
import org.enginehub.piston.annotation.param.Arg;
import org.enginehub.piston.annotation.param.ArgFlag;
import org.enginehub.piston.annotation.param.Switch;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+import static com.sk89q.worldedit.command.util.Logging.LogMode.REGION;
+
/**
* Implements biome-related commands such as "/biomelist".
*/
@@ -88,30 +89,29 @@ public class BiomeCommands {
@ArgFlag(name = 'p', desc = "Page number.", def = "1")
int page) {
WorldEditAsyncCommandBuilder.createAndSendMessage(actor, () -> {
- BiomeRegistry biomeRegistry = WorldEdit.getInstance().getPlatformManager()
- .queryCapability(Capability.GAME_HOOKS).getRegistries().getBiomeRegistry();
+ BiomeRegistry biomeRegistry =
+ WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.GAME_HOOKS)
+ .getRegistries().getBiomeRegistry();
- PaginationBox paginationBox = PaginationBox.fromStrings("Available Biomes", "/biomelist -p %page%",
- BiomeType.REGISTRY.values().stream()
- .map(biomeType -> {
- String id = biomeType.getId();
- final BiomeData data = biomeRegistry.getData(biomeType);
- if (data != null) {
- String name = data.getName();
- return id + " (" + name + ")";
- } else {
- return id;
- }
- })
- .collect(Collectors.toList()));
- return paginationBox.create(page);
+ PaginationBox paginationBox = PaginationBox
+ .fromStrings("Available Biomes", "/biomelist -p %page%",
+ BiomeType.REGISTRY.values().stream().map(biomeType -> {
+ String id = biomeType.getId();
+ final BiomeData data = biomeRegistry.getData(biomeType);
+ if (data != null) {
+ String name = data.getName();
+ return id + " (" + name + ")";
+ } else {
+ return id;
+ }
+ }).collect(Collectors.toList()));
+ return paginationBox.create(page);
}, (Component) null);
}
@Command(
name = "biomeinfo",
desc = "Get the biome of the targeted block.",
- aliases = { "/biomeinfo" },
descFooter = "By default, uses all blocks in your selection."
)
@CommandPermissions("worldedit.biome.info")
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/BrushCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/BrushCommands.java
index e726217a7..55e214674 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/BrushCommands.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/BrushCommands.java
@@ -21,7 +21,6 @@ package com.sk89q.worldedit.command;
import com.boydti.fawe.Fawe;
import com.boydti.fawe.config.Caption;
-import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.boydti.fawe.config.Settings;
import com.boydti.fawe.object.FaweLimit;
import com.boydti.fawe.object.brush.BlendBall;
@@ -66,9 +65,8 @@ import com.sk89q.worldedit.EmptyClipboardException;
import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.WorldEditException;
-import com.sk89q.worldedit.command.factory.ReplaceFactory;
-import com.sk89q.worldedit.blocks.BaseItem;
import com.sk89q.worldedit.command.argument.Arguments;
+import com.sk89q.worldedit.command.factory.ReplaceFactory;
import com.sk89q.worldedit.command.factory.TreeGeneratorFactory;
import com.sk89q.worldedit.command.tool.BrushTool;
import com.sk89q.worldedit.command.tool.InvalidToolBindException;
@@ -91,6 +89,7 @@ import com.sk89q.worldedit.extension.platform.binding.ProvideBindings;
import com.sk89q.worldedit.extent.clipboard.Clipboard;
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats;
import com.sk89q.worldedit.function.Contextual;
+import com.sk89q.worldedit.function.factory.Apply;
import com.sk89q.worldedit.function.factory.Deform;
import com.sk89q.worldedit.function.factory.Paint;
import com.sk89q.worldedit.function.mask.ExistingBlockMask;
@@ -106,13 +105,23 @@ import com.sk89q.worldedit.regions.factory.RegionFactory;
import com.sk89q.worldedit.session.ClipboardHolder;
import com.sk89q.worldedit.util.HandSide;
import com.sk89q.worldedit.util.TreeGenerator;
+import com.sk89q.worldedit.util.formatting.text.TextComponent;
+import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.sk89q.worldedit.world.block.BlockID;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.block.BlockTypes;
+import org.enginehub.piston.annotation.Command;
+import org.enginehub.piston.annotation.CommandContainer;
+import org.enginehub.piston.annotation.param.Arg;
+import org.enginehub.piston.annotation.param.ArgFlag;
+import org.enginehub.piston.annotation.param.Switch;
+import org.enginehub.piston.inject.InjectedValueAccess;
+import org.enginehub.piston.inject.Key;
+import org.jetbrains.annotations.Range;
+
import java.awt.image.BufferedImage;
-import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileInputStream;
@@ -123,17 +132,6 @@ import java.io.InputStream;
import java.net.URI;
import java.nio.file.FileSystems;
import java.util.List;
-import java.util.zip.GZIPInputStream;
-import com.sk89q.worldedit.util.formatting.text.TextComponent;
-import org.enginehub.piston.annotation.Command;
-import com.sk89q.worldedit.function.factory.Apply;
-import org.enginehub.piston.annotation.CommandContainer;
-import org.enginehub.piston.annotation.param.Arg;
-import org.enginehub.piston.annotation.param.ArgFlag;
-import org.enginehub.piston.annotation.param.Switch;
-import org.enginehub.piston.inject.InjectedValueAccess;
-import org.enginehub.piston.inject.Key;
-import org.jetbrains.annotations.Range;
import static com.google.common.base.Preconditions.checkNotNull;
@@ -155,237 +153,226 @@ public class BrushCommands {
this.worldEdit = worldEdit;
}
- @Command(
- name = "none",
- aliases = "unbind",
- desc = "Unbind a bound brush from your current item"
- )
+ @Command(name = "none",
+ aliases = "unbind",
+ desc = "Unbind a bound brush from your current item")
void none(Player player, LocalSession session) throws WorldEditException {
ToolCommands.setToolNone(player, session, true);
}
- @Command(
- name = "blendball",
- aliases = {"bb", "blend"},
- desc = "Smooths and blends terrain",
- descFooter = "Smooths and blends terrain\n" +
- "Pic: https://i.imgur.com/cNUQUkj.png → https://i.imgur.com/hFOFsNf.png"
- )
+ @Command(name = "blendball",
+ aliases = {
+ "bb",
+ "blend"
+ },
+ desc = "Smooths and blends terrain",
+ descFooter = "Smooths and blends terrain\n"
+ + "Pic: https://i.imgur.com/cNUQUkj.png → https://i.imgur.com/hFOFsNf.png")
@CommandPermissions("worldedit.brush.blendball")
public void blendBallBrush(InjectedValueAccess context,
- @Arg(desc = "The radius to sample for blending", def = "5")
- Expression radius) throws WorldEditException {
+ @Arg(desc = "The radius to sample for blending",
+ def = "5") Expression radius) throws WorldEditException {
worldEdit.checkMaxBrushRadius(radius);
set(context, new BlendBall()).setSize(radius);
}
- @Command(
- name = "erode",
- desc = "Erodes terrain"
- )
+ @Command(name = "erode",
+ desc = "Erodes terrain")
@CommandPermissions("worldedit.brush.erode")
- public void erodeBrush(InjectedValueAccess context,
- @Arg(desc = "The radius for eroding", def = "5")
- Expression radius,
- @Arg(desc = "erodeFaces", def = "6") int erodefaces,
- @Arg(desc = "erodeRec", def = "0") int erodeRec,
- @Arg(desc = "fillFaces", def = "1") int fillFaces,
- @Arg(desc = "fillRec", def = "1") int fillRec
- ) throws WorldEditException {
+ public void erodeBrush(InjectedValueAccess context, @Arg(desc = "The radius for eroding",
+ def = "5") Expression radius,
+ @Arg(desc = "erodeFaces",
+ def = "6") int erodefaces, @Arg(desc = "erodeRec",
+ def = "0") int erodeRec, @Arg(desc = "fillFaces",
+ def = "1") int fillFaces,
+ @Arg(desc = "fillRec",
+ def = "1") int fillRec) throws WorldEditException {
worldEdit.checkMaxBrushRadius(radius);
set(context, new ErodeBrush(erodefaces, erodeRec, fillFaces, fillRec)).setSize(radius);
}
- @Command(
- name = "pull",
- desc = "Pull terrain towards you"
- )
+ @Command(name = "pull",
+ desc = "Pull terrain towards you")
@CommandPermissions("worldedit.brush.pull")
public void pullBrush(InjectedValueAccess context,
- @Arg(desc = "The radius to sample for blending", def = "5")
- Expression radius,
- @Arg(desc = "erodeFaces", def = "2") int erodefaces,
- @Arg(desc = "erodeRec", def = "1") int erodeRec,
- @Arg(desc = "fillFaces", def = "5") int fillFaces,
- @Arg(desc = "fillRec", def = "1") int fillRec
- ) throws WorldEditException {
+ @Arg(desc = "The radius to sample for blending",
+ def = "5") Expression radius, @Arg(desc = "erodeFaces",
+ def = "2") int erodefaces, @Arg(desc = "erodeRec",
+ def = "1")
+ int erodeRec, @Arg(desc = "fillFaces",
+ def = "5") int fillFaces, @Arg(desc = "fillRec",
+ def = "1") int fillRec)
+ throws WorldEditException {
worldEdit.checkMaxBrushRadius(radius);
set(context, new RaiseBrush(erodefaces, erodeRec, fillFaces, fillRec)).setSize(radius);
}
- @Command(
- name = "circle",
- desc = "Creates a circle, which revolves around your facing direction"
- )
+ @Command(name = "circle",
+ desc = "Creates a circle, which revolves around your facing direction")
@CommandPermissions("worldedit.brush.sphere")
public void circleBrush(Player player, InjectedValueAccess context,
- @Arg(desc = "Pattern") Pattern fill,
- @Arg(desc = "The radius to sample for blending", def = "5")
- Expression radius) throws WorldEditException {
+ @Arg(desc = "Pattern") Pattern fill, @Arg(desc = "The radius to sample for blending",
+ def = "5") Expression radius)
+ throws WorldEditException {
worldEdit.checkMaxBrushRadius(radius);
set(context, new CircleBrush(player)).setSize(radius).setFill(fill);
}
- @Command(
- name = "recursive",
- aliases = {"recurse", "r"},
- desc = "Set all connected blocks",
- descFooter = "Set all connected blocks\n" +
- "Note: Set a mask to recurse along specific blocks"
- )
+ @Command(name = "recursive",
+ aliases = {
+ "recurse",
+ "r"
+ },
+ desc = "Set all connected blocks",
+ descFooter = "Set all connected blocks\n"
+ + "Note: Set a mask to recurse along specific blocks")
@CommandPermissions("worldedit.brush.recursive")
public void recursiveBrush(InjectedValueAccess context, EditSession editSession,
- @Arg(desc = "Pattern") Pattern fill,
- @Arg(desc = "The radius to sample for blending", def = "5")
- Expression radius,
- @Switch(name = 'd', desc = "Apply in depth first order")
- boolean depthFirst) throws WorldEditException {
+ @Arg(desc = "Pattern") Pattern fill, @Arg(desc = "The radius to sample for blending",
+ def = "5") Expression radius, @Switch(name = 'd',
+ desc = "Apply in depth first order")
+ boolean depthFirst) throws WorldEditException {
worldEdit.checkMaxBrushRadius(radius);
- set(context, new RecurseBrush(depthFirst))
- .setSize(radius).setFill(fill).setMask(new IdMask(editSession));
+ set(context, new RecurseBrush(depthFirst)).setSize(radius).setFill(fill)
+ .setMask(new IdMask(editSession));
}
- @Command(
- name = "line",
- aliases = {"l"},
- desc = "Create lines"
- )
+ @Command(name = "line",
+ aliases = { "l" },
+ desc = "Create lines")
@CommandPermissions("worldedit.brush.line")
- public void lineBrush(InjectedValueAccess context, @Arg(desc = "Pattern") Pattern fill,
- @Arg(desc = "The radius to sample for blending", def = "0")
- Expression radius,
- @Switch(name = 'h', desc = "Create only a shell")
- boolean shell,
- @Switch(name = 's', desc = "Selects the clicked point after drawing")
- boolean select,
- @Switch(name = 'f', desc = "Create a flat line")
- boolean flat) throws WorldEditException {
+ public void lineBrush(InjectedValueAccess context,
+ @Arg(desc = "Pattern") Pattern fill, @Arg(desc = "The radius to sample for blending",
+ def = "0") Expression radius, @Switch(name = 'h',
+ desc = "Create only a shell")
+ boolean shell, @Switch(name = 's',
+ desc = "Selects the clicked point after drawing") boolean select,
+ @Switch(name = 'f',
+ desc = "Create a flat line") boolean flat) throws WorldEditException {
worldEdit.checkMaxBrushRadius(radius);
set(context, new LineBrush(shell, select, flat)).setSize(radius).setFill(fill);
}
- @Command(
- name = "spline",
- aliases = {"spl", "curve"},
- desc = "Join multiple objects together in a curve",
- descFooter = "Click to select some objects,click the same block twice to connect the objects.\n" +
- "Insufficient brush radius, or clicking the the wrong spot will result in undesired shapes. The shapes must be simple lines or loops.\n" +
- "Pic1: http://i.imgur.com/CeRYAoV.jpg -> http://i.imgur.com/jtM0jA4.png\n" +
- "Pic2: http://i.imgur.com/bUeyc72.png -> http://i.imgur.com/tg6MkcF.png" +
- "Tutorial: https://www.planetminecraft.com/blog/fawe-tutorial/"
- )
+ @Command(name = "spline",
+ aliases = {
+ "spl",
+ "curve"
+ },
+ desc = "Join multiple objects together in a curve",
+ descFooter =
+ "Click to select some objects,click the same block twice to connect the objects.\n"
+ + "Insufficient brush radius, or clicking the the wrong spot will result in undesired shapes. The shapes must be simple lines or loops.\n"
+ + "Pic1: http://i.imgur.com/CeRYAoV.jpg -> http://i.imgur.com/jtM0jA4.png\n"
+ + "Pic2: http://i.imgur.com/bUeyc72.png -> http://i.imgur.com/tg6MkcF.png"
+ + "Tutorial: https://www.planetminecraft.com/blog/fawe-tutorial/")
@CommandPermissions("worldedit.brush.spline")
public void splineBrush(Player player, InjectedValueAccess context,
- @Arg(desc = "Pattern") Pattern fill,
- @Arg(desc = "The radius to sample for blending", def = "25")
- Expression radius) throws WorldEditException {
+ @Arg(desc = "Pattern") Pattern fill, @Arg(desc = "The radius to sample for blending",
+ def = "25") Expression radius)
+ throws WorldEditException {
worldEdit.checkMaxBrushRadius(radius);
player.print(Caption.of("fawe.worldedit.brush.brush.spline", (radius)));
- set(context,
- new SplineBrush(player))
- .setSize(radius)
- .setFill(fill);
+ set(context, new SplineBrush(player)).setSize(radius).setFill(fill);
}
- @Command(
- name = "sweep",
- aliases = {"sw", "vaesweep"},
- desc = "Sweep your clipboard content along a curve",
- descFooter = "Sweeps your clipboard content along a curve.\n" +
- "Define a curve by selecting the individual points with a brush\n" +
- "Set [copies] to a value > 0 if you want to have your selection pasted a limited amount of times equally spaced on the curve"
- )
+ @Command(name = "sweep",
+ aliases = {
+ "sw",
+ "vaesweep"
+ },
+ desc = "Sweep your clipboard content along a curve",
+ descFooter = "Sweeps your clipboard content along a curve.\n"
+ + "Define a curve by selecting the individual points with a brush\n"
+ + "Set [copies] to a value > 0 if you want to have your selection pasted a limited amount of times equally spaced on the curve")
@CommandPermissions("worldedit.brush.sweep")
- public void sweepBrush(Player player, InjectedValueAccess context,
- @Arg(desc = "int", def = "-1") int copies) throws WorldEditException {
+ public void sweepBrush(Player player, InjectedValueAccess context, @Arg(desc = "int",
+ def = "-1") int copies)
+ throws WorldEditException {
player.print(TranslatableComponent.of("fawe.worldedit.brush.brush.spline"));
set(context, new SweepBrush(copies));
}
- @Command(
- name = "catenary",
- aliases = {"cat", "gravityline", "saggedline"},
- desc = "Create a hanging line between two points"
- )
+ @Command(name = "catenary",
+ aliases = {
+ "cat",
+ "gravityline",
+ "saggedline"
+ },
+ desc = "Create a hanging line between two points")
@CommandPermissions("worldedit.brush.spline")
- public void catenaryBrush(InjectedValueAccess context, @Arg(desc = "Pattern") Pattern fill,
- @Arg(def = "1.2", desc = "Length of wire compared to distance between points") @Range(from = 1, to=Integer.MAX_VALUE) double lengthFactor,
- @Arg(desc = "The radius to sample for blending", def = "0")
- Expression radius,
- @Switch(name = 'h', desc = "Create only a shell")
- boolean shell,
- @Switch(name = 's', desc = "Select the clicked point after drawing")
- boolean select,
- @Switch(name = 'd', desc = "sags the catenary toward the facing direction")
- boolean facingDirection) throws WorldEditException {
+ public void catenaryBrush(InjectedValueAccess context,
+ @Arg(desc = "Pattern") Pattern fill, @Arg(def = "1.2",
+ desc = "Length of wire compared to distance between points")
+ @Range(from = 1,
+ to = Integer.MAX_VALUE) double lengthFactor,
+ @Arg(desc = "The radius to sample for blending",
+ def = "0") Expression radius, @Switch(name = 'h',
+ desc = "Create only a shell") boolean shell,
+ @Switch(name = 's',
+ desc = "Select the clicked point after drawing") boolean select, @Switch(name = 'd',
+ desc = "sags the catenary toward the facing direction")
+ boolean facingDirection) throws WorldEditException {
worldEdit.checkMaxBrushRadius(radius);
Brush brush = new CatenaryBrush(shell, select, facingDirection, lengthFactor);
- set(context,
- new CatenaryBrush(shell, select, facingDirection, lengthFactor))
- .setSize(radius)
- .setFill(fill);
+ set(context, new CatenaryBrush(shell, select, facingDirection, lengthFactor))
+ .setSize(radius).setFill(fill);
}
- @Command(
- name = "surfacespline",
- aliases = {"sspline", "sspl"},
- desc = "Draws a spline (curved line) on the surface",
- descFooter = "Create a spline on the surface\n" +
- "Video: https://www.youtube.com/watch?v=zSN-2jJxXlM"
- )
+ @Command(name = "surfacespline",
+ aliases = {
+ "sspline",
+ "sspl"
+ },
+ desc = "Draws a spline (curved line) on the surface",
+ descFooter = "Create a spline on the surface\n"
+ + "Video: https://www.youtube.com/watch?v=zSN-2jJxXlM")
@CommandPermissions("worldedit.brush.surfacespline") // 0, 0, 0, 10, 0,
- public void surfaceSpline(Player player, InjectedValueAccess context, @Arg(desc = "Pattern") Pattern fill,
- @Arg(desc = "The radius to sample for blending", def = "0")
- Expression radius,
- @Arg(desc = "double", def = "0") double tension,
- @Arg(desc = "double", def = "0") double bias,
- @Arg(desc = "double", def = "0") double continuity,
- @Arg(desc = "double", def = "10") double quality) throws WorldEditException {
+ public void surfaceSpline(Player player, InjectedValueAccess context,
+ @Arg(desc = "Pattern") Pattern fill, @Arg(desc = "The radius to sample for blending",
+ def = "0") Expression radius,
+ @Arg(desc = "double",
+ def = "0") double tension, @Arg(desc = "double",
+ def = "0") double bias, @Arg(desc = "double",
+ def = "0")
+ double continuity, @Arg(desc = "double",
+ def = "10") double quality) throws WorldEditException {
player.print(Caption.of("fawe.worldedit.brush.brush.spline", (radius)));
worldEdit.checkMaxBrushRadius(radius);
- set(context,
- new SurfaceSpline(tension, bias, continuity, quality))
- .setSize(radius)
- .setFill(fill);
+ set(context, new SurfaceSpline(tension, bias, continuity, quality)).setSize(radius)
+ .setFill(fill);
}
- @Command(
- name = "rock",
- aliases = {"blob"},
- desc = "Creates a distorted sphere"
- )
+ @Command(name = "rock",
+ aliases = { "blob" },
+ desc = "Creates a distorted sphere")
@CommandPermissions("worldedit.brush.rock")
public void blobBrush(InjectedValueAccess context,
- @Arg(desc = "Pattern") Pattern fill,
- @Arg(desc = "Vector3", def = "10")
- Vector3 radius,
- @Arg(desc = "double", def = "100")
- double sphericity,
- @Arg(desc = "double", def = "30")
- double frequency,
- @Arg(desc = "double", def = "50")
- double amplitude) throws WorldEditException {
+ @Arg(desc = "Pattern") Pattern fill, @Arg(desc = "Vector3",
+ def = "10") Vector3 radius, @Arg(desc = "double",
+ def = "100")
+ double sphericity, @Arg(desc = "double",
+ def = "30") double frequency, @Arg(desc = "double",
+ def = "50") double amplitude)
+ throws WorldEditException {
double max = MathMan.max(radius.getX(), radius.getY(), radius.getZ());
worldEdit.checkMaxBrushRadius(max);
- Brush brush = new BlobBrush(radius.divide(max), frequency / 100, amplitude / 100, sphericity / 100);
+ Brush brush =
+ new BlobBrush(radius.divide(max), frequency / 100, amplitude / 100, sphericity / 100);
set(context, brush).setSize(max).setFill(fill);
}
- @Command(
- name = "sphere",
- aliases = { "s" },
- desc = "Choose the sphere brush"
- )
+ @Command(name = "sphere",
+ aliases = { "s" },
+ desc = "Choose the sphere brush")
@CommandPermissions("worldedit.brush.sphere")
public void sphereBrush(Player player, InjectedValueAccess context,
- @Arg(desc = "The pattern of blocks to set")
- Pattern pattern,
- @Arg(desc = "The radius of the sphere", def = "2")
- Expression radius,
- @Switch(name = 'h', desc = "Create hollow spheres instead")
- boolean hollow,
- @Switch(name = 'f', desc = "Create falling spheres instead")
- boolean falling) throws WorldEditException {
+ @Arg(desc = "The pattern of blocks to set") Pattern pattern,
+ @Arg(desc = "The radius of the sphere",
+ def = "2") Expression radius, @Switch(name = 'h',
+ desc = "Create hollow spheres instead")
+ boolean hollow, @Switch(name = 'f',
+ desc = "Create falling spheres instead") boolean falling)
+ throws WorldEditException {
worldEdit.checkMaxBrushRadius(radius);
Brush brush;
if (hollow) {
@@ -396,7 +383,8 @@ public class BrushCommands {
switch (type.getInternalId()) {
case BlockID.SAND:
case BlockID.GRAVEL:
- player.print(TranslatableComponent.of("fawe.worldedit.brush.brush.try.other"));
+ player.print(
+ TranslatableComponent.of("fawe.worldedit.brush.brush.try.other"));
falling = true;
}
}
@@ -410,72 +398,73 @@ public class BrushCommands {
set(context, brush).setSize(radius).setFill(pattern);
}
- @Command(
- name = "shatter",
- aliases = {"partition", "split"},
- desc = "Creates random lines to break the terrain into pieces",
- descFooter = "Creates uneven lines separating terrain into multiple pieces\n" +
- "Pic: https://i.imgur.com/2xKsZf2.png"
- )
+ @Command(name = "shatter",
+ aliases = {
+ "partition",
+ "split"
+ },
+ desc = "Creates random lines to break the terrain into pieces",
+ descFooter = "Creates uneven lines separating terrain into multiple pieces\n"
+ + "Pic: https://i.imgur.com/2xKsZf2.png")
@CommandPermissions("worldedit.brush.shatter")
public void shatterBrush(EditSession editSession, InjectedValueAccess context,
- @Arg(desc = "Pattern") Pattern fill,
- @Arg(desc = "The radius to sample for blending", def = "10")
- Expression radius,
- @Arg(desc = "Lines", def = "10") int count) throws WorldEditException {
+ @Arg(desc = "Pattern") Pattern fill, @Arg(desc = "The radius to sample for blending",
+ def = "10") Expression radius,
+ @Arg(desc = "Lines",
+ def = "10") int count) throws WorldEditException {
worldEdit.checkMaxBrushRadius(radius);
- set(context,
- new ShatterBrush(count))
- .setSize(radius)
- .setFill(fill)
- .setMask(new ExistingBlockMask(editSession));
+ set(context, new ShatterBrush(count)).setSize(radius).setFill(fill)
+ .setMask(new ExistingBlockMask(editSession));
}
- @Command(
- name = "stencil",
- desc = "Use a height map to paint a surface",
- descFooter = "Use a height map to paint any surface.\n"
-)
+ @Command(name = "stencil",
+ desc = "Use a height map to paint a surface",
+ descFooter = "Use a height map to paint any surface.\n")
@CommandPermissions("worldedit.brush.stencil")
- public void stencilBrush(LocalSession session, InjectedValueAccess context, @Arg(desc = "Pattern") Pattern fill,
- @Arg(desc = "Expression", def = "5") Expression radius,
- @Arg(desc = "String", def = "") String image,
- @Arg(def = "0", desc = "rotation") @Range(from=0, to=360) int rotation,
- @Arg(desc = "double", def = "1") double yscale,
- @Switch(name = 'w', desc = "Apply at maximum saturation") boolean onlyWhite,
- @Switch(name = 'r', desc = "Apply random rotation") boolean randomRotate) throws WorldEditException, FileNotFoundException {
+ public void stencilBrush(LocalSession session, InjectedValueAccess context,
+ @Arg(desc = "Pattern") Pattern fill, @Arg(desc = "Expression",
+ def = "5") Expression radius,
+ @Arg(desc = "String",
+ def = "") String image, @Arg(def = "0",
+ desc = "rotation") @Range(from = 0,
+ to = 360) int rotation,
+ @Arg(desc = "double",
+ def = "1") double yscale, @Switch(name = 'w',
+ desc = "Apply at maximum saturation")
+ boolean onlyWhite, @Switch(name = 'r',
+ desc = "Apply random rotation") boolean randomRotate)
+ throws WorldEditException, FileNotFoundException {
worldEdit.checkMaxBrushRadius(radius);
InputStream stream = getHeightmapStream(image);
HeightBrush brush;
try {
- brush = new StencilBrush(stream, rotation, yscale, onlyWhite, "#clipboard".equalsIgnoreCase(image) ? session.getClipboard().getClipboard() : null);
+ brush = new StencilBrush(stream, rotation, yscale, onlyWhite,
+ "#clipboard".equalsIgnoreCase(image)
+ ? session.getClipboard().getClipboard() :
+ null);
} catch (EmptyClipboardException ignore) {
brush = new StencilBrush(stream, rotation, yscale, onlyWhite, null);
}
if (randomRotate) {
brush.setRandomRotate(true);
}
- set(context,
- brush)
- .setSize(radius)
- .setFill(fill);
+ set(context, brush).setSize(radius).setFill(fill);
}
@Command(
- name = "image",
- desc = "Use a height map to paint a surface",
- descFooter = "Use a height map to paint any surface.\n")
+ name = "image",
+ desc = "Use a height map to paint a surface",
+ descFooter = "Use a height map to paint any surface.\n"
+ )
@CommandPermissions("worldedit.brush.stencil")
public void imageBrush(LocalSession session, InjectedValueAccess context,
- @Arg(desc = "The size of the brush", def = "5")
- Expression radius,
- ProvideBindings.ImageUri imageUri,
- @Arg(def = "1", desc = "scale height")
- double yscale,
- @Switch(name = 'a', desc = "Use image Alpha")
- boolean alpha,
- @Switch(name = 'f', desc = "Blend the image with existing terrain")
- boolean fadeOut) throws WorldEditException, IOException {
+ @Arg(desc = "The size of the brush",
+ def = "5") Expression radius, ProvideBindings.ImageUri imageUri, @Arg(def = "1",
+ desc = "scale height")
+ double yscale, @Switch(name = 'a',
+ desc = "Use image Alpha") boolean alpha, @Switch(name = 'f',
+ desc = "Blend the image with existing terrain")
+ boolean fadeOut) throws WorldEditException, IOException {
BufferedImage image = imageUri.load();
worldEdit.checkMaxBrushRadius(radius);
if (yscale != 1) {
@@ -490,37 +479,35 @@ public class BrushCommands {
set(context, brush).setSize(radius);
}
- @Command(
- name = "surface",
- aliases = {"surf"},
- desc = "Use a height map to paint a surface",
- descFooter = "Use a height map to paint any surface.\n" +
- "The -w flag will only apply at maximum saturation\n" +
- "The -r flag will apply random rotation"
- )
+ @Command(name = "surface",
+ aliases = { "surf" },
+ desc = "Use a height map to paint a surface",
+ descFooter = "Use a height map to paint any surface.\n"
+ + "The -w flag will only apply at maximum saturation\n"
+ + "The -r flag will apply random rotation")
@CommandPermissions("worldedit.brush.surface")
- public void surfaceBrush(InjectedValueAccess context, @Arg(desc = "Pattern") Pattern fill,
- @Arg(desc = "Expression", def = "5")
- Expression radius) throws WorldEditException {
+ public void surfaceBrush(InjectedValueAccess context,
+ @Arg(desc = "Pattern") Pattern fill, @Arg(desc = "Expression",
+ def = "5") Expression radius)
+ throws WorldEditException {
worldEdit.checkMaxBrushRadius(radius);
set(context, new SurfaceSphereBrush()).setFill(fill).setSize(radius);
}
- @Command(
- name = "scatter",
- desc = "Scatter a pattern on a surface",
- descFooter = "Set a number of blocks randomly on a surface each a certain distance apart.\n" +
- "Video: https://youtu.be/RPZIaTbqoZw?t=34s"
- )
+ @Command(name = "scatter",
+ desc = "Scatter a pattern on a surface",
+ descFooter =
+ "Set a number of blocks randomly on a surface each a certain distance apart.\n"
+ + "Video: https://youtu.be/RPZIaTbqoZw?t=34s")
@CommandPermissions("worldedit.brush.scatter")
- public void scatterBrush(InjectedValueAccess context, @Arg(desc = "Pattern") Pattern fill,
- @Arg(desc = "radius", def = "5")
- Expression radius,
- @Arg(desc = "points", def = "5")
- double points,
- @Arg(desc = "distance", def = "1")
- double distance,
- @Switch(name = 'o', desc = "Overlay the block") boolean overlay) throws WorldEditException {
+ public void scatterBrush(InjectedValueAccess context,
+ @Arg(desc = "Pattern") Pattern fill, @Arg(desc = "radius",
+ def = "5") Expression radius,
+ @Arg(desc = "points",
+ def = "5") double points, @Arg(desc = "distance",
+ def = "1") double distance, @Switch(name = 'o',
+ desc = "Overlay the block")
+ boolean overlay) throws WorldEditException {
worldEdit.checkMaxBrushRadius(radius);
Brush brush;
if (overlay) {
@@ -531,108 +518,113 @@ public class BrushCommands {
set(context, brush).setSize(radius).setFill(fill);
}
- @Command(
- name = "populateschematic",
- aliases = {"populateschem", "popschem", "pschem", "ps"},
- desc = "Scatter a schematic on a surface"
- )
+ @Command(name = "populateschematic",
+ aliases = {
+ "populateschem",
+ "popschem",
+ "pschem",
+ "ps"
+ },
+ desc = "Scatter a schematic on a surface")
@CommandPermissions("worldedit.brush.populateschematic")
- public void scatterSchemBrush(Player player, InjectedValueAccess context, @Arg(desc = "Mask") Mask mask,
- @Arg(name = "clipboard", desc = "Clipboard uri") String clipboardStr,
- @Arg(desc = "Expression", def = "30") Expression radius,
- @Arg(desc = "double", def = "50") double density,
- @Switch(name = 'r', desc = "Apply random rotation") boolean rotate) throws WorldEditException {
+ public void scatterSchemBrush(Player player, InjectedValueAccess context,
+ @Arg(desc = "Mask") Mask mask, @Arg(name = "clipboard",
+ desc = "Clipboard uri") String clipboardStr,
+ @Arg(desc = "Expression",
+ def = "30") Expression radius, @Arg(desc = "double",
+ def = "50") double density, @Switch(name = 'r',
+ desc = "Apply random rotation")
+ boolean rotate) throws WorldEditException {
worldEdit.checkMaxBrushRadius(radius);
try {
- MultiClipboardHolder clipboards = ClipboardFormats.loadAllFromInput(player, clipboardStr, null, true);
+ MultiClipboardHolder clipboards =
+ ClipboardFormats.loadAllFromInput(player, clipboardStr, null, true);
if (clipboards == null) {
- player.print(Caption.of("fawe.error.schematic.not.found" , clipboardStr));
+ player.print(Caption.of("fawe.error.schematic.not.found", clipboardStr));
return;
}
List holders = clipboards.getHolders();
if (holders == null) {
- player.print(Caption.of("fawe.error.schematic.not.found" , clipboardStr));
+ player.print(Caption.of("fawe.error.schematic.not.found", clipboardStr));
return;
}
- set(context,
- new PopulateSchem(mask, holders, (int) density, rotate)).setSize(radius);
+ set(context, new PopulateSchem(mask, holders, (int) density, rotate)).setSize(radius);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
- @Command(
- name = "layer",
- desc = "Replaces terrain with a layer.",
- descFooter = "Replaces terrain with a layer.\n" +
- "Example: /br layer 5 95:1 95:2 35:15 - Places several layers on a surface\n" +
- "Pic: https://i.imgur.com/XV0vYoX.png"
- )
+ @Command(name = "layer",
+ desc = "Replaces terrain with a layer.",
+ descFooter = "Replaces terrain with a layer.\n"
+ + "Example: /br layer 5 95:1 95:2 35:15 - Places several layers on a surface\n"
+ + "Pic: https://i.imgur.com/XV0vYoX.png")
@CommandPermissions("worldedit.brush.layer")
public void surfaceLayer(InjectedValueAccess context,
- @Arg(desc = "Expression") Expression radius, List blockLayers) throws WorldEditException {
+ @Arg(desc = "Expression") Expression radius, List blockLayers)
+ throws WorldEditException {
worldEdit.checkMaxBrushRadius(radius);
set(context, new LayerBrush(blockLayers.toArray(new BlockState[0]))).setSize(radius);
}
- @Command(
- name = "splatter",
- desc = "Splatter a pattern on a surface",
- descFooter = "Sets a bunch of blocks randomly on a surface.\n" +
- "Pic: https://i.imgur.com/hMD29oO.png\n" +
- "Example: /br splatter stone,dirt 30 15\n" +
- "Note: The seeds define how many splotches there are, recursion defines how large, solid defines whether the pattern is applied per seed, else per block."
- )
+ @Command(name = "splatter",
+ desc = "Splatter a pattern on a surface",
+ descFooter = "Sets a bunch of blocks randomly on a surface.\n"
+ + "Pic: https://i.imgur.com/hMD29oO.png\n"
+ + "Example: /br splatter stone,dirt 30 15\n"
+ + "Note: The seeds define how many splotches there are, recursion defines how large, solid defines whether the pattern is applied per seed, else per block.")
@CommandPermissions("worldedit.brush.splatter")
- public void splatterBrush(InjectedValueAccess context, @Arg(desc = "Pattern") Pattern fill,
- @Arg(desc = "Expression", def = "5") Expression radius,
- @Arg(desc = "double", def = "1") double points,
- @Arg(desc = "double", def = "5") double recursion,
- @Arg(desc = "boolean", def = "true") boolean solid) throws WorldEditException {
+ public void splatterBrush(InjectedValueAccess context,
+ @Arg(desc = "Pattern") Pattern fill, @Arg(desc = "Expression",
+ def = "5") Expression radius,
+ @Arg(desc = "double",
+ def = "1") double points, @Arg(desc = "double",
+ def = "5") double recursion, @Arg(desc = "boolean",
+ def = "true")
+ boolean solid) throws WorldEditException {
worldEdit.checkMaxBrushRadius(radius);
- set(context, new SplatterBrush((int) points, (int) recursion, solid)).setSize(radius).setFill(fill);
+ set(context, new SplatterBrush((int) points, (int) recursion, solid)).setSize(radius)
+ .setFill(fill);
}
- @Command(
- name = "scattercommand",
- aliases = {"scattercmd", "scmd", "scommand"},
- desc = "Run commands at random points on a surface",
- descFooter =
- "Run commands at random points on a surface\n" +
- " - Your selection will be expanded to the specified size around each point\n" +
- " - Placeholders: {x}, {y}, {z}, {world}, {size}"
- )
+ @Command(name = "scattercommand",
+ aliases = {
+ "scattercmd",
+ "scmd",
+ "scommand"
+ },
+ desc = "Run commands at random points on a surface",
+ descFooter = "Run commands at random points on a surface\n"
+ + " - Your selection will be expanded to the specified size around each point\n"
+ + " - Placeholders: {x}, {y}, {z}, {world}, {size}")
@CommandPermissions("worldedit.brush.scattercommand")
public void scatterCommandBrush(Player player, InjectedValueAccess context,
- @Arg(desc = "The minimum distance between each point")
- Expression radius,
- @Arg(desc = "double", def = "1")
- double points,
- @Arg(desc = "double", def = "1")
- double distance,
- List commandStr) throws WorldEditException {
+ @Arg(desc = "The minimum distance between each point") Expression radius,
+ @Arg(desc = "double",
+ def = "1") double points, @Arg(desc = "double",
+ def = "1") double distance, List commandStr)
+ throws WorldEditException {
worldEdit.checkMaxBrushRadius(radius);
set(context,
new ScatterCommand((int) points, (int) distance, StringMan.join(commandStr, " ")))
- .setSize(radius);
+ .setSize(radius);
}
- @Command(
- name = "cylinder",
- aliases = { "cyl", "c" },
- desc = "Choose the cylinder brush"
- )
+ @Command(name = "cylinder",
+ aliases = {
+ "cyl",
+ "c"
+ },
+ desc = "Choose the cylinder brush")
@CommandPermissions("worldedit.brush.cylinder")
public void cylinderBrush(InjectedValueAccess context,
- @Arg(desc = "The pattern of blocks to set")
- Pattern pattern,
- @Arg(desc = "The radius of the cylinder", def = "2")
- Expression radius,
- @Arg(desc = "The height of the cylinder", def = "1")
- int height,
- @Switch(name = 'h', desc = "Create hollow cylinders instead")
- boolean hollow) throws WorldEditException {
+ @Arg(desc = "The pattern of blocks to set") Pattern pattern,
+ @Arg(desc = "The radius of the cylinder",
+ def = "2") Expression radius, @Arg(desc = "The height of the cylinder",
+ def = "1") int height, @Switch(name = 'h',
+ desc = "Create hollow cylinders instead")
+ boolean hollow) throws WorldEditException {
worldEdit.checkMaxBrushRadius(radius);
worldEdit.checkMaxBrushRadius(height);
@@ -645,29 +637,24 @@ public class BrushCommands {
settings.setSize(radius).setFill(pattern);
}
- @Command(
- name = "clipboard",
- desc = "@Deprecated use instead: `/br copypaste`)",
- descFooter = "Choose the clipboard brush.\n" +
- "Without the -p flag, the paste will appear centered at the target location. " +
- "With the flag, then the paste will appear relative to where you had " +
- "stood relative to the copied area when you copied it."
- )
+ @Command(name = "clipboard",
+ desc = "@Deprecated use instead: `/br copypaste`)",
+ descFooter = "Choose the clipboard brush.\n"
+ + "Without the -p flag, the paste will appear centered at the target location. "
+ + "With the flag, then the paste will appear relative to where you had "
+ + "stood relative to the copied area when you copied it.")
@Deprecated
@CommandPermissions("worldedit.brush.clipboard")
- public void clipboardBrush(Player player, LocalSession session,
- @Switch(name = 'a', desc = "Don't paste air from the clipboard")
- boolean ignoreAir,
- @Switch(name = 'o', desc = "Paste starting at the target location, instead of centering on it")
- boolean usingOrigin,
- @Switch(name = 'e', desc = "Paste entities if available")
- boolean pasteEntities,
- @Switch(name = 'b', desc = "Paste biomes if available")
- boolean pasteBiomes,
- @ArgFlag(name = 'm', desc = "Skip blocks matching this mask in the clipboard")
- @ClipboardMask
- Mask sourceMask,
- InjectedValueAccess context) throws WorldEditException {
+ public void clipboardBrush(Player player, LocalSession session, @Switch(name = 'a',
+ desc = "Don't paste air from the clipboard")
+ boolean ignoreAir, @Switch(name = 'o',
+ desc = "Paste starting at the target location, instead of centering on it")
+ boolean usingOrigin, @Switch(name = 'e',
+ desc = "Paste entities if available") boolean pasteEntities,
+ @Switch(name = 'b',
+ desc = "Paste biomes if available") boolean pasteBiomes, @ArgFlag(name = 'm',
+ desc = "Skip blocks matching this mask in the clipboard")
+ @ClipboardMask Mask sourceMask, InjectedValueAccess context) throws WorldEditException {
ClipboardHolder holder = session.getClipboard();
Clipboard clipboard = holder.getClipboard();
@@ -681,23 +668,20 @@ public class BrushCommands {
worldEdit.checkMaxBrushRadius(size.getBlockZ() / 2D - 1);
set(context,
- new ClipboardBrush(newHolder, ignoreAir, usingOrigin, pasteEntities, pasteBiomes, sourceMask));
+ new ClipboardBrush(newHolder, ignoreAir, usingOrigin, pasteEntities, pasteBiomes,
+ sourceMask));
}
- @Command(
- name = "smooth",
- desc = "Choose the terrain softener brush",
- descFooter = "Example: '/brush smooth 2 4 grass_block,dirt,stone'"
- )
+ @Command(name = "smooth",
+ desc = "Choose the terrain softener brush",
+ descFooter = "Example: '/brush smooth 2 4 grass_block,dirt,stone'")
@CommandPermissions("worldedit.brush.smooth")
public void smoothBrush(Player player, LocalSession session,
- @Arg(desc = "The radius to sample for softening", def = "2")
- Expression radius,
- @Arg(desc = "The number of iterations to perform", def = "4")
- int iterations,
- @Arg(desc = "The mask of blocks to use for the heightmap", def = "")
- Mask maskOpt,
- InjectedValueAccess context) throws WorldEditException {
+ @Arg(desc = "The radius to sample for softening",
+ def = "2") Expression radius, @Arg(desc = "The number of iterations to perform",
+ def = "4") int iterations,
+ @Arg(desc = "The mask of blocks to use for the heightmap",
+ def = "") Mask maskOpt, InjectedValueAccess context) throws WorldEditException {
worldEdit.checkMaxBrushRadius(radius);
FaweLimit limit = Settings.IMP.getLimit(player);
@@ -706,113 +690,129 @@ public class BrushCommands {
set(context, new SmoothBrush(iterations, maskOpt)).setSize(radius);
}
- @Command(
- name = "extinguish",
- aliases = { "ex" },
- desc = "Shortcut fire extinguisher brush"
- )
+ @Command(name = "extinguish",
+ aliases = { "ex" },
+ desc = "Shortcut fire extinguisher brush")
@CommandPermissions("worldedit.brush.ex")
public void extinguishBrush(InjectedValueAccess context, EditSession editSession,
- @Arg(desc = "The radius to extinguish", def = "5")
- Expression radius) throws WorldEditException {
+ @Arg(desc = "The radius to extinguish",
+ def = "5") Expression radius) throws WorldEditException {
worldEdit.checkMaxBrushRadius(radius);
- set(context,
- new SphereBrush())
- .setSize(radius)
- .setFill(BlockTypes.AIR.getDefaultState())
- .setMask(new SingleBlockTypeMask(editSession, BlockTypes.FIRE));
+ set(context, new SphereBrush()).setSize(radius).setFill(BlockTypes.AIR.getDefaultState())
+ .setMask(new SingleBlockTypeMask(editSession, BlockTypes.FIRE));
}
- @Command(
- name = "gravity",
- aliases = { "grav" },
- desc = "Gravity brush, simulates the effect of gravity"
- )
+ @Command(name = "gravity",
+ aliases = { "grav" },
+ desc = "Gravity brush, simulates the effect of gravity")
@CommandPermissions("worldedit.brush.gravity")
public void gravityBrush(InjectedValueAccess context,
- @Arg(desc = "The radius to apply gravity in", def = "5")
- Expression radius,
- @Switch(name = 'h', desc = "Affect blocks starting at max Y, rather than the target location Y + radius")
- boolean fromMaxY) throws WorldEditException {
+ @Arg(desc = "The radius to apply gravity in",
+ def = "5") Expression radius, @Switch(name = 'h',
+ desc = "Affect blocks starting at max Y, rather than the target location Y + radius")
+ boolean fromMaxY) throws WorldEditException {
worldEdit.checkMaxBrushRadius(radius);
set(context, new GravityBrush(fromMaxY)).setSize(radius);
}
- @Command(
- name = "height",
- aliases = {"heightmap"},
- desc = "Raise or lower terrain using a heightmap",
- descFooter = "This brush raises and lowers land.\n" +
- " - The `-r` flag enables random off-axis rotation\n" +
- " - The `-l` flag will work on snow layers\n" +
- " - The `-s` flag disables smoothing\n" +
- "Note: Use a negative yscale to reduce height\n" +
- "Snow Pic: https://i.imgur.com/Hrzn0I4.png"
- )
+ @Command(name = "height",
+ aliases = { "heightmap" },
+ desc = "Raise or lower terrain using a heightmap",
+ descFooter = "This brush raises and lowers land.\n"
+ + " - The `-r` flag enables random off-axis rotation\n"
+ + " - The `-l` flag will work on snow layers\n"
+ + " - The `-s` flag disables smoothing\n"
+ + "Note: Use a negative yscale to reduce height\n"
+ + "Snow Pic: https://i.imgur.com/Hrzn0I4.png")
@CommandPermissions("worldedit.brush.height")
- public void heightBrush(LocalSession session, @Arg(desc = "Expression", def = "5") Expression radius, @Arg(desc = "String", def = "") String image, @Arg(def = "0", desc = "rotation") @Range(from = 0, to = 360) int rotation, @Arg(desc = "double", def = "1") double yscale, @Switch(name = 'r', desc = "TODO") boolean randomRotate, @Switch(name = 'l', desc = "TODO") boolean layers, @Switch(name = 's', desc = "TODO") boolean dontSmooth, InjectedValueAccess context) throws WorldEditException, FileNotFoundException {
- terrainBrush(session, radius, image, rotation, yscale, false, randomRotate, layers, !dontSmooth, ScalableHeightMap.Shape.CONE, context);
+ public void heightBrush(LocalSession session, @Arg(desc = "Expression",
+ def = "5") Expression radius,
+ @Arg(desc = "String",
+ def = "") String image, @Arg(def = "0",
+ desc = "rotation") @Range(from = 0,
+ to = 360) int rotation,
+ @Arg(desc = "double",
+ def = "1") double yscale, @Switch(name = 'r',
+ desc = "TODO") boolean randomRotate,
+ @Switch(name = 'l',
+ desc = "TODO") boolean layers, @Switch(name = 's',
+ desc = "TODO")
+ boolean dontSmooth, InjectedValueAccess context)
+ throws WorldEditException, FileNotFoundException {
+ terrainBrush(session, radius, image, rotation, yscale, false, randomRotate, layers,
+ !dontSmooth, ScalableHeightMap.Shape.CONE, context);
}
- @Command(
- name = "cliff",
- aliases = {"flatcylinder"},
- desc = "Cliff brush",
- descFooter = "This brush flattens terrain and creates cliffs."
- )
+ @Command(name = "cliff",
+ aliases = { "flatcylinder" },
+ desc = "Cliff brush",
+ descFooter = "This brush flattens terrain and creates cliffs.")
@CommandPermissions("worldedit.brush.height")
- public void cliffBrush(LocalSession session,
- @Arg(desc = "Expression", def = "5")
- Expression radius,
- @Arg(desc = "String", def = "")
- String image,
- @Arg(def = "0", desc = "rotation") @Step(90) @Range(from = 0, to = 360)
- int rotation,
- @Arg(desc = "double", def = "1")
- double yscale,
- @Switch(name = 'r', desc = "Enables random off-axis rotation")
- boolean randomRotate,
- @Switch(name = 'l', desc = "Will work on snow layers")
- boolean layers,
- @Switch(name = 's', desc = "Disables smoothing")
- boolean dontSmooth, InjectedValueAccess context) throws WorldEditException, FileNotFoundException {
- terrainBrush(session, radius, image, rotation, yscale, true, randomRotate, layers, !dontSmooth, ScalableHeightMap.Shape.CYLINDER, context);
+ public void cliffBrush(LocalSession session, @Arg(desc = "Expression",
+ def = "5") Expression radius,
+ @Arg(desc = "String",
+ def = "") String image, @Arg(def = "0",
+ desc = "rotation") @Step(90) @Range(from = 0,
+ to = 360) int rotation,
+ @Arg(desc = "double",
+ def = "1") double yscale, @Switch(name = 'r',
+ desc = "Enables random off-axis rotation")
+ boolean randomRotate, @Switch(name = 'l',
+ desc = "Will work on snow layers") boolean layers,
+ @Switch(name = 's',
+ desc = "Disables smoothing") boolean dontSmooth, InjectedValueAccess context)
+ throws WorldEditException, FileNotFoundException {
+ terrainBrush(session, radius, image, rotation, yscale, true, randomRotate, layers,
+ !dontSmooth, ScalableHeightMap.Shape.CYLINDER, context);
}
- @Command(
- name = "flatten",
- aliases = {"flatmap", "flat"},
- desc = "This brush raises or lowers land towards the clicked point"
- )
+ @Command(name = "flatten",
+ aliases = {
+ "flatmap",
+ "flat"
+ },
+ desc = "This brush raises or lowers land towards the clicked point")
@CommandPermissions("worldedit.brush.height")
- public void flattenBrush(LocalSession session, @Arg(desc = "Expression", def = "5") Expression radius, @Arg(desc = "String", def = "") String image, @Arg(def = "0", desc = "rotation") @Step(90) @Range(from = 0, to = 360) int rotation, @Arg(desc = "double", def = "1") double yscale,
- @Switch(name = 'r', desc = "Enables random off-axis rotation")
- boolean randomRotate,
- @Switch(name = 'l', desc = "Will work on snow layers")
- boolean layers,
- @Switch(name = 's', desc = "Disables smoothing")
- boolean dontSmooth, InjectedValueAccess context) throws WorldEditException, FileNotFoundException {
- terrainBrush(session, radius, image, rotation, yscale, true, randomRotate, layers, !dontSmooth, ScalableHeightMap.Shape.CONE, context);
+ public void flattenBrush(LocalSession session, @Arg(desc = "Expression",
+ def = "5") Expression radius,
+ @Arg(desc = "String",
+ def = "") String image, @Arg(def = "0",
+ desc = "rotation") @Step(90) @Range(from = 0,
+ to = 360) int rotation,
+ @Arg(desc = "double",
+ def = "1") double yscale, @Switch(name = 'r',
+ desc = "Enables random off-axis rotation")
+ boolean randomRotate, @Switch(name = 'l',
+ desc = "Will work on snow layers") boolean layers,
+ @Switch(name = 's',
+ desc = "Disables smoothing") boolean dontSmooth, InjectedValueAccess context)
+ throws WorldEditException, FileNotFoundException {
+ terrainBrush(session, radius, image, rotation, yscale, true, randomRotate, layers,
+ !dontSmooth, ScalableHeightMap.Shape.CONE, context);
}
- private void terrainBrush(LocalSession session,
- Expression radius, String image, int rotation,
- double yscale, boolean flat, boolean randomRotate, boolean layers, boolean smooth,
- Shape shape, InjectedValueAccess context) throws WorldEditException, FileNotFoundException {
+ private void terrainBrush(LocalSession session, Expression radius, String image, int rotation, double yscale, boolean flat, boolean randomRotate, boolean layers, boolean smooth, Shape shape, InjectedValueAccess context)
+ throws WorldEditException, FileNotFoundException {
worldEdit.checkMaxBrushRadius(radius);
InputStream stream = getHeightmapStream(image);
HeightBrush brush;
if (flat) {
try {
- brush = new FlattenBrush(stream, rotation, yscale, layers, smooth, "#clipboard".equalsIgnoreCase(image) ? session.getClipboard().getClipboard() : null, shape);
+ brush = new FlattenBrush(stream, rotation, yscale, layers, smooth,
+ "#clipboard".equalsIgnoreCase(image) ?
+ session.getClipboard().getClipboard() :
+ null, shape);
} catch (EmptyClipboardException ignore) {
brush = new FlattenBrush(stream, rotation, yscale, layers, smooth, null, shape);
}
} else {
try {
- brush = new HeightBrush(stream, rotation, yscale, layers, smooth, "#clipboard".equalsIgnoreCase(image) ? session.getClipboard().getClipboard() : null);
+ brush = new HeightBrush(stream, rotation, yscale, layers, smooth,
+ "#clipboard".equalsIgnoreCase(image) ?
+ session.getClipboard().getClipboard() :
+ null);
} catch (EmptyClipboardException ignore) {
brush = new HeightBrush(stream, rotation, yscale, layers, smooth, null);
}
@@ -820,51 +820,53 @@ public class BrushCommands {
if (randomRotate) {
brush.setRandomRotate(true);
}
- set(context,
- brush)
- .setSize(radius);
+ set(context, brush).setSize(radius);
}
private InputStream getHeightmapStream(String filename) throws FileNotFoundException {
- if (filename == null) return null;
+ if (filename == null) {
+ return null;
+ }
String filenamePng = filename.endsWith(".png") ? filename : filename + ".png";
- File file = new File(Fawe.imp().getDirectory(), Settings.IMP.PATHS.HEIGHTMAP + File.separator + filenamePng);
- if (file.exists()) return new FileInputStream(file);
+ File file = new File(Fawe.imp().getDirectory(),
+ Settings.IMP.PATHS.HEIGHTMAP + File.separator + filenamePng);
+ if (file.exists()) {
+ return new FileInputStream(file);
+ }
URI uri = ImageUtil.getImageURI(filename);
return ImageUtil.getInputStream(uri);
}
- @Command(
- name = "copypaste",
- aliases = {"cp", "copypasta"},
- desc = "Copy Paste brush",
- descFooter = "Left click the base of an object to copy.\n" +
- "Right click to paste\n" +
- "Note: Works well with the clipboard scroll action\n" +
- "Video: https://www.youtube.com/watch?v=RPZIaTbqoZw"
- )
+ @Command(name = "copypaste",
+ aliases = {
+ "cp",
+ "copypasta"
+ },
+ desc = "Copy Paste brush",
+ descFooter = "Left click the base of an object to copy.\n" + "Right click to paste\n"
+ + "Note: Works well with the clipboard scroll action\n"
+ + "Video: https://www.youtube.com/watch?v=RPZIaTbqoZw")
@CommandPermissions("worldedit.brush.copy")
public void copy(Player player, LocalSession session, InjectedValueAccess context,
- @Arg(desc = "Expression", def = "5") Expression radius,
- @Switch(name = 'r', desc = "Apply random rotation on paste") boolean randomRotate,
- @Switch(name = 'a', desc = "Apply auto view based rotation on paste") boolean autoRotate) throws WorldEditException {
+ @Arg(desc = "Expression",
+ def = "5") Expression radius, @Switch(name = 'r',
+ desc = "Apply random rotation on paste")
+ boolean randomRotate, @Switch(name = 'a',
+ desc = "Apply auto view based rotation on paste")
+ boolean autoRotate) throws WorldEditException {
worldEdit.checkMaxBrushRadius(radius);
player.print(Caption.of("fawe.worldedit.brush.brush.copy", (radius)));
- set(context,
- new CopyPastaBrush(player, session, randomRotate, autoRotate))
- .setSize(radius);
+ set(context, new CopyPastaBrush(player, session, randomRotate, autoRotate)).setSize(radius);
}
- @Command(
- name = "command",
- aliases = {"cmd"},
- desc = "Command brush",
- descFooter = "Run the commands at the clicked position.\n" +
- " - Your selection will be expanded to the specified size around each point\n" +
- " - Placeholders: {x}, {y}, {z}, {world}, {size}"
- )
+ @Command(name = "command",
+ aliases = { "cmd" },
+ desc = "Command brush",
+ descFooter = "Run the commands at the clicked position.\n"
+ + " - Your selection will be expanded to the specified size around each point\n"
+ + " - Placeholders: {x}, {y}, {z}, {world}, {size}")
@CommandPermissions("worldedit.brush.command")
public void command(InjectedValueAccess context,
@Arg(desc = "Expression") Expression radius,
@@ -874,13 +876,11 @@ public class BrushCommands {
set(context, new CommandBrush(cmd)).setSize(radius);
}
- @Command(
- name = "butcher",
- aliases = { "kill" },
- desc = "Butcher brush, kills mobs within a radius"
- )
+ @Command(name = "butcher",
+ aliases = { "kill" },
+ desc = "Butcher brush, kills mobs within a radius")
@CommandPermissions("worldedit.brush.butcher")
- public void butcherBrush(Player player,
+ public void butcherBrush(Player player, LocalSession session,
@Arg(desc = "Radius to kill mobs in", def = "5")
Expression radius,
@Switch(name = 'p', desc = "Also kill pets")
@@ -898,24 +898,25 @@ public class BrushCommands {
@Switch(name = 'f', desc = "Also kill all friendly mobs (Applies the flags `-abgnpt`)")
boolean killFriendly,
@Switch(name = 'r', desc = "Also destroy armor stands")
- boolean killArmorStands,
- InjectedValueAccess context) throws WorldEditException {
+ boolean killArmorStands, InjectedValueAccess context) throws WorldEditException {
worldEdit.checkMaxBrushRadius(radius);
CreatureButcher flags = new CreatureButcher(player);
- flags.or(CreatureButcher.Flags.FRIENDLY , killFriendly); // No permission check here. Flags will instead be filtered by the subsequent calls.
- flags.or(CreatureButcher.Flags.PETS , killPets, "worldedit.butcher.pets");
- flags.or(CreatureButcher.Flags.NPCS , killNpcs, "worldedit.butcher.npcs");
- flags.or(CreatureButcher.Flags.GOLEMS , killGolems, "worldedit.butcher.golems");
- flags.or(CreatureButcher.Flags.ANIMALS , killAnimals, "worldedit.butcher.animals");
- flags.or(CreatureButcher.Flags.AMBIENT , killAmbient, "worldedit.butcher.ambient");
- flags.or(CreatureButcher.Flags.TAGGED , killWithName, "worldedit.butcher.tagged");
- flags.or(CreatureButcher.Flags.ARMOR_STAND , killArmorStands, "worldedit.butcher.armorstands");
+ flags.or(CreatureButcher.Flags.FRIENDLY, killFriendly); // No permission check here. Flags will instead be filtered by the subsequent calls.
+ flags.or(CreatureButcher.Flags.PETS, killPets, "worldedit.butcher.pets");
+ flags.or(CreatureButcher.Flags.NPCS, killNpcs, "worldedit.butcher.npcs");
+ flags.or(CreatureButcher.Flags.GOLEMS, killGolems, "worldedit.butcher.golems");
+ flags.or(CreatureButcher.Flags.ANIMALS, killAnimals, "worldedit.butcher.animals");
+ flags.or(CreatureButcher.Flags.AMBIENT, killAmbient, "worldedit.butcher.ambient");
+ flags.or(CreatureButcher.Flags.TAGGED, killWithName, "worldedit.butcher.tagged");
+ flags.or(CreatureButcher.Flags.ARMOR_STAND, killArmorStands,
+ "worldedit.butcher.armorstands");
set(context, new ButcherBrush(flags)).setSize(radius);
}
- public BrushSettings process(Player player, Arguments arguments, BrushSettings settings) throws WorldEditException {
+ public BrushSettings process(Player player, Arguments arguments, BrushSettings settings)
+ throws WorldEditException {
LocalSession session = worldEdit.getSessionManager().get(player);
session.setTool(player, null);
BrushTool tool = session.getBrushTool(player);
@@ -923,13 +924,16 @@ public class BrushCommands {
tool.setPrimary(settings);
tool.setSecondary(settings);
- player.print(Caption.of("fawe.worldedit.brush.brush.equipped" , arguments.get().split(" ")[1]));
+ player.print(
+ Caption.of("fawe.worldedit.brush.brush.equipped", arguments.get().split(" ")[1]));
}
return settings;
}
- public BrushSettings set(InjectedValueAccess context, Brush brush) throws InvalidToolBindException {
- Player player = context.injectedValue(Key.of(Player.class)).orElseThrow(() -> new IllegalStateException("No player"));
+ public BrushSettings set(InjectedValueAccess context, Brush brush)
+ throws InvalidToolBindException {
+ Player player = context.injectedValue(Key.of(Player.class))
+ .orElseThrow(() -> new IllegalStateException("No player"));
LocalSession session = player.getSession();
BrushSettings bs = new BrushSettings();
BrushTool tool = session.getBrushTool(player, false);
@@ -947,7 +951,8 @@ public class BrushCommands {
String args = arguments.get();
bs.addSetting(BrushSettings.SettingType.BRUSH, args.substring(args.indexOf(' ') + 1));
}
- CommandPermissions perms = context.injectedValue(Key.of(CommandPermissions.class)).orElse(null);
+ CommandPermissions perms =
+ context.injectedValue(Key.of(CommandPermissions.class)).orElse(null);
if (perms != null) {
bs.addPermissions(perms.value());
}
@@ -955,14 +960,14 @@ public class BrushCommands {
return process(player, arguments, bs);
}
- @Command(
- name = "savebrush",
- aliases = {"save"},
- desc = "Save your current brush"
- )
+ @Command(name = "savebrush",
+ aliases = { "save" },
+ desc = "Save your current brush")
@CommandPermissions("worldedit.brush.save")
- public void saveBrush(Player player, LocalSession session, @Arg(desc = "String name") String name,
- @Switch(name = 'g', desc = "Save the brush globally") boolean root) throws WorldEditException, IOException {
+ public void saveBrush(Player player, LocalSession session,
+ @Arg(desc = "String name") String name, @Switch(name = 'g',
+ desc = "Save the brush globally")
+ boolean root) throws WorldEditException, IOException {
BrushTool tool = session.getBrushTool(player);
if (tool != null) {
root |= name.startsWith("../");
@@ -981,70 +986,67 @@ public class BrushCommands {
}
file.createNewFile();
try (DataOutputStream out = new DataOutputStream(
- new PGZIPOutputStream(new FileOutputStream(file)))) {
+ new PGZIPOutputStream(new FileOutputStream(file)))) {
out.writeUTF(tool.toString());
} catch (Throwable e) {
e.printStackTrace();
}
- player.print(Caption.of("fawe.worldedit.schematic.schematic.saved" , name));
+ player.print(Caption.of("fawe.worldedit.schematic.schematic.saved", name));
} else {
player.printError(TranslatableComponent.of("fawe.worldedit.brush.brush.none"));
}
}
// TODO: Ping @MattBDev to reimplement 2020-02-04
-// @Command(
-// name = "loadbrush",
-// aliases = {"load"},
-// desc = "Load a brush"
-// )
-// @CommandPermissions("worldedit.brush.load")
-// public void loadBrush(Player player, LocalSession session, @Arg(desc = "String name") String name)
-// throws WorldEditException, IOException {
-// name = FileSystems.getDefault().getPath(name).getFileName().toString();
-// File folder = MainUtil.getFile(Fawe.imp().getDirectory(), "brushes");
-// name = name.endsWith(".jsgz") ? name : name + ".jsgz";
-// File file = new File(folder, player.getUniqueId() + File.separator + name);
-// if (!file.exists()) {
-// file = new File(folder, name);
-// }
-// if (!file.exists()) {
-// File[] files = folder.listFiles(pathname -> false);
-// player.print(Caption.of("fawe.error.brush.not.found" , name));
-// return;
-// }
-// try (DataInputStream in = new DataInputStream(
-// new GZIPInputStream(new FileInputStream(file)))) {
-// String json = in.readUTF();
-// BrushTool tool = BrushTool.fromString(player, session, json);
-// BaseItem item = player.getItemInHand(HandSide.MAIN_HAND);
-// session.setTool(item, tool, player);
-// player.print(Caption.of("fawe.worldedit.brush.brush.equipped" , name));
-// } catch (Throwable e) {
-// e.printStackTrace();
-// player.printError(TranslatableComponent.of("fawe.error.brush.incompatible"));
-// }
-// }
+ // @Command(
+ // name = "loadbrush",
+ // aliases = {"load"},
+ // desc = "Load a brush"
+ // )
+ // @CommandPermissions("worldedit.brush.load")
+ // public void loadBrush(Player player, LocalSession session, @Arg(desc = "String name") String name)
+ // throws WorldEditException, IOException {
+ // name = FileSystems.getDefault().getPath(name).getFileName().toString();
+ // File folder = MainUtil.getFile(Fawe.imp().getDirectory(), "brushes");
+ // name = name.endsWith(".jsgz") ? name : name + ".jsgz";
+ // File file = new File(folder, player.getUniqueId() + File.separator + name);
+ // if (!file.exists()) {
+ // file = new File(folder, name);
+ // }
+ // if (!file.exists()) {
+ // File[] files = folder.listFiles(pathname -> false);
+ // player.print(Caption.of("fawe.error.brush.not.found" , name));
+ // return;
+ // }
+ // try (DataInputStream in = new DataInputStream(
+ // new GZIPInputStream(new FileInputStream(file)))) {
+ // String json = in.readUTF();
+ // BrushTool tool = BrushTool.fromString(player, session, json);
+ // BaseItem item = player.getItemInHand(HandSide.MAIN_HAND);
+ // session.setTool(item, tool, player);
+ // player.print(Caption.of("fawe.worldedit.brush.brush.equipped" , name));
+ // } catch (Throwable e) {
+ // e.printStackTrace();
+ // player.printError(TranslatableComponent.of("fawe.error.brush.incompatible"));
+ // }
+ // }
- @Command(
- name = "/listbrush",
- desc = "List saved brushes",
- descFooter = "List all brushes in the brush directory"
- )
+ @Command(name = "/listbrush",
+ desc = "List saved brushes",
+ descFooter = "List all brushes in the brush directory")
@CommandPermissions("worldedit.brush.list")
- public void list(Actor actor, InjectedValueAccess args,
- @ArgFlag(name = 'p', desc = "Prints the requested page", def = "0")
- int page) throws WorldEditException {
+ public void list(Actor actor, InjectedValueAccess args, @ArgFlag(name = 'p',
+ desc = "Prints the requested page",
+ def = "0") int page)
+ throws WorldEditException {
String baseCmd = "/brush loadbrush";
File dir = MainUtil.getFile(Fawe.imp().getDirectory(), "brushes");
// TODO NOT IMPLEMENTED
-// UtilityCommands.list(dir, actor, args, page, null, true, baseCmd);
+ // UtilityCommands.list(dir, actor, args, page, null, true, baseCmd);
}
- static void setOperationBasedBrush(Player player, LocalSession session, Expression radius,
- Contextual extends Operation> factory,
- RegionFactory shape,
- String permission) throws WorldEditException {
+ static void setOperationBasedBrush(Player player, LocalSession session, Expression radius, Contextual extends Operation> factory, RegionFactory shape, String permission)
+ throws WorldEditException {
WorldEdit.getInstance().checkMaxBrushRadius(radius);
BrushTool tool = session.getBrushTool(player.getItemInHand(HandSide.MAIN_HAND).getType());
tool.setSize(radius);
@@ -1054,22 +1056,19 @@ public class BrushCommands {
player.print(TextComponent.of("Set brush to " + factory));
}
- @Command(
- name = "deform",
- desc = "Deform brush, applies an expression to an area"
- )
+ @Command(name = "deform",
+ desc = "Deform brush, applies an expression to an area")
@CommandPermissions("worldedit.brush.deform")
public void deform(Player player, LocalSession localSession,
- @Arg(desc = "The shape of the region")
- RegionFactory shape,
- @Arg(desc = "The size of the brush", def = "5")
- double radius,
- @Arg(desc = "Expression to apply", def = "y-=0.2")
- String expression,
- @Switch(name = 'r', desc = "Use the game's coordinate origin")
- boolean useRawCoords,
- @Switch(name = 'o', desc = "Use the placement position as the origin")
- boolean usePlacement) throws WorldEditException {
+ @Arg(desc = "The shape of the region") RegionFactory shape,
+ @Arg(desc = "The size of the brush",
+ def = "5")
+ double radius, @Arg(desc = "Expression to apply",
+ def = "y-=0.2") String expression, @Switch(name = 'r',
+ desc = "Use the game's coordinate origin")
+ boolean useRawCoords,
+ @Switch(name = 'o', desc = "Use the placement position as the origin")
+ boolean usePlacement) throws WorldEditException {
Deform deform = new Deform(expression);
if (useRawCoords) {
deform.setMode(Deform.Mode.RAW_COORD);
@@ -1087,12 +1086,12 @@ public class BrushCommands {
)
@CommandPermissions("worldedit.brush.set")
public void set(Player player, LocalSession localSession,
- @Arg(desc = "The shape of the region")
- RegionFactory shape,
- @Arg(desc = "The size of the brush", def = "5")
- Expression radius,
- @Arg(desc = "The pattern of blocks to set")
- Pattern pattern) throws WorldEditException {
+ @Arg(desc = "The shape of the region")
+ RegionFactory shape,
+ @Arg(desc = "The size of the brush", def = "5")
+ Expression radius,
+ @Arg(desc = "The pattern of blocks to set")
+ Pattern pattern) throws WorldEditException {
setOperationBasedBrush(player, localSession, radius,
new Apply(new ReplaceFactory(pattern)), shape, "worldedit.brush.set");
}
@@ -1103,14 +1102,14 @@ public class BrushCommands {
)
@CommandPermissions("worldedit.brush.forest")
public void forest(Player player, LocalSession localSession,
- @Arg(desc = "The shape of the region")
- RegionFactory shape,
- @Arg(desc = "The size of the brush", def = "5")
- Expression radius,
- @Arg(desc = "The density of the brush", def = "20")
- double density,
- @Arg(desc = "The type of tree to use")
- TreeGenerator.TreeType type) throws WorldEditException {
+ @Arg(desc = "The shape of the region")
+ RegionFactory shape,
+ @Arg(desc = "The size of the brush", def = "5")
+ Expression radius,
+ @Arg(desc = "The density of the brush", def = "20")
+ double density,
+ @Arg(desc = "The type of tree to use")
+ TreeGenerator.TreeType type) throws WorldEditException {
setOperationBasedBrush(player, localSession, radius,
new Paint(new TreeGeneratorFactory(type), density / 100), shape, "worldedit.brush.forest");
}
@@ -1138,7 +1137,7 @@ public class BrushCommands {
@Arg(desc = "The shape of the region")
RegionFactory shape,
@Arg(desc = "The size of the brush", def = "5")
- Expression radius) throws WorldEditException {
+ Expression radius) throws WorldEditException {
setOperationBasedBrush(player, localSession, radius,
new Deform("y+=1"), shape, "worldedit.brush.lower");
}
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/ChunkCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/ChunkCommands.java
index a2c1e3cd1..e483c3a2d 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/ChunkCommands.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/ChunkCommands.java
@@ -18,8 +18,6 @@
*/
package com.sk89q.worldedit.command;
-import static com.sk89q.worldedit.command.util.Logging.LogMode.REGION;
-import static com.sk89q.worldedit.internal.anvil.ChunkDeleter.DELCHUNKS_FILE_NAME;
import com.google.gson.JsonIOException;
import com.sk89q.worldedit.LocalSession;
@@ -37,7 +35,6 @@ import com.sk89q.worldedit.regions.CuboidRegion;
import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.util.formatting.component.PaginationBox;
-import com.sk89q.worldedit.command.util.WorldEditAsyncCommandBuilder;
import com.sk89q.worldedit.util.formatting.text.Component;
import com.sk89q.worldedit.util.formatting.text.TextComponent;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
@@ -46,21 +43,23 @@ import com.sk89q.worldedit.util.formatting.text.format.TextColor;
import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.storage.LegacyChunkStore;
import com.sk89q.worldedit.world.storage.McRegionChunkStore;
-import java.io.IOException;
-import java.nio.file.Files;
-
-import java.io.File;
-import java.nio.file.Path;
-import java.time.ZonedDateTime;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
import org.enginehub.piston.annotation.Command;
import org.enginehub.piston.annotation.CommandContainer;
import org.enginehub.piston.annotation.param.ArgFlag;
import org.enginehub.piston.exception.StopExecutionException;
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.time.ZonedDateTime;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
import static com.google.common.base.Preconditions.checkNotNull;
+import static com.sk89q.worldedit.command.util.Logging.LogMode.REGION;
+import static com.sk89q.worldedit.internal.anvil.ChunkDeleter.DELCHUNKS_FILE_NAME;
/**
* Commands for working with chunks.
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/ExpandCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/ExpandCommands.java
index 6cfd12ef4..ac4d280e5 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/ExpandCommands.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/ExpandCommands.java
@@ -25,7 +25,6 @@ import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.command.util.Logging;
import com.sk89q.worldedit.command.util.PermissionCondition;
-import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.internal.annotation.Direction;
import com.sk89q.worldedit.internal.annotation.MultiDirection;
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/FlattenedClipboardTransform.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/FlattenedClipboardTransform.java
index d21acec38..d1288429d 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/FlattenedClipboardTransform.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/FlattenedClipboardTransform.java
@@ -19,8 +19,6 @@
package com.sk89q.worldedit.command;
-import static com.google.common.base.Preconditions.checkNotNull;
-
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.extent.clipboard.Clipboard;
import com.sk89q.worldedit.extent.transform.BlockTransformExtent;
@@ -33,6 +31,8 @@ import com.sk89q.worldedit.math.transform.Transform;
import com.sk89q.worldedit.regions.CuboidRegion;
import com.sk89q.worldedit.regions.Region;
+import static com.google.common.base.Preconditions.checkNotNull;
+
/**
* Helper class to 'bake' a transform into a clipboard.
*
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/GeneralCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/GeneralCommands.java
index 923add56e..d159caae4 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/GeneralCommands.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/GeneralCommands.java
@@ -19,11 +19,8 @@
package com.sk89q.worldedit.command;
-import static com.google.common.base.Preconditions.checkNotNull;
-
import com.boydti.fawe.Fawe;
import com.boydti.fawe.config.Caption;
-import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.boydti.fawe.object.extent.ResettableExtent;
import com.boydti.fawe.util.CachedTextureUtil;
import com.boydti.fawe.util.CleanTextureUtil;
@@ -44,10 +41,8 @@ import com.sk89q.worldedit.extension.input.DisallowedUsageException;
import com.sk89q.worldedit.extension.input.InputParseException;
import com.sk89q.worldedit.extension.input.ParserContext;
import com.sk89q.worldedit.extension.platform.Actor;
-
-import java.util.ArrayList;
-import com.sk89q.worldedit.extent.clipboard.Clipboard;
import com.sk89q.worldedit.extension.platform.Capability;
+import com.sk89q.worldedit.extent.clipboard.Clipboard;
import com.sk89q.worldedit.function.mask.Mask;
import com.sk89q.worldedit.util.SideEffect;
import com.sk89q.worldedit.util.SideEffectSet;
@@ -55,21 +50,26 @@ import com.sk89q.worldedit.util.formatting.component.PaginationBox;
import com.sk89q.worldedit.util.formatting.component.SideEffectBox;
import com.sk89q.worldedit.util.formatting.text.Component;
import com.sk89q.worldedit.util.formatting.text.TextComponent;
+import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.item.ItemType;
-import java.io.FileNotFoundException;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-import java.util.TreeMap;
-import java.util.concurrent.Callable;
import org.enginehub.piston.annotation.Command;
import org.enginehub.piston.annotation.CommandContainer;
import org.enginehub.piston.annotation.param.Arg;
import org.enginehub.piston.annotation.param.ArgFlag;
import org.enginehub.piston.annotation.param.Switch;
+import java.io.FileNotFoundException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.TreeMap;
+import java.util.concurrent.Callable;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
/**
* General WorldEdit commands.
*/
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/GenerationCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/GenerationCommands.java
index e78809bf6..5d193caa2 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/GenerationCommands.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/GenerationCommands.java
@@ -18,16 +18,10 @@
*/
package com.sk89q.worldedit.command;
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.sk89q.worldedit.command.util.Logging.LogMode.ALL;
-import static com.sk89q.worldedit.command.util.Logging.LogMode.PLACEMENT;
-import static com.sk89q.worldedit.command.util.Logging.LogMode.POSITION;
-import static com.sk89q.worldedit.internal.command.CommandUtil.checkCommandArgument;
import com.boydti.fawe.Fawe;
import com.boydti.fawe.config.Caption;
import com.boydti.fawe.util.MainUtil;
-import com.boydti.fawe.util.MathMan;
import com.boydti.fawe.util.TextureUtil;
import com.boydti.fawe.util.image.ImageUtil;
import com.sk89q.worldedit.EditSession;
@@ -58,17 +52,24 @@ import com.sk89q.worldedit.util.formatting.text.TextComponent;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.block.BlockType;
-import java.awt.RenderingHints;
-import java.awt.image.BufferedImage;
-import java.io.IOException;
-import java.net.URL;
-import java.util.List;
import org.enginehub.piston.annotation.Command;
import org.enginehub.piston.annotation.CommandContainer;
import org.enginehub.piston.annotation.param.Arg;
import org.enginehub.piston.annotation.param.Switch;
import org.jetbrains.annotations.Range;
+import java.awt.RenderingHints;
+import java.awt.image.BufferedImage;
+import java.io.IOException;
+import java.net.URL;
+import java.util.List;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static com.sk89q.worldedit.command.util.Logging.LogMode.ALL;
+import static com.sk89q.worldedit.command.util.Logging.LogMode.PLACEMENT;
+import static com.sk89q.worldedit.command.util.Logging.LogMode.POSITION;
+import static com.sk89q.worldedit.internal.command.CommandUtil.checkCommandArgument;
+
/**
* Commands for the generation of shapes and other objects.
*/
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/HistorySubCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/HistorySubCommands.java
index 1e27040f9..4428615d7 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/HistorySubCommands.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/HistorySubCommands.java
@@ -1,7 +1,5 @@
package com.sk89q.worldedit.command;
-import static com.sk89q.worldedit.internal.command.CommandUtil.checkCommandArgument;
-
import com.boydti.fawe.Fawe;
import com.boydti.fawe.FaweAPI;
import com.boydti.fawe.config.Caption;
@@ -23,7 +21,6 @@ import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator;
import com.sk89q.worldedit.command.util.annotation.Confirm;
import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.extension.platform.Actor;
-import com.sk89q.worldedit.history.change.Change;
import com.sk89q.worldedit.history.changeset.ChangeSet;
import com.sk89q.worldedit.internal.annotation.AllowedRegion;
import com.sk89q.worldedit.internal.annotation.Time;
@@ -43,6 +40,14 @@ import com.sk89q.worldedit.util.formatting.text.event.ClickEvent;
import com.sk89q.worldedit.util.formatting.text.event.HoverEvent;
import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.block.BlockState;
+import org.enginehub.piston.annotation.Command;
+import org.enginehub.piston.annotation.CommandContainer;
+import org.enginehub.piston.annotation.param.Arg;
+import org.enginehub.piston.annotation.param.ArgFlag;
+import org.enginehub.piston.annotation.param.Switch;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Range;
+
import java.io.File;
import java.lang.ref.Reference;
import java.lang.ref.SoftReference;
@@ -52,13 +57,8 @@ import java.util.UUID;
import java.util.concurrent.ExecutionException;
import java.util.function.Supplier;
import javax.annotation.Nullable;
-import org.enginehub.piston.annotation.Command;
-import org.enginehub.piston.annotation.CommandContainer;
-import org.enginehub.piston.annotation.param.Arg;
-import org.enginehub.piston.annotation.param.ArgFlag;
-import org.enginehub.piston.annotation.param.Switch;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Range;
+
+import static com.sk89q.worldedit.internal.command.CommandUtil.checkCommandArgument;
@CommandContainer(superTypes = CommandPermissionsConditionGenerator.Registration.class)
public class HistorySubCommands {
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/ListFilters.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/ListFilters.java
index 2b390d2fa..6d26d5446 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/ListFilters.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/ListFilters.java
@@ -4,13 +4,14 @@ import com.boydti.fawe.Fawe;
import com.boydti.fawe.util.StringMan;
import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.util.formatting.text.TextComponent;
+import org.enginehub.piston.annotation.Command;
+import org.enginehub.piston.exception.StopExecutionException;
+
import java.io.File;
import java.util.Locale;
import java.util.UUID;
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;
-import org.enginehub.piston.annotation.Command;
-import org.enginehub.piston.exception.StopExecutionException;
//TODO This class breaks compilation
//@CommandContainer
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/MethodCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/MethodCommands.java
index a3aa3b47b..e86f42ea8 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/MethodCommands.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/MethodCommands.java
@@ -1,10 +1,11 @@
package com.sk89q.worldedit.command;
import com.sk89q.worldedit.command.argument.Arguments;
-import java.util.Optional;
import org.enginehub.piston.inject.InjectedValueAccess;
import org.enginehub.piston.inject.Key;
+import java.util.Optional;
+
public class MethodCommands {
public static String getArguments(InjectedValueAccess context) {
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/NavigationCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/NavigationCommands.java
index 98c1a4523..965f0b53c 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/NavigationCommands.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/NavigationCommands.java
@@ -18,9 +18,7 @@
*/
package com.sk89q.worldedit.command;
-import static com.sk89q.worldedit.command.util.Logging.LogMode.POSITION;
-import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.sk89q.worldedit.LocalConfiguration;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.WorldEditException;
@@ -30,12 +28,14 @@ import com.sk89q.worldedit.command.util.Logging;
import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.util.formatting.text.TextComponent;
+import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import org.enginehub.piston.annotation.Command;
import org.enginehub.piston.annotation.CommandContainer;
import org.enginehub.piston.annotation.param.Arg;
import org.enginehub.piston.annotation.param.Switch;
import static com.google.common.base.Preconditions.checkNotNull;
+import static com.sk89q.worldedit.command.util.Logging.LogMode.POSITION;
/**
* Commands for moving the player around.
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/PaintBrushCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/PaintBrushCommands.java
index d381594b2..a7f0942de 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/PaintBrushCommands.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/PaintBrushCommands.java
@@ -19,9 +19,6 @@
package com.sk89q.worldedit.command;
-import static java.util.Objects.requireNonNull;
-import static org.enginehub.piston.part.CommandParts.arg;
-
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.sk89q.worldedit.LocalSession;
@@ -46,7 +43,6 @@ import com.sk89q.worldedit.util.formatting.text.TextComponent;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
import com.sk89q.worldedit.util.formatting.text.format.TextDecoration;
-import java.util.stream.Collectors;
import org.enginehub.piston.CommandManager;
import org.enginehub.piston.CommandManagerService;
import org.enginehub.piston.CommandParameters;
@@ -57,6 +53,11 @@ import org.enginehub.piston.inject.Key;
import org.enginehub.piston.part.CommandArgument;
import org.enginehub.piston.part.SubCommandPart;
+import java.util.stream.Collectors;
+
+import static java.util.Objects.requireNonNull;
+import static org.enginehub.piston.part.CommandParts.arg;
+
@CommandContainer(superTypes = CommandPermissionsConditionGenerator.Registration.class)
public class PaintBrushCommands {
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/RegionCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/RegionCommands.java
index 0e6b19089..42a341fd0 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/RegionCommands.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/RegionCommands.java
@@ -19,14 +19,6 @@
package com.sk89q.worldedit.command;
-import static com.sk89q.worldedit.command.util.Logging.LogMode.ALL;
-import static com.sk89q.worldedit.command.util.Logging.LogMode.ORIENTATION_REGION;
-import static com.sk89q.worldedit.command.util.Logging.LogMode.REGION;
-import static com.sk89q.worldedit.internal.command.CommandUtil.checkCommandArgument;
-import static com.sk89q.worldedit.regions.Regions.asFlatRegion;
-import static com.sk89q.worldedit.regions.Regions.maximumBlockY;
-import static com.sk89q.worldedit.regions.Regions.minimumBlockY;
-
import com.boydti.fawe.FaweAPI;
import com.boydti.fawe.FaweCache;
import com.boydti.fawe.config.Caption;
@@ -74,15 +66,23 @@ import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.block.BlockTypes;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
import org.enginehub.piston.annotation.Command;
import org.enginehub.piston.annotation.CommandContainer;
import org.enginehub.piston.annotation.param.Arg;
import org.enginehub.piston.annotation.param.ArgFlag;
import org.enginehub.piston.annotation.param.Switch;
-import org.jetbrains.annotations.Range;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import static com.sk89q.worldedit.command.util.Logging.LogMode.ALL;
+import static com.sk89q.worldedit.command.util.Logging.LogMode.ORIENTATION_REGION;
+import static com.sk89q.worldedit.command.util.Logging.LogMode.REGION;
+import static com.sk89q.worldedit.internal.command.CommandUtil.checkCommandArgument;
+import static com.sk89q.worldedit.regions.Regions.asFlatRegion;
+import static com.sk89q.worldedit.regions.Regions.maximumBlockY;
+import static com.sk89q.worldedit.regions.Regions.minimumBlockY;
/**
* Commands that operate on regions.
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/SchematicCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/SchematicCommands.java
index 17f1e22b0..95f81c213 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/SchematicCommands.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/SchematicCommands.java
@@ -19,17 +19,12 @@
package com.sk89q.worldedit.command;
-import static com.boydti.fawe.util.ReflectionUtils.as;
-import static com.google.common.base.Preconditions.checkNotNull;
-
import com.boydti.fawe.config.Caption;
-import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.boydti.fawe.config.Settings;
import com.boydti.fawe.object.clipboard.MultiClipboardHolder;
import com.boydti.fawe.object.clipboard.URIClipboardHolder;
import com.boydti.fawe.object.schematic.MinecraftStructure;
import com.boydti.fawe.util.MainUtil;
-import com.boydti.fawe.util.MathMan;
import com.google.common.base.Function;
import com.google.common.collect.Multimap;
import com.sk89q.worldedit.LocalConfiguration;
@@ -57,11 +52,21 @@ import com.sk89q.worldedit.util.formatting.component.PaginationBox;
import com.sk89q.worldedit.util.formatting.component.TextComponentProducer;
import com.sk89q.worldedit.util.formatting.text.Component;
import com.sk89q.worldedit.util.formatting.text.TextComponent;
+import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.sk89q.worldedit.util.formatting.text.event.ClickEvent;
import com.sk89q.worldedit.util.formatting.text.event.HoverEvent;
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
import com.sk89q.worldedit.util.io.Closer;
import com.sk89q.worldedit.util.io.file.FilenameException;
+import org.enginehub.piston.annotation.Command;
+import org.enginehub.piston.annotation.CommandContainer;
+import org.enginehub.piston.annotation.param.Arg;
+import org.enginehub.piston.annotation.param.ArgFlag;
+import org.enginehub.piston.annotation.param.Switch;
+import org.enginehub.piston.exception.StopExecutionException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
@@ -69,8 +74,6 @@ import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
-
-import static com.google.common.base.Preconditions.checkArgument;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
@@ -86,14 +89,10 @@ import java.util.Map;
import java.util.UUID;
import java.util.concurrent.Callable;
import java.util.regex.Pattern;
-import org.enginehub.piston.annotation.Command;
-import org.enginehub.piston.annotation.CommandContainer;
-import org.enginehub.piston.annotation.param.Arg;
-import org.enginehub.piston.annotation.param.ArgFlag;
-import org.enginehub.piston.annotation.param.Switch;
-import org.enginehub.piston.exception.StopExecutionException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+
+import static com.boydti.fawe.util.ReflectionUtils.as;
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkNotNull;
//import com.boydti.fawe.object.schematic.visualizer.SchemVis;
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/ScriptingCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/ScriptingCommands.java
index 1c1499d22..64df0431e 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/ScriptingCommands.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/ScriptingCommands.java
@@ -18,9 +18,7 @@
*/
package com.sk89q.worldedit.command;
-import static com.sk89q.worldedit.command.util.Logging.LogMode.ALL;
-import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.WorldEditException;
@@ -28,15 +26,17 @@ import com.sk89q.worldedit.command.util.CommandPermissions;
import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator;
import com.sk89q.worldedit.command.util.Logging;
import com.sk89q.worldedit.entity.Player;
-
-import java.io.File;
-import java.util.List;
-import java.util.stream.Stream;
+import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import org.enginehub.piston.annotation.Command;
import org.enginehub.piston.annotation.CommandContainer;
import org.enginehub.piston.annotation.param.Arg;
+import java.io.File;
+import java.util.List;
+import java.util.stream.Stream;
+
import static com.google.common.base.Preconditions.checkNotNull;
+import static com.sk89q.worldedit.command.util.Logging.LogMode.ALL;
/**
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/SelectionCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/SelectionCommands.java
index 12a5fce77..0850a6f38 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/SelectionCommands.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/SelectionCommands.java
@@ -19,9 +19,6 @@
package com.sk89q.worldedit.command;
-import static com.sk89q.worldedit.command.util.Logging.LogMode.POSITION;
-import static com.sk89q.worldedit.command.util.Logging.LogMode.REGION;
-
import com.boydti.fawe.config.Caption;
import com.boydti.fawe.object.clipboard.URIClipboardHolder;
import com.boydti.fawe.object.mask.IdMask;
@@ -43,7 +40,6 @@ import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.extension.platform.Locatable;
import com.sk89q.worldedit.extension.platform.permission.ActorSelectorLimits;
-import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.extent.clipboard.Clipboard;
import com.sk89q.worldedit.function.block.BlockDistributionCounter;
import com.sk89q.worldedit.function.mask.Mask;
@@ -84,11 +80,6 @@ import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.item.ItemType;
import com.sk89q.worldedit.world.item.ItemTypes;
import com.sk89q.worldedit.world.storage.ChunkStore;
-import java.io.File;
-import java.net.URI;
-import java.util.List;
-import java.util.Optional;
-import java.util.stream.Stream;
import org.enginehub.piston.annotation.Command;
import org.enginehub.piston.annotation.CommandContainer;
import org.enginehub.piston.annotation.param.Arg;
@@ -96,6 +87,15 @@ import org.enginehub.piston.annotation.param.ArgFlag;
import org.enginehub.piston.annotation.param.Switch;
import org.enginehub.piston.exception.StopExecutionException;
+import java.io.File;
+import java.net.URI;
+import java.util.List;
+import java.util.Optional;
+import java.util.stream.Stream;
+
+import static com.sk89q.worldedit.command.util.Logging.LogMode.POSITION;
+import static com.sk89q.worldedit.command.util.Logging.LogMode.REGION;
+
/**
* Selection commands.
*/
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/SuperPickaxeCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/SuperPickaxeCommands.java
index d62905123..e0e5a1ff6 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/SuperPickaxeCommands.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/SuperPickaxeCommands.java
@@ -19,7 +19,6 @@
package com.sk89q.worldedit.command;
-import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.sk89q.worldedit.LocalConfiguration;
import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.WorldEdit;
@@ -31,6 +30,7 @@ import com.sk89q.worldedit.command.util.CommandPermissions;
import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator;
import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.util.formatting.text.TextComponent;
+import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import org.enginehub.piston.annotation.Command;
import org.enginehub.piston.annotation.CommandContainer;
import org.enginehub.piston.annotation.param.Arg;
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/ToolCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/ToolCommands.java
index 33d15e4fd..942684422 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/ToolCommands.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/ToolCommands.java
@@ -19,20 +19,18 @@
package com.sk89q.worldedit.command;
-import com.google.common.collect.Collections2;
-
-import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.boydti.fawe.object.brush.InspectBrush;
+import com.google.common.collect.Collections2;
import com.sk89q.worldedit.LocalConfiguration;
import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.command.tool.BlockDataCyler;
import com.sk89q.worldedit.command.tool.BlockReplacer;
-import com.sk89q.worldedit.command.tool.InvalidToolBindException;
import com.sk89q.worldedit.command.tool.DistanceWand;
import com.sk89q.worldedit.command.tool.FloatingTreeRemover;
import com.sk89q.worldedit.command.tool.FloodFillTool;
+import com.sk89q.worldedit.command.tool.InvalidToolBindException;
import com.sk89q.worldedit.command.tool.LongRangeBuildTool;
import com.sk89q.worldedit.command.tool.NavigationWand;
import com.sk89q.worldedit.command.tool.QueryTool;
@@ -42,20 +40,21 @@ import com.sk89q.worldedit.command.util.CommandPermissions;
import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator;
import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.function.pattern.Pattern;
-import com.sk89q.worldedit.util.HandSide;
-import com.sk89q.worldedit.util.TreeGenerator;
-import com.sk89q.worldedit.world.item.ItemType;
-import org.enginehub.piston.annotation.Command;
import com.sk89q.worldedit.internal.command.CommandRegistrationHandler;
import com.sk89q.worldedit.internal.command.CommandUtil;
-import org.enginehub.piston.annotation.CommandContainer;
-import org.enginehub.piston.annotation.param.Arg;
+import com.sk89q.worldedit.util.HandSide;
+import com.sk89q.worldedit.util.TreeGenerator;
import com.sk89q.worldedit.util.formatting.text.TextComponent;
+import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.sk89q.worldedit.world.block.BlockStateHolder;
+import com.sk89q.worldedit.world.item.ItemType;
import org.enginehub.piston.CommandManager;
import org.enginehub.piston.CommandManagerService;
import org.enginehub.piston.CommandMetadata;
import org.enginehub.piston.CommandParameters;
+import org.enginehub.piston.annotation.Command;
+import org.enginehub.piston.annotation.CommandContainer;
+import org.enginehub.piston.annotation.param.Arg;
import org.enginehub.piston.part.SubCommandPart;
import java.util.Optional;
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/ToolUtilCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/ToolUtilCommands.java
index 62295f8d7..ee2301609 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/ToolUtilCommands.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/ToolUtilCommands.java
@@ -20,12 +20,10 @@
package com.sk89q.worldedit.command;
import com.boydti.fawe.config.Caption;
-import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.boydti.fawe.object.brush.BrushSettings;
import com.boydti.fawe.object.brush.TargetMode;
import com.boydti.fawe.object.brush.scroll.Scroll;
import com.boydti.fawe.object.brush.visualization.VisualMode;
-import com.boydti.fawe.object.extent.ResettableExtent;
import com.boydti.fawe.util.MathMan;
import com.boydti.fawe.util.StringMan;
import com.google.common.collect.Iterables;
@@ -45,6 +43,7 @@ import com.sk89q.worldedit.function.mask.Mask;
import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.internal.command.CommandArgParser;
import com.sk89q.worldedit.util.HandSide;
+import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import org.enginehub.piston.annotation.Command;
import org.enginehub.piston.annotation.CommandContainer;
import org.enginehub.piston.annotation.param.Arg;
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/UtilityCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/UtilityCommands.java
index b320dc300..dcfd82663 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/UtilityCommands.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/UtilityCommands.java
@@ -19,18 +19,14 @@
package com.sk89q.worldedit.command;
-import static com.sk89q.worldedit.command.util.Logging.LogMode.PLACEMENT;
-
import com.boydti.fawe.Fawe;
import com.boydti.fawe.config.Caption;
-import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.boydti.fawe.config.Settings;
import com.boydti.fawe.object.DelegateConsumer;
import com.boydti.fawe.object.function.QuadFunction;
import com.boydti.fawe.util.MainUtil;
import com.boydti.fawe.util.image.ImageUtil;
import com.google.common.base.Function;
-import com.google.common.collect.Lists;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.IncompleteRegionException;
import com.sk89q.worldedit.LocalConfiguration;
@@ -44,25 +40,23 @@ import com.sk89q.worldedit.command.util.CreatureButcher;
import com.sk89q.worldedit.command.util.EntityRemover;
import com.sk89q.worldedit.command.util.Logging;
import com.sk89q.worldedit.command.util.PrintCommandHelp;
+import com.sk89q.worldedit.command.util.WorldEditAsyncCommandBuilder;
import com.sk89q.worldedit.entity.Entity;
import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat;
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats;
import com.sk89q.worldedit.function.EntityFunction;
+import com.sk89q.worldedit.function.mask.BlockTypeMask;
import com.sk89q.worldedit.function.mask.ExistingBlockMask;
import com.sk89q.worldedit.function.mask.Mask;
-import com.sk89q.worldedit.command.util.WorldEditAsyncCommandBuilder;
import com.sk89q.worldedit.function.operation.Operations;
import com.sk89q.worldedit.function.pattern.Pattern;
-import com.sk89q.worldedit.function.mask.BlockTypeMask;
import com.sk89q.worldedit.function.visitor.EntityVisitor;
import com.sk89q.worldedit.internal.annotation.Direction;
import com.sk89q.worldedit.internal.expression.EvaluationException;
import com.sk89q.worldedit.internal.expression.Expression;
import com.sk89q.worldedit.internal.expression.ExpressionException;
-
-import java.text.DecimalFormat;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.CuboidRegion;
import com.sk89q.worldedit.regions.CylinderRegion;
@@ -70,17 +64,25 @@ import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.util.formatting.component.SubtleFormat;
import com.sk89q.worldedit.util.formatting.text.Component;
import com.sk89q.worldedit.util.formatting.text.TextComponent;
+import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.block.BlockTypes;
+import org.enginehub.piston.annotation.Command;
+import org.enginehub.piston.annotation.CommandContainer;
+import org.enginehub.piston.annotation.param.Arg;
+import org.enginehub.piston.annotation.param.ArgFlag;
+import org.enginehub.piston.annotation.param.Switch;
+import org.enginehub.piston.exception.StopExecutionException;
+
import java.awt.RenderingHints;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.net.URI;
import java.nio.file.Files;
+import java.text.DecimalFormat;
import java.text.NumberFormat;
-import java.util.AbstractMap;
import java.util.AbstractMap.SimpleEntry;
import java.util.ArrayList;
import java.util.Collections;
@@ -93,13 +95,8 @@ import java.util.function.Consumer;
import java.util.function.Supplier;
import java.util.stream.Collectors;
import javax.imageio.ImageIO;
-import org.enginehub.piston.annotation.Command;
-import org.enginehub.piston.annotation.CommandContainer;
-import org.enginehub.piston.annotation.param.Arg;
-import org.enginehub.piston.annotation.param.ArgFlag;
-import org.enginehub.piston.annotation.param.Switch;
-import org.enginehub.piston.exception.StopExecutionException;
-import org.jetbrains.annotations.Range;
+
+import static com.sk89q.worldedit.command.util.Logging.LogMode.PLACEMENT;
/**
* Utility commands.
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/WorldEditCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/WorldEditCommands.java
index 3287fad18..1d221846f 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/WorldEditCommands.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/WorldEditCommands.java
@@ -21,8 +21,6 @@ package com.sk89q.worldedit.command;
import com.boydti.fawe.Fawe;
import com.boydti.fawe.FaweVersion;
-import com.sk89q.worldedit.util.formatting.text.Component;
-import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.boydti.fawe.config.Settings;
import com.boydti.fawe.util.IncendoPaster;
import com.sk89q.worldedit.LocalSession;
@@ -37,11 +35,18 @@ import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.extension.platform.Capability;
import com.sk89q.worldedit.extension.platform.Platform;
import com.sk89q.worldedit.extension.platform.PlatformManager;
+import com.sk89q.worldedit.util.formatting.component.MessageBox;
+import com.sk89q.worldedit.util.formatting.component.TextComponentProducer;
+import com.sk89q.worldedit.util.formatting.text.TextComponent;
+import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.sk89q.worldedit.util.formatting.text.event.ClickEvent;
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
-import com.sk89q.worldedit.util.formatting.text.TextComponent;
-import com.sk89q.worldedit.util.formatting.component.TextComponentProducer;
-import com.sk89q.worldedit.util.formatting.component.MessageBox;
+import org.enginehub.piston.annotation.Command;
+import org.enginehub.piston.annotation.CommandContainer;
+import org.enginehub.piston.annotation.param.Arg;
+import org.enginehub.piston.annotation.param.ArgFlag;
+import org.enginehub.piston.annotation.param.Switch;
+
import java.io.IOException;
import java.time.ZoneId;
import java.time.ZonedDateTime;
@@ -52,11 +57,6 @@ import java.util.Date;
import java.util.GregorianCalendar;
import java.util.List;
import java.util.Map;
-import org.enginehub.piston.annotation.Command;
-import org.enginehub.piston.annotation.CommandContainer;
-import org.enginehub.piston.annotation.param.Arg;
-import org.enginehub.piston.annotation.param.ArgFlag;
-import org.enginehub.piston.annotation.param.Switch;
@CommandContainer(superTypes = {CommandPermissionsConditionGenerator.Registration.class})
public class WorldEditCommands {
@@ -77,7 +77,7 @@ public class WorldEditCommands {
public void version(Actor actor) {
FaweVersion fVer = Fawe.get().getVersion();
String fVerStr = fVer == null ? "unknown" : "-" + fVer.build;
- actor.print(TextComponent.of("FastAsyncWorldEdit" + fVerStr + " created by Empire92"));
+ actor.print(TextComponent.of("FastAsyncWorldEdit" + fVerStr + " created by Empire92, MattBDev, IronApollo, dordsor21 and NotMyFault"));
if (fVer != null) {
FaweVersion version = Fawe.get().getVersion();
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/AbstractDirectionConverter.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/AbstractDirectionConverter.java
index c8342b038..8268a9f90 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/AbstractDirectionConverter.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/AbstractDirectionConverter.java
@@ -38,8 +38,8 @@ import org.enginehub.piston.converter.SuccessfulConversion;
import org.enginehub.piston.inject.InjectedValueAccess;
import org.enginehub.piston.inject.Key;
-import javax.annotation.Nullable;
import java.util.List;
+import javax.annotation.Nullable;
import static org.enginehub.piston.converter.SuggestionHelper.limitByPrefix;
@@ -56,7 +56,7 @@ public abstract class AbstractDirectionConverter implements ArgumentConverter
}
protected static void register(CommandManager commandManager, AbstractDirectionConverter converter,
- Class keyClass, boolean includeDiagonals) {
+ Class keyClass, boolean includeDiagonals) {
commandManager.registerConverter(
Key.of(keyClass, direction(includeDiagonals)),
converter
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/Chunk3dVectorConverter.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/Chunk3dVectorConverter.java
index bae5ea472..73bbe418c 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/Chunk3dVectorConverter.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/Chunk3dVectorConverter.java
@@ -51,6 +51,8 @@ public class Chunk3dVectorConverter implements ArgumentConverter {
return BlockVector3.at(cmps.get(0), 0, cmps.get(1));
case 3:
return BlockVector3.at(cmps.get(0), cmps.get(1), cmps.get(2));
+ default:
+ break;
}
throw new AssertionError("Expected 2 or 3 components");
},
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/DirectionConverter.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/DirectionConverter.java
index d83bc51c6..30dd95eb7 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/DirectionConverter.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/DirectionConverter.java
@@ -26,8 +26,8 @@ import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.util.Direction;
import org.enginehub.piston.CommandManager;
-import javax.annotation.Nullable;
import java.util.Optional;
+import javax.annotation.Nullable;
public final class DirectionConverter extends AbstractDirectionConverter {
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/EnumConverter.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/EnumConverter.java
index f0f8e8ddd..116d84d77 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/EnumConverter.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/EnumConverter.java
@@ -30,12 +30,11 @@ import org.enginehub.piston.converter.ArgumentConverter;
import org.enginehub.piston.converter.MultiKeyConverter;
import org.enginehub.piston.inject.Key;
-import javax.annotation.Nullable;
-
import java.util.EnumSet;
import java.util.Locale;
import java.util.Set;
import java.util.function.Function;
+import javax.annotation.Nullable;
public final class EnumConverter {
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/FactoryConverter.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/FactoryConverter.java
index e505b86a8..ae00d0b45 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/FactoryConverter.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/FactoryConverter.java
@@ -23,7 +23,6 @@ import com.sk89q.worldedit.EmptyClipboardException;
import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.blocks.BaseItem;
-import com.sk89q.worldedit.entity.Entity;
import com.sk89q.worldedit.extension.input.InputParseException;
import com.sk89q.worldedit.extension.input.ParserContext;
import com.sk89q.worldedit.extension.platform.Actor;
@@ -48,10 +47,10 @@ import org.enginehub.piston.converter.SuccessfulConversion;
import org.enginehub.piston.inject.InjectedValueAccess;
import org.enginehub.piston.inject.Key;
-import javax.annotation.Nullable;
import java.util.List;
import java.util.function.Consumer;
import java.util.function.Function;
+import javax.annotation.Nullable;
public class FactoryConverter implements ArgumentConverter {
@@ -64,22 +63,22 @@ public class FactoryConverter implements ArgumentConverter {
new FactoryConverter<>(worldEdit, WorldEdit::getItemFactory, "item", null));
commandManager.registerConverter(Key.of(Mask.class, ClipboardMask.class),
- new FactoryConverter<>(worldEdit, WorldEdit::getMaskFactory, "mask",
- context -> {
- try {
- ClipboardHolder holder = context.getSession().getClipboard();
- Transform transform = holder.getTransform();
- Extent target;
- if (transform.isIdentity()) {
- target = holder.getClipboard();
- } else {
- target = new BlockTransformExtent(holder.getClipboard(), transform);
- }
- context.setExtent(target);
- } catch (EmptyClipboardException e) {
- throw new IllegalStateException(e);
- }
- }));
+ new FactoryConverter<>(worldEdit, WorldEdit::getMaskFactory, "mask",
+ context -> {
+ try {
+ ClipboardHolder holder = context.getSession().getClipboard();
+ Transform transform = holder.getTransform();
+ Extent target;
+ if (transform.isIdentity()) {
+ target = holder.getClipboard();
+ } else {
+ target = new BlockTransformExtent(holder.getClipboard(), transform);
+ }
+ context.setExtent(target);
+ } catch (EmptyClipboardException e) {
+ throw new IllegalStateException(e);
+ }
+ }));
}
private final WorldEdit worldEdit;
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/RegistryConverter.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/RegistryConverter.java
index 085ce0cb9..2efa359c1 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/RegistryConverter.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/RegistryConverter.java
@@ -62,7 +62,8 @@ public final class RegistryConverter implements ArgumentConvert
FluidCategory.class,
GameMode.class,
WeatherType.class
- ).stream()
+ )
+ .stream()
.map(c -> (Class) c)
.forEach(registryType ->
commandManager.registerConverter(Key.of(registryType), from(registryType))
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/SideEffectConverter.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/SideEffectConverter.java
index fd0ab684f..17f8b05ae 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/SideEffectConverter.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/SideEffectConverter.java
@@ -19,11 +19,7 @@
package com.sk89q.worldedit.command.argument;
-import static org.enginehub.piston.converter.SuggestionHelper.limitByPrefix;
-
-import com.google.common.collect.ImmutableList;
import com.sk89q.worldedit.WorldEdit;
-import com.sk89q.worldedit.command.util.EntityRemover;
import com.sk89q.worldedit.util.SideEffect;
import com.sk89q.worldedit.util.formatting.text.Component;
import com.sk89q.worldedit.util.formatting.text.TextComponent;
@@ -39,6 +35,8 @@ import java.util.Collection;
import java.util.List;
import java.util.Locale;
+import static org.enginehub.piston.converter.SuggestionHelper.limitByPrefix;
+
public class SideEffectConverter implements ArgumentConverter {
public static void register(CommandManager commandManager) {
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/factory/ItemUseFactory.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/factory/ItemUseFactory.java
index 7ad8866c3..b144a14a6 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/factory/ItemUseFactory.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/factory/ItemUseFactory.java
@@ -21,9 +21,9 @@ package com.sk89q.worldedit.command.factory;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.blocks.BaseItem;
-import com.sk89q.worldedit.function.ItemUseFunction;
import com.sk89q.worldedit.function.Contextual;
import com.sk89q.worldedit.function.EditContext;
+import com.sk89q.worldedit.function.ItemUseFunction;
import com.sk89q.worldedit.function.RegionFunction;
import com.sk89q.worldedit.util.Direction;
import com.sk89q.worldedit.world.World;
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/factory/ReplaceFactory.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/factory/ReplaceFactory.java
index fa09c8911..4c1797b52 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/factory/ReplaceFactory.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/factory/ReplaceFactory.java
@@ -19,8 +19,6 @@
package com.sk89q.worldedit.command.factory;
-import static com.sk89q.worldedit.util.GuavaUtil.firstNonNull;
-
import com.sk89q.worldedit.extent.NullExtent;
import com.sk89q.worldedit.function.Contextual;
import com.sk89q.worldedit.function.EditContext;
@@ -28,6 +26,8 @@ import com.sk89q.worldedit.function.RegionFunction;
import com.sk89q.worldedit.function.block.BlockReplace;
import com.sk89q.worldedit.function.pattern.Pattern;
+import static com.sk89q.worldedit.util.GuavaUtil.firstNonNull;
+
public class ReplaceFactory implements Contextual {
private final Pattern fill;
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/BlockDataCyler.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/BlockDataCyler.java
index a3ece0f7e..07f1d2144 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/BlockDataCyler.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/BlockDataCyler.java
@@ -19,7 +19,6 @@
package com.sk89q.worldedit.command.tool;
-import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.google.common.collect.Lists;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.LocalConfiguration;
@@ -30,8 +29,10 @@ import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.extension.platform.Platform;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.registry.state.Property;
+import com.sk89q.worldedit.util.Direction;
import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.util.formatting.text.TextComponent;
+import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.block.BlockState;
@@ -39,6 +40,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
+import javax.annotation.Nullable;
/**
* A mode that cycles the data values of supported blocks.
@@ -50,7 +52,7 @@ public class BlockDataCyler implements DoubleActionBlockTool {
return player.hasPermission("worldedit.tool.data-cycler");
}
- private Map> selectedProperties = new HashMap<>();
+ private final Map> selectedProperties = new HashMap<>();
private boolean handleCycle(LocalConfiguration config, Player player, LocalSession session,
Location clicked, boolean forward) {
@@ -85,7 +87,7 @@ public class BlockDataCyler implements DoubleActionBlockTool {
Property objProp = (Property) currentProperty;
BlockState newBlock = block.with(objProp, currentProperty.getValues().get(index));
- try (EditSession editSession = session.createEditSession(player, "BlockDataCyler")) {
+ try (EditSession editSession = session.createEditSession(player)) {
editSession.disableBuffering();
try {
@@ -115,12 +117,12 @@ public class BlockDataCyler implements DoubleActionBlockTool {
}
@Override
- public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, Location clicked) {
+ public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, Location clicked, @Nullable Direction face) {
return handleCycle(config, player, session, clicked, true);
}
@Override
- public boolean actSecondary(Platform server, LocalConfiguration config, Player player, LocalSession session, Location clicked) {
+ public boolean actSecondary(Platform server, LocalConfiguration config, Player player, LocalSession session, Location clicked, @Nullable Direction face) {
return handleCycle(config, player, session, clicked, false);
}
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/BlockTool.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/BlockTool.java
index 0ee513d75..df1b71903 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/BlockTool.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/BlockTool.java
@@ -23,19 +23,47 @@ import com.sk89q.worldedit.LocalConfiguration;
import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.extension.platform.Platform;
+import com.sk89q.worldedit.internal.util.DeprecationUtil;
+import com.sk89q.worldedit.internal.util.NonAbstractForCompatibility;
+import com.sk89q.worldedit.util.Direction;
import com.sk89q.worldedit.util.Location;
+import javax.annotation.Nullable;
+
public interface BlockTool extends Tool {
/**
* Perform the primary action of this tool.
*
- * @param server
- * @param config
- * @param player
- * @param session
- * @param clicked
* @return true to cancel the original event which triggered this action (if possible)
+ * @deprecated New subclasses should override
+ * {@link #actPrimary(Platform, LocalConfiguration, Player, LocalSession, Location, Direction)}
+ * instead
*/
- boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, Location clicked);
+ @Deprecated
+ default boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, Location clicked) {
+ return actPrimary(server, config, player, session, clicked, null);
+ }
+
+ /**
+ * Perform the primary action of this tool.
+ *
+ * @param server The platform
+ * @param config The config instance
+ * @param player The player
+ * @param session The local session
+ * @param clicked The location that was clicked
+ * @param face The face that was clicked
+ * @return true to cancel the original event which triggered this action (if possible)
+ * @apiNote This must be overridden by new subclasses. See {@link NonAbstractForCompatibility}
+ * for details
+ */
+ @NonAbstractForCompatibility(
+ delegateName = "actPrimary",
+ delegateParams = { Platform.class, LocalConfiguration.class, Player.class, LocalSession.class, Location.class }
+ )
+ default boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, Location clicked, @Nullable Direction face) {
+ DeprecationUtil.checkDelegatingOverride(getClass());
+ return actPrimary(server, config, player, session, clicked);
+ }
}
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/BrushTool.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/BrushTool.java
index 529580d35..41e7ad63a 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/BrushTool.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/BrushTool.java
@@ -19,14 +19,11 @@
package com.sk89q.worldedit.command.tool;
-import static com.google.common.base.Preconditions.checkNotNull;
-
import com.boydti.fawe.Fawe;
import com.boydti.fawe.beta.implementation.IChunkExtent;
import com.boydti.fawe.beta.implementation.processors.NullProcessor;
import com.boydti.fawe.beta.implementation.processors.PersistentChunkSendProcessor;
import com.boydti.fawe.config.Caption;
-import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.boydti.fawe.object.brush.BrushSettings;
import com.boydti.fawe.object.brush.MovableTool;
import com.boydti.fawe.object.brush.ResettableTool;
@@ -43,7 +40,6 @@ import com.boydti.fawe.util.EditSessionBuilder;
import com.boydti.fawe.util.ExtentTraverser;
import com.boydti.fawe.util.MaskTraverser;
import com.boydti.fawe.util.StringMan;
-import com.google.gson.Gson;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.LocalConfiguration;
import com.sk89q.worldedit.LocalSession;
@@ -65,31 +61,36 @@ import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.Vector3;
import com.sk89q.worldedit.session.request.Request;
import com.sk89q.worldedit.util.Location;
+import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.block.BlockType;
+
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.Serializable;
import java.util.Collection;
import java.util.Collections;
-import java.util.HashMap;
import java.util.function.Supplier;
import javax.annotation.Nullable;
+import static com.google.common.base.Preconditions.checkNotNull;
+
/**
* Builds a shape at the place being looked at.
*/
-public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool, ResettableTool, Serializable {
-// TODO:
+public class BrushTool
+ implements DoubleActionTraceTool, ScrollTool, MovableTool, ResettableTool, Serializable {
+ // TODO:
// Serialize methods
// serialize BrushSettings (primary and secondary only if different)
// set transient values e.g., context
+
public enum BrushAction {
- PRIMARY,
- SECONDARY
+ PRIMARY, SECONDARY
}
+
protected static int MAX_RANGE = 500;
protected static int DEFAULT_RANGE = 240; // 500 is laggy as the default
protected int range = -1;
@@ -108,7 +109,7 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
/**
* Construct the tool.
- *
+ *
* @param permission the permission to check before use is allowed
*/
public BrushTool(String permission) {
@@ -126,7 +127,7 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
public boolean isSet() {
return primary.getBrush() != null || secondary.getBrush() != null;
}
-
+
public void update() {
if (holder != null) {
BrushCache.setTool(holder, this);
@@ -210,7 +211,7 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
/**
* Get the filter.
- *
+ *
* @return the filter
*/
public Mask getMask() {
@@ -238,7 +239,7 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
/**
* Set the block filter used for identifying blocks to replace.
- *
+ *
* @param filter the filter to set
*/
public void setMask(Mask filter) {
@@ -251,7 +252,8 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
*
* @return the mask used to stop block traces
*/
- public @Nullable Mask getTraceMask() {
+ @Nullable
+ public Mask getTraceMask() {
return this.traceMask;
}
@@ -277,8 +279,8 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
/**
* Set the brush.
- *
- * @param brush tbe brush
+ *
+ * @param brush tbe brush
* @param permission the permission
*/
public void setBrush(Brush brush, String permission) {
@@ -291,7 +293,7 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
/**
* Get the current brush.
-
+ *
* @return the current brush
*/
public Brush getBrush() {
@@ -300,7 +302,7 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
/**
* Set the material.
- *
+ *
* @param material the material
*/
public void setFill(@Nullable Pattern material) {
@@ -312,13 +314,14 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
*
* @return the material
*/
- @Nullable public Pattern getMaterial() {
+ @Nullable
+ public Pattern getMaterial() {
return getContext().getMaterial();
}
/**
* Get the set brush size.
- *
+ *
* @return a radius
*/
public double getSize() {
@@ -327,7 +330,7 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
/**
* Set the set brush size.
- *
+ *
* @param radius a radius
*/
public void setSize(double radius) {
@@ -345,7 +348,7 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
/**
* Get the set brush range.
- *
+ *
* @return the range of the brush in blocks
*/
public int getRange() {
@@ -354,7 +357,7 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
/**
* Set the set brush range.
- *
+ *
* @param range the range of the brush in blocks
*/
public void setRange(int range) {
@@ -362,9 +365,10 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
}
@Override
- public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session) {
+ public boolean actPrimary(Platform server, LocalConfiguration config, Player player,
+ LocalSession session) {
return act(BrushAction.PRIMARY, player, session);
- }
+ }
public BlockVector3 getPosition(EditSession editSession, Player player) {
Location loc = player.getLocation();
@@ -376,7 +380,8 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
float pitch = loc.getPitch();
pitch = 23 - (pitch / 4);
d += (int) (Math.sin(Math.toRadians(pitch)) * 50);
- final Vector3 vector = loc.getDirection().withY(0).normalize().multiply(d).add(loc.getX(), loc.getY(), loc.getZ());
+ final Vector3 vector = loc.getDirection().withY(0).normalize().multiply(d)
+ .add(loc.getX(), loc.getY(), loc.getZ());
return offset(vector, loc).toBlockPoint();
}
case TARGET_POINT_HEIGHT: {
@@ -401,7 +406,9 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
}
private Vector3 offset(Vector3 target, Vector3 playerPos) {
- if (targetOffset == 0) return target;
+ if (targetOffset == 0) {
+ return target;
+ }
return target.subtract(target.subtract(playerPos).normalize().multiply(targetOffset));
}
@@ -420,13 +427,18 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
case SECONDARY:
setContext(secondary);
break;
+ default:
+ throw new IllegalStateException("Unexpected value: " + action);
}
BrushSettings current = getContext();
Brush brush = current.getBrush();
- if (brush == null) return false;
+ if (brush == null) {
+ return false;
+ }
if (!current.canUse(player)) {
- player.print(Caption.of("fawe.error.no-perm" , StringMan.join(current.getPermissions(), ",")));
+ player.print(
+ Caption.of("fawe.error.no-perm", StringMan.join(current.getPermissions(), ",")));
return false;
}
try (EditSession editSession = session.createEditSession(player, current.toString())) {
@@ -484,7 +496,8 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
}
@Override
- public boolean actSecondary(Platform server, LocalConfiguration config, Player player, LocalSession session) {
+ public boolean actSecondary(Platform server, LocalConfiguration config, Player player,
+ LocalSession session) {
return act(BrushAction.SECONDARY, player, session);
}
@@ -506,7 +519,9 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
}
public void setVisualMode(Player player, VisualMode visualMode) {
- if (visualMode == null) visualMode = VisualMode.NONE;
+ if (visualMode == null) {
+ visualMode = VisualMode.NONE;
+ }
if (this.visualMode != visualMode) {
if (this.visualMode != VisualMode.NONE) {
clear(player);
@@ -563,31 +578,31 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
}
@Deprecated
- public synchronized void visualize(BrushTool.BrushAction action, Player player) throws WorldEditException {
+ public synchronized void visualize(BrushTool.BrushAction action, Player player)
+ throws WorldEditException {
VisualMode mode = getVisualMode();
if (mode == VisualMode.NONE) {
return;
}
BrushSettings current = getContext();
Brush brush = current.getBrush();
- if (brush == null) return;
+ if (brush == null) {
+ return;
+ }
- EditSessionBuilder builder = new EditSessionBuilder(player.getWorld())
- .command(current.toString())
- .player(player)
- .allowedRegionsEverywhere()
- .autoQueue(false)
- .blockBag(null)
- .changeSetNull()
- .fastmode(true)
- .combineStages(true);
+ EditSessionBuilder builder =
+ new EditSessionBuilder(player.getWorld()).command(current.toString()).player(player)
+ .allowedRegionsEverywhere().autoQueue(false).blockBag(null).changeSetNull()
+ .fastmode(true).combineStages(true);
EditSession editSession = builder.build();
World world = editSession.getWorld();
Supplier> players = () -> Collections.singleton(player);
- PersistentChunkSendProcessor newVisualExtent = new PersistentChunkSendProcessor(world, this.visualExtent, players);
- ExtentTraverser traverser = new ExtentTraverser<>(editSession).find(IChunkExtent.class);
+ PersistentChunkSendProcessor newVisualExtent =
+ new PersistentChunkSendProcessor(world, this.visualExtent, players);
+ ExtentTraverser traverser =
+ new ExtentTraverser<>(editSession).find(IChunkExtent.class);
if (traverser == null) {
throw new IllegalStateException("No queue found");
}
@@ -612,6 +627,8 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
brush.build(editSession, position, current.getMaterial(), current.getSize());
break;
}
+ default:
+ throw new IllegalStateException("Unexpected value: " + mode);
}
}
editSession.flushQueue();
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/DistanceWand.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/DistanceWand.java
index 642a8c4aa..7da2cb39f 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/DistanceWand.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/DistanceWand.java
@@ -19,7 +19,6 @@
package com.sk89q.worldedit.command.tool;
-import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.sk89q.worldedit.LocalConfiguration;
import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.entity.Player;
@@ -29,6 +28,7 @@ import com.sk89q.worldedit.function.mask.Mask;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.RegionSelector;
import com.sk89q.worldedit.util.Location;
+import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
/**
* A wand that can be used at a distance.
@@ -42,7 +42,9 @@ public class DistanceWand extends BrushTool implements DoubleActionTraceTool {
@Override
public boolean actSecondary(Platform server, LocalConfiguration config, Player player, LocalSession session) {
Location target = getTarget(player);
- if (target == null) return true;
+ if (target == null) {
+ return true;
+ }
RegionSelector selector = session.getRegionSelector(player.getWorld());
BlockVector3 blockPoint = target.toVector().toBlockPoint();
@@ -55,7 +57,9 @@ public class DistanceWand extends BrushTool implements DoubleActionTraceTool {
@Override
public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session) {
Location target = getTarget(player);
- if (target == null) return true;
+ if (target == null) {
+ return true;
+ }
RegionSelector selector = session.getRegionSelector(player.getWorld());
BlockVector3 blockPoint = target.toVector().toBlockPoint();
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/DoubleActionBlockTool.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/DoubleActionBlockTool.java
index f2c37e99f..2bb58bf7f 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/DoubleActionBlockTool.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/DoubleActionBlockTool.java
@@ -23,8 +23,13 @@ import com.sk89q.worldedit.LocalConfiguration;
import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.extension.platform.Platform;
+import com.sk89q.worldedit.internal.util.DeprecationUtil;
+import com.sk89q.worldedit.internal.util.NonAbstractForCompatibility;
+import com.sk89q.worldedit.util.Direction;
import com.sk89q.worldedit.util.Location;
+import javax.annotation.Nullable;
+
/**
* Represents a block tool that also has a secondary/primary function.
*/
@@ -33,13 +38,36 @@ public interface DoubleActionBlockTool extends BlockTool {
/**
* Perform the secondary action of this block tool.
*
- * @param server
- * @param config
- * @param player
- * @param session
- * @param clicked
* @return true to cancel the original event which triggered this action (if possible)
+ * @deprecated New subclasses must override
+ * {@link #actSecondary(Platform, LocalConfiguration, Player, LocalSession, Location, Direction)}
+ * instead
*/
- boolean actSecondary(Platform server, LocalConfiguration config, Player player, LocalSession session, Location clicked);
+ @Deprecated
+ default boolean actSecondary(Platform server, LocalConfiguration config, Player player, LocalSession session, Location clicked) {
+ return actSecondary(server, config, player, session, clicked, null);
+ }
+
+ /**
+ * Perform the secondary action of this block tool.
+ *
+ * @param server The platform
+ * @param config The config instance
+ * @param player The player
+ * @param session The local session
+ * @param clicked The location that was clicked
+ * @param face The face that was clicked
+ * @return true to cancel the original event which triggered this action (if possible)
+ * @apiNote This must be overridden by new subclasses. See {@link NonAbstractForCompatibility}
+ * for details
+ */
+ @NonAbstractForCompatibility(
+ delegateName = "actSecondary",
+ delegateParams = { Platform.class, LocalConfiguration.class, Player.class, LocalSession.class, Location.class }
+ )
+ default boolean actSecondary(Platform server, LocalConfiguration config, Player player, LocalSession session, Location clicked, @Nullable Direction face) {
+ DeprecationUtil.checkDelegatingOverride(getClass());
+ return actSecondary(server, config, player, session, clicked);
+ }
}
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/DoubleActionTraceTool.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/DoubleActionTraceTool.java
index 1c9b6f83f..491c758c0 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/DoubleActionTraceTool.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/DoubleActionTraceTool.java
@@ -32,10 +32,10 @@ public interface DoubleActionTraceTool extends TraceTool {
/**
* Perform the secondary function of this tool.
*
- * @param server
- * @param config
- * @param player
- * @param session
+ * @param server The platform
+ * @param config The config instance
+ * @param player The player
+ * @param session The local session
* @return true to cancel the original event which triggered this action (if possible)
*/
boolean actSecondary(Platform server, LocalConfiguration config, Player player, LocalSession session);
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/FloatingTreeRemover.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/FloatingTreeRemover.java
index 3d299f456..c3b5f6d58 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/FloatingTreeRemover.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/FloatingTreeRemover.java
@@ -19,9 +19,7 @@
package com.sk89q.worldedit.command.tool;
-import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.boydti.fawe.object.collection.LocalBlockVectorSet;
-
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.LocalConfiguration;
import com.sk89q.worldedit.LocalSession;
@@ -32,24 +30,26 @@ import com.sk89q.worldedit.extension.platform.Platform;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.util.Direction;
import com.sk89q.worldedit.util.Location;
+import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.block.BlockCategories;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.block.BlockTypes;
+import org.jetbrains.annotations.Nullable;
import java.util.Iterator;
import java.util.Set;
/**
* A pickaxe mode that removes floating treetops (logs and leaves not connected
- * to anything else)
+ * to anything else).
*/
public class FloatingTreeRemover implements BlockTool {
- private int rangeSq;
+ private final int rangeSq;
public FloatingTreeRemover() {
- rangeSq = 100*100;
+ rangeSq = 100 * 100;
}
@Override
@@ -68,7 +68,8 @@ public class FloatingTreeRemover implements BlockTool {
@Override
public boolean actPrimary(Platform server, LocalConfiguration config,
- Player player, LocalSession session, Location clicked) {
+ Player player, LocalSession session, Location clicked,
+ @Nullable Direction face) {
final World world = (World) clicked.getExtent();
final BlockState state = world.getBlock(clicked.toVector().toBlockPoint());
@@ -102,7 +103,7 @@ public class FloatingTreeRemover implements BlockTool {
return true;
}
- private BlockVector3[] recurseDirections = {
+ private final BlockVector3[] recurseDirections = {
Direction.NORTH.toBlockVector(),
Direction.EAST.toBlockVector(),
Direction.SOUTH.toBlockVector(),
@@ -139,7 +140,8 @@ public class FloatingTreeRemover implements BlockTool {
if (visited.add(next)) {
BlockState state = world.getBlock(next);
- if (state.getBlockType().getMaterial().isAir() || state.getBlockType() == BlockTypes.SNOW) {
+ if (state.getBlockType().getMaterial().isAir()
+ || state.getBlockType() == BlockTypes.SNOW) {
continue;
}
if (isTreeBlock(state.getBlockType())) {
@@ -147,7 +149,8 @@ public class FloatingTreeRemover implements BlockTool {
} else {
// we hit something solid - evaluate where we came from
final BlockType currentType = world.getBlock(current).getBlockType();
- if (!BlockCategories.LEAVES.contains(currentType) && currentType != BlockTypes.VINE) {
+ if (!BlockCategories.LEAVES.contains(currentType)
+ && currentType != BlockTypes.VINE) {
// log/shroom touching a wall/the ground => this is not a floating tree, bail out
return null;
}
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/FloodFillTool.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/FloodFillTool.java
index 10e1468e7..742f24bd6 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/FloodFillTool.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/FloodFillTool.java
@@ -32,11 +32,13 @@ import com.sk89q.worldedit.function.operation.Operations;
import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.function.visitor.RecursiveVisitor;
import com.sk89q.worldedit.math.BlockVector3;
+import com.sk89q.worldedit.util.Direction;
import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.block.BlockTypes;
+import org.jetbrains.annotations.Nullable;
import java.util.Set;
@@ -45,8 +47,8 @@ import java.util.Set;
*/
public class FloodFillTool implements BlockTool {
- private int range;
- private Pattern pattern;
+ private final int range;
+ private final Pattern pattern;
public FloodFillTool(int range, Pattern pattern) {
this.range = range;
@@ -59,7 +61,7 @@ public class FloodFillTool implements BlockTool {
}
@Override
- public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, Location clicked) {
+ public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, Location clicked, @Nullable Direction face) {
World world = (World) clicked.getExtent();
BlockVector3 origin = clicked.toVector().toBlockPoint();
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/LongRangeBuildTool.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/LongRangeBuildTool.java
index 11532d04a..71b0a2f1c 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/LongRangeBuildTool.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/LongRangeBuildTool.java
@@ -19,7 +19,6 @@
package com.sk89q.worldedit.command.tool;
-import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.LocalConfiguration;
import com.sk89q.worldedit.LocalSession;
@@ -32,6 +31,7 @@ import com.sk89q.worldedit.function.mask.Mask;
import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.util.Location;
+import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.sk89q.worldedit.world.block.BaseBlock;
/**
@@ -39,8 +39,8 @@ import com.sk89q.worldedit.world.block.BaseBlock;
*/
public class LongRangeBuildTool extends BrushTool implements DoubleActionTraceTool {
- private Pattern primary;
- private Pattern secondary;
+ private final Pattern primary;
+ private final Pattern secondary;
public LongRangeBuildTool(Pattern secondary, Pattern primary) {
super("worldedit.tool.lrbuild");
@@ -56,7 +56,9 @@ public class LongRangeBuildTool extends BrushTool implements DoubleActionTraceTo
@Override
public boolean actSecondary(Platform server, LocalConfiguration config, Player player, LocalSession session) {
Location pos = getTargetFace(player);
- if (pos == null) return false;
+ if (pos == null) {
+ return false;
+ }
BlockBag bag = session.getBlockBag(player);
try (EditSession editSession = session.createEditSession(player, "LongRangeBuildTool")) {
@@ -84,7 +86,9 @@ public class LongRangeBuildTool extends BrushTool implements DoubleActionTraceTo
@Override
public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session) {
Location pos = getTargetFace(player);
- if (pos == null) return false;
+ if (pos == null) {
+ return false;
+ }
BlockBag bag = session.getBlockBag(player);
try (EditSession editSession = session.createEditSession(player, "LongRangeBuildTool")) {
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/QueryTool.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/QueryTool.java
index 13477713c..2a3f0b145 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/QueryTool.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/QueryTool.java
@@ -27,6 +27,7 @@ import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.extension.platform.Platform;
import com.sk89q.worldedit.internal.block.BlockStateIdAccess;
import com.sk89q.worldedit.math.BlockVector3;
+import com.sk89q.worldedit.util.Direction;
import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.util.formatting.text.TextComponent;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
@@ -35,8 +36,7 @@ import com.sk89q.worldedit.util.formatting.text.format.TextColor;
import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.registry.LegacyMapper;
-
-import java.util.OptionalInt;
+import org.jetbrains.annotations.Nullable;
/**
* Looks up information about a block.
@@ -49,7 +49,8 @@ public class QueryTool implements BlockTool {
}
@Override
- public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, Location clicked) {
+ public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, Location clicked, @Nullable
+ Direction face) {
World world = (World) clicked.getExtent();
EditSession editSession = session.createEditSession(player);
@@ -60,21 +61,21 @@ public class QueryTool implements BlockTool {
builder.append(TextComponent.of("@" + clicked.toVector().toBlockPoint() + ": ", TextColor.BLUE));
builder.append(TextComponent.of(block.getBlockType().getName(), TextColor.YELLOW));
builder.append(TextComponent.of(" (" + block + ") ", TextColor.GRAY)
- .hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TranslatableComponent.of("worldedit.tool.info.blockstate.hover"))));
+ .hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TranslatableComponent.of("worldedit.tool.info.blockstate.hover"))));
final int internalId = BlockStateIdAccess.getBlockStateId(block.toImmutableState());
if (BlockStateIdAccess.isValidInternalId(internalId)) {
- builder.append(TextComponent.of(" (" + internalId+ ") ", TextColor.DARK_GRAY)
- .hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TranslatableComponent.of("worldedit.tool.info.internalid.hover"))));
+ builder.append(TextComponent.of(" (" + internalId + ") ", TextColor.DARK_GRAY)
+ .hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TranslatableComponent.of("worldedit.tool.info.internalid.hover"))));
}
final int[] legacy = LegacyMapper.getInstance().getLegacyFromBlock(block.toImmutableState());
if (legacy != null) {
builder.append(TextComponent.of(" (" + legacy[0] + ":" + legacy[1] + ") ", TextColor.DARK_GRAY)
- .hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TranslatableComponent.of("worldedit.tool.info.legacy.hover"))));
+ .hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TranslatableComponent.of("worldedit.tool.info.legacy.hover"))));
}
builder.append(TextComponent.of(" (" + world.getBlockLightLevel(blockPoint) + "/"
- + world.getBlockLightLevel(blockPoint.add(0, 1, 0)) + ")", TextColor.WHITE)
- .hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TranslatableComponent.of("worldedit.tool.info.light.hover"))));
+ + world.getBlockLightLevel(blockPoint.add(0, 1, 0)) + ")", TextColor.WHITE)
+ .hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TranslatableComponent.of("worldedit.tool.info.light.hover"))));
player.print(builder.build());
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/RecursivePickaxe.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/RecursivePickaxe.java
index a5077f94c..5731eccc4 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/RecursivePickaxe.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/RecursivePickaxe.java
@@ -28,14 +28,14 @@ import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.extension.platform.Platform;
import com.sk89q.worldedit.function.block.BlockReplace;
-import com.sk89q.worldedit.function.operation.Operations;
import com.sk89q.worldedit.function.visitor.RecursiveVisitor;
import com.sk89q.worldedit.math.BlockVector3;
+import com.sk89q.worldedit.util.Direction;
import com.sk89q.worldedit.util.Location;
-import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.block.BlockTypes;
+import org.jetbrains.annotations.Nullable;
import java.util.Set;
@@ -45,7 +45,7 @@ import java.util.Set;
*/
public class RecursivePickaxe implements BlockTool {
- private double range;
+ private final double range;
public RecursivePickaxe(double range) {
this.range = range;
@@ -57,7 +57,7 @@ public class RecursivePickaxe implements BlockTool {
}
@Override
- public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, Location clicked) {
+ public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, Location clicked, @Nullable Direction face) {
World world = (World) clicked.getExtent();
final BlockVector3 pos = clicked.toBlockPoint();
@@ -94,7 +94,7 @@ public class RecursivePickaxe implements BlockTool {
BlockVector3 origin, double size, BlockType initialType, Set visited) throws MaxChangedBlocksException {
final double distanceSq = origin.distanceSq(pos);
- if (distanceSq > size*size || visited.contains(pos)) {
+ if (distanceSq > size * size || visited.contains(pos)) {
return;
}
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/SelectionWand.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/SelectionWand.java
index c20641a05..5f2f2775b 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/SelectionWand.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/SelectionWand.java
@@ -25,7 +25,6 @@ import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.extension.platform.Platform;
-import com.sk89q.worldedit.extension.platform.PlatformManager;
import com.sk89q.worldedit.extension.platform.permission.ActorSelectorLimits;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.RegionSelector;
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/Tool.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/Tool.java
index 2ed73209f..eaa949643 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/Tool.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/Tool.java
@@ -30,7 +30,7 @@ public interface Tool {
/**
* Checks to see if the player can still be using this tool (considering
* permissions and such).
- *
+ *
* @param actor the actor
* @return true if use is permitted
*/
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/TraceTool.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/TraceTool.java
index 6f18e2c71..ff7d29519 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/TraceTool.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/TraceTool.java
@@ -29,10 +29,10 @@ public interface TraceTool extends Tool {
/**
* Perform the primary action of this trace tool.
*
- * @param server
- * @param config
- * @param player
- * @param session
+ * @param server The platform
+ * @param config The config instance
+ * @param player The player
+ * @param session The local session
* @return true to cancel the original event which triggered this action (if possible)
*/
boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session);
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/Brush.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/Brush.java
index c066c7d10..c714f04a3 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/Brush.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/Brush.java
@@ -31,12 +31,12 @@ public interface Brush {
/**
* Build the object.
- *
+ *
* @param editSession the {@code EditSession}
* @param position the position
* @param pattern the pattern
* @param size the size of the brush
- * @throws MaxChangedBlocksException
+ * @throws MaxChangedBlocksException if the maximum block change limit is exceeded
*/
void build(EditSession editSession, BlockVector3 position, Pattern pattern, double size) throws MaxChangedBlocksException;
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/GravityBrush.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/GravityBrush.java
index 69b64a037..08b26a09c 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/GravityBrush.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/GravityBrush.java
@@ -23,12 +23,6 @@ import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.MaxChangedBlocksException;
import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.math.BlockVector3;
-import com.sk89q.worldedit.util.LocatedBlock;
-
-import java.util.LinkedHashSet;
-import java.util.Set;
-import com.sk89q.worldedit.world.block.BaseBlock;
-import com.sk89q.worldedit.util.collection.LocatedBlockList;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockTypes;
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/AsyncCommandBuilder.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/AsyncCommandBuilder.java
index 80622c37d..c521d43d5 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/AsyncCommandBuilder.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/AsyncCommandBuilder.java
@@ -33,10 +33,10 @@ import com.sk89q.worldedit.util.task.FutureForwardingTask;
import com.sk89q.worldedit.util.task.Supervisor;
import org.enginehub.piston.exception.CommandException;
import org.enginehub.piston.exception.CommandExecutionException;
+import org.jetbrains.annotations.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import javax.annotation.Nullable;
import java.util.concurrent.Callable;
import java.util.function.Consumer;
@@ -133,6 +133,7 @@ public final class AsyncCommandBuilder {
return future;
}
+ @SuppressWarnings("deprecation")
private T runTask() {
T result = null;
try {
@@ -183,6 +184,7 @@ public final class AsyncCommandBuilder {
// com.sk89q.minecraft.util.commands.CommandException. the ExceptionConverter currently expects converted
// exceptions to be org.enginehub.piston.CommandException, throw it wraps the resulting InvocationTargetException in
// a CommandExecutionException. here, we unwrap those layers to retrieve the original WG error message
+ @SuppressWarnings("deprecation")
private Component tryExtractOldCommandException(CommandException converted) {
Component message = null;
if (converted instanceof CommandExecutionException) {
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/CreatureButcher.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/CreatureButcher.java
index e43fee9d4..15b981323 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/CreatureButcher.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/CreatureButcher.java
@@ -51,7 +51,9 @@ public class CreatureButcher {
}
public void or(int flag, boolean on) {
- if (on) flags |= flag;
+ if (on) {
+ flags |= flag;
+ }
}
public void or(int flag, boolean on, String permission) {
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/EntityRemover.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/EntityRemover.java
index e59811b68..d78dc5725 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/EntityRemover.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/EntityRemover.java
@@ -23,8 +23,8 @@ import com.boydti.fawe.util.TaskManager;
import com.sk89q.worldedit.entity.metadata.EntityProperties;
import com.sk89q.worldedit.function.EntityFunction;
-import javax.annotation.Nullable;
import java.util.regex.Pattern;
+import javax.annotation.Nullable;
import static com.google.common.base.Preconditions.checkNotNull;
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/FutureProgressListener.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/FutureProgressListener.java
index 3a47679a6..f51ad710b 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/FutureProgressListener.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/FutureProgressListener.java
@@ -19,8 +19,6 @@
package com.sk89q.worldedit.command.util;
-import static com.google.common.base.Preconditions.checkNotNull;
-
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.MoreExecutors;
import com.sk89q.worldedit.extension.platform.Actor;
@@ -29,6 +27,8 @@ import com.sk89q.worldedit.util.formatting.text.TextComponent;
import java.util.Timer;
+import static com.google.common.base.Preconditions.checkNotNull;
+
public class FutureProgressListener implements Runnable {
private static final Timer timer = new Timer();
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/Logging.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/Logging.java
index ec256f16e..89d91ffbf 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/Logging.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/Logging.java
@@ -33,27 +33,27 @@ public @interface Logging {
enum LogMode {
/**
- * Player position
+ * Player position.
*/
POSITION,
/**
- * Region selection
+ * Region selection.
*/
REGION,
/**
- * Player orientation and region selection
+ * Player orientation and region selection.
*/
ORIENTATION_REGION,
/**
- * Either the player position or pos1, depending on the placeAtPos1 flag
+ * Either the player position or pos1, depending on the placeAtPos1 flag.
*/
PLACEMENT,
/**
- * Log all information available
+ * Log all information available.
*/
ALL
}
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/MessageTimerTask.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/MessageTimerTask.java
index fa12e40be..f4f0fc89d 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/MessageTimerTask.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/MessageTimerTask.java
@@ -19,14 +19,14 @@
package com.sk89q.worldedit.command.util;
-import static com.google.common.base.Preconditions.checkNotNull;
-
import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.util.formatting.text.Component;
import com.sk89q.worldedit.util.formatting.text.TextComponent;
import java.util.TimerTask;
+import static com.google.common.base.Preconditions.checkNotNull;
+
public class MessageTimerTask extends TimerTask {
private final Actor sender;
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/PermissionCondition.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/PermissionCondition.java
index a1ce3abda..bcf22c4cc 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/PermissionCondition.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/PermissionCondition.java
@@ -48,8 +48,8 @@ public class PermissionCondition implements Command.Condition {
@Override
public boolean satisfied(InjectedValueAccess context) {
- return permissions.isEmpty() ||
- context.injectedValue(ACTOR_KEY)
+ return permissions.isEmpty()
+ || context.injectedValue(ACTOR_KEY)
.map(actor -> permissions.stream().anyMatch(actor::hasPermission))
.orElse(false);
}
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/PrintCommandHelp.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/PrintCommandHelp.java
index ca7f3a394..0ee502b36 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/PrintCommandHelp.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/PrintCommandHelp.java
@@ -19,10 +19,6 @@
package com.sk89q.worldedit.command.util;
-import static com.sk89q.worldedit.internal.command.CommandUtil.byCleanName;
-import static com.sk89q.worldedit.internal.command.CommandUtil.getSubCommands;
-import static java.util.stream.Collectors.toList;
-
import com.google.common.base.Joiner;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterables;
@@ -42,6 +38,10 @@ import java.util.Optional;
import java.util.stream.Collectors;
import java.util.stream.Stream;
+import static com.sk89q.worldedit.internal.command.CommandUtil.byCleanName;
+import static com.sk89q.worldedit.internal.command.CommandUtil.getSubCommands;
+import static java.util.stream.Collectors.toList;
+
/**
* Implementation of the //help command.
*/
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/WorldEditAsyncCommandBuilder.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/WorldEditAsyncCommandBuilder.java
index 901c461fc..64c763d9d 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/WorldEditAsyncCommandBuilder.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/WorldEditAsyncCommandBuilder.java
@@ -24,8 +24,8 @@ import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.util.formatting.text.Component;
import com.sk89q.worldedit.util.formatting.text.TextComponent;
-import javax.annotation.Nullable;
import java.util.concurrent.Callable;
+import javax.annotation.Nullable;
/**
* For internal WorldEdit use only.
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/annotation/Confirm.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/annotation/Confirm.java
index f134e1c1f..7d5c26fb7 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/annotation/Confirm.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/annotation/Confirm.java
@@ -1,7 +1,6 @@
package com.sk89q.worldedit.command.util.annotation;
import com.boydti.fawe.config.Caption;
-import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.boydti.fawe.util.task.InterruptableCondition;
import com.sk89q.worldedit.IncompleteRegionException;
import com.sk89q.worldedit.WorldEdit;
@@ -15,6 +14,7 @@ import com.sk89q.worldedit.internal.util.Substring;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.util.formatting.text.TextComponent;
+import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import org.enginehub.piston.exception.StopExecutionException;
import org.enginehub.piston.inject.InjectAnnotation;
import org.enginehub.piston.inject.InjectedValueAccess;
@@ -33,7 +33,10 @@ import java.util.stream.Stream;
* Indicates how the affected blocks should be hinted at in the log.
*/
@Retention(RetentionPolicy.RUNTIME)
-@Target({ElementType.PARAMETER, ElementType.METHOD})
+@Target({
+ ElementType.PARAMETER,
+ ElementType.METHOD
+ })
@InjectAnnotation
public @interface Confirm {
Processor value() default Processor.ALWAYS;
@@ -45,10 +48,11 @@ public @interface Confirm {
Region region = context.injectedValue(Key.of(Region.class, Selection.class)).orElseThrow(IncompleteRegionException::new);
BlockVector3 pos1 = region.getMinimumPoint();
BlockVector3 pos2 = region.getMaximumPoint();
- long area = (pos2.getX() - pos1.getX()) * (pos2.getZ() - pos1.getZ() + 1) * (long) value;
+ long area = (pos2.getX() - pos1.getX()) * (pos2.getZ() - pos1.getZ() + 1)
+ * (long) value;
long max = 2 << 18;
if (max != -1 && area > max) {
- actor.print(Caption.of("fawe.cancel.worldedit.cancel.reason.confirm.region" , pos1, pos2, getArgs(context)));
+ actor.print(Caption.of("fawe.cancel.worldedit.cancel.reason.confirm.region", pos1, pos2, getArgs(context)));
return confirm(actor, context);
}
return true;
@@ -59,7 +63,7 @@ public @interface Confirm {
public boolean passes(Actor actor, InjectedValueAccess context, double value) {
int max = WorldEdit.getInstance().getConfiguration().maxRadius;
if (max != -1 && value > max) {
- actor.print(Caption.of("fawe.cancel.worldedit.cancel.reason.confirm.region" , value, max, getArgs(context)));
+ actor.print(Caption.of("fawe.cancel.worldedit.cancel.reason.confirm.region", value, max, getArgs(context)));
return Processor.confirm(actor, context);
}
return true;
@@ -68,9 +72,9 @@ public @interface Confirm {
LIMIT {
@Override
public boolean passes(Actor actor, InjectedValueAccess context, double value) {
- int max = 50;// TODO configurable, get Key.of(Method.class) @Limit
+ int max = 50; //TODO configurable, get Key.of(Method.class) @Limit
if (max != -1 && value > max) {
- actor.print(Caption.of("fawe.cancel.worldedit.cancel.reason.confirm.region" , value, max, getArgs(context)));
+ actor.print(Caption.of("fawe.cancel.worldedit.cancel.reason.confirm.region", value, max, getArgs(context)));
return Processor.confirm(actor, context);
}
return true;
@@ -82,10 +86,11 @@ public @interface Confirm {
actor.print(TranslatableComponent.of("fawe.cancel.worldedit.cancel.reason.confirm"));
return confirm(actor, context);
}
- }
- ;
+ };
- public boolean passes(Actor actor, InjectedValueAccess context, double value){return true;}
+ public boolean passes(Actor actor, InjectedValueAccess context, double value) {
+ return true;
+ }
public T check(Actor actor, InjectedValueAccess context, T value) {
if (!passes(actor, context, value.doubleValue())) {
@@ -125,8 +130,8 @@ public @interface Confirm {
if (condition.await(15, TimeUnit.SECONDS)) {
return true;
}
- } catch (InterruptedException e) {}
- finally {
+ } catch (InterruptedException ignored) {
+ } finally {
if (actor.getMeta("cmdConfirm") == wait) {
actor.deleteMeta("cmdConfirm");
}
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/entity/BaseEntity.java b/worldedit-core/src/main/java/com/sk89q/worldedit/entity/BaseEntity.java
index 642565ef8..b34b593c5 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/entity/BaseEntity.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/entity/BaseEntity.java
@@ -19,8 +19,6 @@
package com.sk89q.worldedit.entity;
-import static com.google.common.base.Preconditions.checkNotNull;
-
import com.sk89q.jnbt.CompoundTag;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.util.Location;
@@ -30,6 +28,8 @@ import com.sk89q.worldedit.world.entity.EntityTypes;
import javax.annotation.Nullable;
+import static com.google.common.base.Preconditions.checkNotNull;
+
/**
* Represents a mutable "snapshot" of an entity.
*
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/entity/Entity.java b/worldedit-core/src/main/java/com/sk89q/worldedit/entity/Entity.java
index b82be020d..56e1097d6 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/entity/Entity.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/entity/Entity.java
@@ -23,6 +23,7 @@ import com.sk89q.worldedit.extension.platform.Locatable;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.util.Faceted;
import com.sk89q.worldedit.world.entity.EntityType;
+
import javax.annotation.Nullable;
/**
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/entity/LazyBaseEntity.java b/worldedit-core/src/main/java/com/sk89q/worldedit/entity/LazyBaseEntity.java
index ff34d8627..35fb2de7a 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/entity/LazyBaseEntity.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/entity/LazyBaseEntity.java
@@ -5,8 +5,8 @@ import com.boydti.fawe.util.TaskManager;
import com.sk89q.jnbt.CompoundTag;
import com.sk89q.worldedit.world.entity.EntityType;
-import javax.annotation.Nullable;
import java.util.function.Supplier;
+import javax.annotation.Nullable;
public class LazyBaseEntity extends BaseEntity {
private Supplier saveTag;
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/entity/MapMetadatable.java b/worldedit-core/src/main/java/com/sk89q/worldedit/entity/MapMetadatable.java
index efa807c7a..6cedcb415 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/entity/MapMetadatable.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/entity/MapMetadatable.java
@@ -1,8 +1,9 @@
package com.sk89q.worldedit.entity;
-import java.util.Map;
import org.jetbrains.annotations.NotNull;
+import java.util.Map;
+
public interface MapMetadatable extends Metadatable {
Map getRawMeta();
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/entity/Player.java b/worldedit-core/src/main/java/com/sk89q/worldedit/entity/Player.java
index 32f49f891..329586fe2 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/entity/Player.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/entity/Player.java
@@ -25,7 +25,6 @@ import com.boydti.fawe.object.brush.visualization.VirtualWorld;
import com.boydti.fawe.object.clipboard.DiskOptimizedClipboard;
import com.boydti.fawe.regions.FaweMaskManager;
import com.boydti.fawe.util.MainUtil;
-import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.EmptyClipboardException;
import com.sk89q.worldedit.IncompleteRegionException;
import com.sk89q.worldedit.LocalSession;
@@ -36,12 +35,13 @@ import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.extent.clipboard.Clipboard;
import com.sk89q.worldedit.extent.inventory.BlockBag;
import com.sk89q.worldedit.function.mask.Mask;
+import com.sk89q.worldedit.internal.util.DeprecationUtil;
+import com.sk89q.worldedit.internal.util.NonAbstractForCompatibility;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.Vector3;
import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.regions.RegionSelector;
import com.sk89q.worldedit.session.ClipboardHolder;
-import com.sk89q.worldedit.session.request.Request;
import com.sk89q.worldedit.util.Direction;
import com.sk89q.worldedit.util.HandSide;
import com.sk89q.worldedit.util.Location;
@@ -51,9 +51,8 @@ import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.gamemode.GameMode;
-import javax.annotation.Nullable;
import java.io.File;
-import java.io.IOException;
+import javax.annotation.Nullable;
/**
* Represents a player
@@ -301,8 +300,40 @@ public interface Player extends Entity, Actor {
* @param pos where to move them
* @param pitch the pitch (up/down) of the player's view in degrees
* @param yaw the yaw (left/right) of the player's view in degrees
+ * @deprecated This method may fail without indication. Use
+ * {@link #trySetPosition(Vector3, float, float)} instead
*/
- void setPosition(Vector3 pos, float pitch, float yaw);
+ @Deprecated
+ default void setPosition(Vector3 pos, float pitch, float yaw) {
+ trySetPosition(pos, pitch, yaw);
+ }
+
+ /**
+ * Attempt to move the player.
+ *
+ *
+ * This action may fail, due to other mods cancelling the move.
+ * If so, this method will return {@code false}.
+ *
+ *
+ * @param pos where to move them
+ * @param pitch the pitch (up/down) of the player's view in degrees
+ * @param yaw the yaw (left/right) of the player's view in degrees
+ * @return if the move was able to occur
+ * @apiNote This must be overridden by new subclasses. See {@link NonAbstractForCompatibility}
+ * for details
+ */
+ @NonAbstractForCompatibility(
+ delegateName = "setPosition",
+ delegateParams = { Vector3.class, float.class, float.class }
+ )
+ default boolean trySetPosition(Vector3 pos, float pitch, float yaw) {
+ DeprecationUtil.checkDelegatingOverride(getClass());
+
+ setPosition(pos, pitch, yaw);
+
+ return true;
+ }
/**
* Sends a fake block to the client.
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/event/Event.java b/worldedit-core/src/main/java/com/sk89q/worldedit/event/Event.java
index bce9eac7a..70d765390 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/event/Event.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/event/Event.java
@@ -27,7 +27,7 @@ import com.sk89q.worldedit.WorldEdit;
public abstract class Event {
/**
- * Returns true if this event was called and not cancelled
+ * Returns true if this event was called and not cancelled.
* @return !isCancelled
*/
public boolean call() {
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/event/extent/ActorSaveClipboardEvent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/event/extent/ActorSaveClipboardEvent.java
index 929c3b6aa..fdc84e369 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/event/extent/ActorSaveClipboardEvent.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/event/extent/ActorSaveClipboardEvent.java
@@ -1,6 +1,5 @@
package com.sk89q.worldedit.event.extent;
-import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.event.Cancellable;
import com.sk89q.worldedit.event.Event;
import com.sk89q.worldedit.extension.platform.Actor;
@@ -11,7 +10,8 @@ import java.net.URI;
public class ActorSaveClipboardEvent extends Event implements Cancellable {
private final Actor actor;
private final Clipboard clipboard;
- private final URI source, destination;
+ private final URI source;
+ private final URI destination;
private boolean cancelled;
public ActorSaveClipboardEvent(Actor actor, Clipboard clipboard, URI source, URI destination) {
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/event/extent/EditSessionEvent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/event/extent/EditSessionEvent.java
index 7b4cd9995..a6906f885 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/event/extent/EditSessionEvent.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/event/extent/EditSessionEvent.java
@@ -19,9 +19,7 @@
package com.sk89q.worldedit.event.extent;
-import static com.google.common.base.Preconditions.checkNotNull;
import com.sk89q.worldedit.EditSession;
-import static com.sk89q.worldedit.EditSession.Stage;
import com.sk89q.worldedit.event.Cancellable;
import com.sk89q.worldedit.event.Event;
import com.sk89q.worldedit.extension.platform.Actor;
@@ -32,6 +30,9 @@ import com.sk89q.worldedit.world.block.BlockStateHolder;
import javax.annotation.Nullable;
+import static com.google.common.base.Preconditions.checkNotNull;
+import static com.sk89q.worldedit.EditSession.Stage;
+
/**
* Raised (several times) when a new {@link EditSession} is being instantiated.
*
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/event/extent/PasteEvent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/event/extent/PasteEvent.java
index 45f74c4b9..1b52bf26c 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/event/extent/PasteEvent.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/event/extent/PasteEvent.java
@@ -19,16 +19,17 @@
package com.sk89q.worldedit.event.extent;
-import static com.sk89q.worldedit.EditSession.Stage;
-
import com.sk89q.worldedit.event.Cancellable;
import com.sk89q.worldedit.event.Event;
import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.extent.clipboard.Clipboard;
import com.sk89q.worldedit.math.BlockVector3;
+
import java.net.URI;
+import static com.sk89q.worldedit.EditSession.Stage;
+
public class PasteEvent extends Event implements Cancellable {
private final Actor actor;
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/event/platform/BlockInteractEvent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/event/platform/BlockInteractEvent.java
index 7549518ad..3e6890e51 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/event/platform/BlockInteractEvent.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/event/platform/BlockInteractEvent.java
@@ -19,13 +19,16 @@
package com.sk89q.worldedit.event.platform;
-import static com.google.common.base.Preconditions.checkNotNull;
-
import com.sk89q.worldedit.event.Cancellable;
import com.sk89q.worldedit.event.Event;
import com.sk89q.worldedit.extension.platform.Actor;
+import com.sk89q.worldedit.util.Direction;
import com.sk89q.worldedit.util.Location;
+import javax.annotation.Nullable;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
/**
* Called when a block is interacted with.
*/
@@ -34,6 +37,7 @@ public class BlockInteractEvent extends Event implements Cancellable {
private final Actor cause;
private final Location location;
private final Interaction type;
+ private final Direction face;
private boolean cancelled;
/**
@@ -43,12 +47,26 @@ public class BlockInteractEvent extends Event implements Cancellable {
* @param location the location of the block
* @param type the type of interaction
*/
+ @Deprecated
public BlockInteractEvent(Actor cause, Location location, Interaction type) {
+ this(cause, location, null, type);
+ }
+
+ /**
+ * Create a new event.
+ *
+ * @param cause the causing actor
+ * @param location the location of the block
+ * @param face the face of the block that was interacted with
+ * @param type the type of interaction
+ */
+ public BlockInteractEvent(Actor cause, Location location, @Nullable Direction face, Interaction type) {
checkNotNull(cause);
checkNotNull(location);
checkNotNull(type);
this.cause = cause;
this.location = location;
+ this.face = face;
this.type = type;
}
@@ -70,6 +88,16 @@ public class BlockInteractEvent extends Event implements Cancellable {
return location;
}
+ /**
+ * Get the face of the block that was interacted with.
+ *
+ * @return The interacted face
+ */
+ @Nullable
+ public Direction getFace() {
+ return face;
+ }
+
/**
* Get the type of interaction.
*
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/event/platform/CommandSuggestionEvent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/event/platform/CommandSuggestionEvent.java
index 09f070f42..709bcc49c 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/event/platform/CommandSuggestionEvent.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/event/platform/CommandSuggestionEvent.java
@@ -18,6 +18,7 @@
*/
package com.sk89q.worldedit.event.platform;
+
import com.sk89q.worldedit.event.Event;
import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.internal.util.Substring;
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/event/platform/ConfigurationLoadEvent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/event/platform/ConfigurationLoadEvent.java
index 1bfc11724..73d23131c 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/event/platform/ConfigurationLoadEvent.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/event/platform/ConfigurationLoadEvent.java
@@ -19,11 +19,11 @@
package com.sk89q.worldedit.event.platform;
-import static com.google.common.base.Preconditions.checkNotNull;
-
import com.sk89q.worldedit.LocalConfiguration;
import com.sk89q.worldedit.event.Event;
+import static com.google.common.base.Preconditions.checkNotNull;
+
/**
* Raised when the configuration has been loaded or re-loaded.
*/
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/event/platform/PlayerInputEvent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/event/platform/PlayerInputEvent.java
index 67ef25268..2bc39ee97 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/event/platform/PlayerInputEvent.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/event/platform/PlayerInputEvent.java
@@ -19,12 +19,12 @@
package com.sk89q.worldedit.event.platform;
-import static com.google.common.base.Preconditions.checkNotNull;
-
import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.event.Cancellable;
import com.sk89q.worldedit.event.Event;
+import static com.google.common.base.Preconditions.checkNotNull;
+
/**
* Raised whenever a player sends input.
*/
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/MaskFactory.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/MaskFactory.java
index d11c479d9..2f7b040bb 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/MaskFactory.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/MaskFactory.java
@@ -20,7 +20,27 @@
package com.sk89q.worldedit.extension.factory;
import com.sk89q.worldedit.WorldEdit;
-import com.sk89q.worldedit.extension.factory.parser.mask.*;
+import com.sk89q.worldedit.extension.factory.parser.mask.AirMaskParser;
+import com.sk89q.worldedit.extension.factory.parser.mask.AngleMaskParser;
+import com.sk89q.worldedit.extension.factory.parser.mask.BiomeMaskParser;
+import com.sk89q.worldedit.extension.factory.parser.mask.BlockCategoryMaskParser;
+import com.sk89q.worldedit.extension.factory.parser.mask.BlockStateMaskParser;
+import com.sk89q.worldedit.extension.factory.parser.mask.BlocksMaskParser;
+import com.sk89q.worldedit.extension.factory.parser.mask.ExistingMaskParser;
+import com.sk89q.worldedit.extension.factory.parser.mask.ExpressionMaskParser;
+import com.sk89q.worldedit.extension.factory.parser.mask.FalseMaskParser;
+import com.sk89q.worldedit.extension.factory.parser.mask.LazyRegionMaskParser;
+import com.sk89q.worldedit.extension.factory.parser.mask.LiquidMaskParser;
+import com.sk89q.worldedit.extension.factory.parser.mask.NegateMaskParser;
+import com.sk89q.worldedit.extension.factory.parser.mask.NoiseMaskParser;
+import com.sk89q.worldedit.extension.factory.parser.mask.OffsetMaskParser;
+import com.sk89q.worldedit.extension.factory.parser.mask.RegionMaskParser;
+import com.sk89q.worldedit.extension.factory.parser.mask.SimplexMaskParser;
+import com.sk89q.worldedit.extension.factory.parser.mask.SolidMaskParser;
+import com.sk89q.worldedit.extension.factory.parser.mask.TrueMaskParser;
+import com.sk89q.worldedit.extension.factory.parser.mask.XAxisMaskParser;
+import com.sk89q.worldedit.extension.factory.parser.mask.YAxisMaskParser;
+import com.sk89q.worldedit.extension.factory.parser.mask.ZAxisMaskParser;
import com.sk89q.worldedit.extension.input.InputParseException;
import com.sk89q.worldedit.extension.input.NoMatchException;
import com.sk89q.worldedit.extension.input.ParserContext;
@@ -69,7 +89,8 @@ public final class MaskFactory extends AbstractFactory {
register(new XAxisMaskParser(worldEdit));
register(new YAxisMaskParser(worldEdit));
register(new ZAxisMaskParser(worldEdit));
-
+ register(new SimplexMaskParser(worldEdit));
+ register(new AngleMaskParser(worldEdit));
}
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/DefaultBlockParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/DefaultBlockParser.java
index 31491b2b8..69b2395ce 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/DefaultBlockParser.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/DefaultBlockParser.java
@@ -20,13 +20,11 @@
package com.sk89q.worldedit.extension.factory.parser;
import com.boydti.fawe.config.Caption;
-import com.google.common.collect.Maps;
-
import com.boydti.fawe.jnbt.JSON2NBT;
import com.boydti.fawe.jnbt.NBTException;
import com.boydti.fawe.util.MathMan;
import com.boydti.fawe.util.StringMan;
-
+import com.google.common.collect.Maps;
import com.sk89q.jnbt.CompoundTag;
import com.sk89q.worldedit.IncompleteRegionException;
import com.sk89q.worldedit.NotABlockException;
@@ -58,14 +56,13 @@ import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.block.BlockTypes;
import com.sk89q.worldedit.world.block.FuzzyBlockState;
+import com.sk89q.worldedit.world.entity.EntityType;
+import com.sk89q.worldedit.world.entity.EntityTypes;
import com.sk89q.worldedit.world.registry.LegacyMapper;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Locale;
-import com.sk89q.worldedit.world.entity.EntityType;
-import com.sk89q.worldedit.world.entity.EntityTypes;
-
import java.util.Map;
import java.util.stream.Stream;
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/RichParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/RichParser.java
index 6bd9261fa..7c19f55b0 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/RichParser.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/RichParser.java
@@ -1,6 +1,5 @@
package com.sk89q.worldedit.extension.factory.parser;
-import com.sk89q.util.StringUtil;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.extension.input.InputParseException;
import com.sk89q.worldedit.extension.input.ParserContext;
@@ -115,4 +114,40 @@ public abstract class RichParser extends InputParser {
}
return arguments.toArray(new String[0]);
}
+
+ /**
+ * Returns a stream of suggestions for positive doubles.
+ *
+ * @param argumentInput the given input to filter with.
+ * @return a stream of suggestions.
+ */
+ protected Stream suggestPositiveDoubles(String argumentInput) {
+ if (argumentInput.isEmpty()) {
+ return Stream.of("1", "2", "3", "4", "5", "6", "7", "8", "9");
+ }
+ // if already a valid number, suggest more digits
+ if (isDouble(argumentInput)) {
+ Stream numbers = Stream.of("", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9");
+ if (argumentInput.indexOf('.') == -1) {
+ numbers = Stream.concat(numbers, Stream.of("."));
+ }
+ return numbers.map(s -> argumentInput + s);
+ }
+ // no valid input anymore
+ return Stream.empty();
+ }
+
+ private static boolean isDouble(String input) {
+ boolean point = false;
+ for (char c : input.toCharArray()) {
+ if (!Character.isDigit(c)) {
+ if (c == '.' && !point) {
+ point = true;
+ } else {
+ return false;
+ }
+ }
+ }
+ return true;
+ }
}
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/AirMaskParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/AirMaskParser.java
index e8c5ef423..ec2059129 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/AirMaskParser.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/AirMaskParser.java
@@ -1,12 +1,12 @@
package com.sk89q.worldedit.extension.factory.parser.mask;
import com.boydti.fawe.function.mask.AirMask;
-import com.boydti.fawe.function.mask.LiquidMask;
import com.google.common.collect.ImmutableList;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.extension.input.ParserContext;
import com.sk89q.worldedit.function.mask.Mask;
import com.sk89q.worldedit.internal.registry.SimpleInputParser;
+
import java.util.List;
public class AirMaskParser extends SimpleInputParser {
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/AngleMaskParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/AngleMaskParser.java
new file mode 100644
index 000000000..0957a7e8c
--- /dev/null
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/AngleMaskParser.java
@@ -0,0 +1,49 @@
+package com.sk89q.worldedit.extension.factory.parser.mask;
+
+import com.boydti.fawe.object.mask.AngleMask;
+import com.sk89q.worldedit.WorldEdit;
+import com.sk89q.worldedit.extension.factory.parser.RichParser;
+import com.sk89q.worldedit.extension.input.InputParseException;
+import com.sk89q.worldedit.extension.input.ParserContext;
+import com.sk89q.worldedit.function.mask.Mask;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.stream.Stream;
+
+public class AngleMaskParser extends RichParser {
+
+ public AngleMaskParser(WorldEdit worldEdit) {
+ super(worldEdit, "/");
+ }
+
+ @Override
+ protected Stream getSuggestions(String argumentInput, int index) {
+ if (index == 0 || index == 1) {
+ return suggestPositiveDoubles(argumentInput).flatMap(s -> Stream.of(s, s + "d"));
+ }
+ return null;
+ }
+
+ @Override
+ protected Mask parseFromInput(@NotNull String[] arguments, ParserContext context) throws InputParseException {
+ if (arguments.length != 2) return null;
+ String minArg = arguments[0];
+ String maxArg = arguments[1];
+ boolean degree = minArg.endsWith("d");
+ if (degree ^ maxArg.endsWith("d")) {
+ throw new InputParseException("Cannot combine degree with block-step");
+ }
+ double min, max;
+ if (degree) {
+ double minDeg = Double.parseDouble(minArg.substring(0, minArg.length() - 1));
+ double maxDeg = Double.parseDouble(maxArg.substring(0, maxArg.length() - 1));
+ min = (Math.tan(minDeg * (Math.PI / 180)));
+ max = (Math.tan(maxDeg * (Math.PI / 180)));
+ } else {
+ min = Double.parseDouble(minArg);
+ max = Double.parseDouble(maxArg);
+ }
+
+ return new AngleMask(context.getExtent(), min, max, false, 1);
+ }
+}
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/BiomeMaskParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/BiomeMaskParser.java
index b578fd031..16122e313 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/BiomeMaskParser.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/BiomeMaskParser.java
@@ -77,6 +77,6 @@ public class BiomeMaskParser extends InputParser {
biomes.add(biome);
}
- return Masks.asMask(new BiomeMask2D(context.getExtent(), biomes));
+ return Masks.asMask(new BiomeMask2D(context.requireExtent(), biomes));
}
}
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/BlockCategoryMaskParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/BlockCategoryMaskParser.java
index 5fa9033b2..86b29e84e 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/BlockCategoryMaskParser.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/BlockCategoryMaskParser.java
@@ -53,7 +53,7 @@ public class BlockCategoryMaskParser extends InputParser {
if (category == null) {
throw new InputParseException("Unrecognised tag '" + input.substring(2) + '\'');
} else {
- return new BlockCategoryMask(context.getExtent(), category);
+ return new BlockCategoryMask(context.requireExtent(), category);
}
}
}
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/BlockStateMaskParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/BlockStateMaskParser.java
index ca47294b4..8b8060622 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/BlockStateMaskParser.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/BlockStateMaskParser.java
@@ -52,7 +52,7 @@ public class BlockStateMaskParser extends InputParser {
boolean strict = input.charAt(1) == '=';
String states = input.substring(2 + (strict ? 1 : 0), input.length() - 1);
try {
- return new BlockStateMask(context.getExtent(),
+ return new BlockStateMask(context.requireExtent(),
Splitter.on(',').omitEmptyStrings().trimResults().withKeyValueSeparator('=').split(states),
strict);
} catch (Exception e) {
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/BlocksMaskParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/BlocksMaskParser.java
index d66d59ba9..636903d41 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/BlocksMaskParser.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/BlocksMaskParser.java
@@ -21,7 +21,6 @@ package com.sk89q.worldedit.extension.factory.parser.mask;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.extension.input.InputParseException;
-import com.sk89q.worldedit.extension.input.NoMatchException;
import com.sk89q.worldedit.extension.input.ParserContext;
import com.sk89q.worldedit.function.mask.BlockMask;
import com.sk89q.worldedit.function.mask.Mask;
@@ -55,7 +54,7 @@ public class BlocksMaskParser extends InputParser {
if (holders.isEmpty()) {
return null;
}
- return new BlockMask(context.getExtent(), holders);
+ return new BlockMask(context.requireExtent(), holders);
} catch (InputParseException e) {
return null;
}
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/ExistingMaskParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/ExistingMaskParser.java
index 1f55824ae..389a401a7 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/ExistingMaskParser.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/ExistingMaskParser.java
@@ -21,6 +21,7 @@ package com.sk89q.worldedit.extension.factory.parser.mask;
import com.google.common.collect.ImmutableList;
import com.sk89q.worldedit.WorldEdit;
+import com.sk89q.worldedit.extension.input.InputParseException;
import com.sk89q.worldedit.extension.input.ParserContext;
import com.sk89q.worldedit.function.mask.ExistingBlockMask;
import com.sk89q.worldedit.function.mask.Mask;
@@ -42,7 +43,7 @@ public class ExistingMaskParser extends SimpleInputParser {
}
@Override
- public Mask parseFromSimpleInput(String input, ParserContext context) {
- return new ExistingBlockMask(context.getExtent());
+ public Mask parseFromSimpleInput(String input, ParserContext context) throws InputParseException {
+ return new ExistingBlockMask(context.requireExtent());
}
}
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/ExpressionMaskParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/ExpressionMaskParser.java
index 7438e2759..9ef5cba1a 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/ExpressionMaskParser.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/ExpressionMaskParser.java
@@ -57,7 +57,7 @@ public class ExpressionMaskParser extends InputParser {
try {
Expression exp = Expression.compile(input.substring(1), "x", "y", "z");
WorldEditExpressionEnvironment env = new WorldEditExpressionEnvironment(
- context.getExtent(), Vector3.ONE, Vector3.ZERO);
+ context.requireExtent(), Vector3.ONE, Vector3.ZERO);
exp.setEnvironment(env);
if (context.getActor() != null) {
SessionOwner owner = context.getActor();
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/LiquidMaskParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/LiquidMaskParser.java
index 444ac1c40..5ad703df2 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/LiquidMaskParser.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/LiquidMaskParser.java
@@ -5,7 +5,6 @@ import com.google.common.collect.ImmutableList;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.extension.input.ParserContext;
import com.sk89q.worldedit.function.mask.Mask;
-import com.sk89q.worldedit.function.mask.SolidBlockMask;
import com.sk89q.worldedit.internal.registry.SimpleInputParser;
import java.util.List;
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/OffsetMaskParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/OffsetMaskParser.java
index b6c222f2e..447125204 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/OffsetMaskParser.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/OffsetMaskParser.java
@@ -61,7 +61,7 @@ public class OffsetMaskParser extends InputParser {
if (input.length() > 1) {
submask = worldEdit.getMaskFactory().parseFromInput(input.substring(1), context);
} else {
- submask = new ExistingBlockMask(context.getExtent());
+ submask = new ExistingBlockMask(context.requireExtent());
}
OffsetMask offsetMask = new OffsetMask(submask, BlockVector3.at(0, firstChar == '>' ? -1 : 1, 0));
return new MaskIntersection(offsetMask, Masks.negate(submask));
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/SimplexMaskParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/SimplexMaskParser.java
new file mode 100644
index 000000000..450416839
--- /dev/null
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/SimplexMaskParser.java
@@ -0,0 +1,39 @@
+package com.sk89q.worldedit.extension.factory.parser.mask;
+
+import com.boydti.fawe.object.mask.SimplexMask;
+import com.sk89q.worldedit.WorldEdit;
+import com.sk89q.worldedit.extension.factory.parser.RichParser;
+import com.sk89q.worldedit.extension.input.InputParseException;
+import com.sk89q.worldedit.extension.input.ParserContext;
+import com.sk89q.worldedit.function.mask.Mask;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.stream.Stream;
+
+public class SimplexMaskParser extends RichParser {
+ private static final String SIMPLEX_PREFIX = "#simplex";
+
+ public SimplexMaskParser(WorldEdit worldEdit) {
+ super(worldEdit, SIMPLEX_PREFIX);
+ }
+
+ @Override
+ protected Stream getSuggestions(String argumentInput, int index) {
+ if (index < 3) {
+ suggestPositiveDoubles(argumentInput);
+ }
+ return Stream.empty();
+ }
+
+ @Override
+ protected Mask parseFromInput(@NotNull String[] arguments, ParserContext context) throws InputParseException {
+ if (arguments.length != 3) return null;
+ double scale = Double.parseDouble(arguments[0]);
+ double min = Double.parseDouble(arguments[1]);
+ double max = Double.parseDouble(arguments[2]);
+ scale = 1d / Math.max(1d, scale);
+ min = (min - 50d) / 50d;
+ max = (max - 50d) / 50d;
+ return new SimplexMask(scale, min, max);
+ }
+}
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/SolidMaskParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/SolidMaskParser.java
index 412240a64..f2c702d8c 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/SolidMaskParser.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/SolidMaskParser.java
@@ -21,6 +21,7 @@ package com.sk89q.worldedit.extension.factory.parser.mask;
import com.google.common.collect.ImmutableList;
import com.sk89q.worldedit.WorldEdit;
+import com.sk89q.worldedit.extension.input.InputParseException;
import com.sk89q.worldedit.extension.input.ParserContext;
import com.sk89q.worldedit.function.mask.Mask;
import com.sk89q.worldedit.function.mask.SolidBlockMask;
@@ -42,7 +43,7 @@ public class SolidMaskParser extends SimpleInputParser {
}
@Override
- public Mask parseFromSimpleInput(String input, ParserContext context) {
- return new SolidBlockMask(context.getExtent());
+ public Mask parseFromSimpleInput(String input, ParserContext context) throws InputParseException {
+ return new SolidBlockMask(context.requireExtent());
}
}
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/YAxisMaskParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/YAxisMaskParser.java
index 12108010d..f60ff0999 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/YAxisMaskParser.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/YAxisMaskParser.java
@@ -19,7 +19,6 @@
package com.sk89q.worldedit.extension.factory.parser.mask;
-import com.boydti.fawe.function.mask.XAxisMask;
import com.boydti.fawe.function.mask.YAxisMask;
import com.google.common.collect.ImmutableList;
import com.sk89q.worldedit.WorldEdit;
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/ZAxisMaskParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/ZAxisMaskParser.java
index 754c2876d..774f007bd 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/ZAxisMaskParser.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/ZAxisMaskParser.java
@@ -19,7 +19,6 @@
package com.sk89q.worldedit.extension.factory.parser.mask;
-import com.boydti.fawe.function.mask.XAxisMask;
import com.boydti.fawe.function.mask.ZAxisMask;
import com.google.common.collect.ImmutableList;
import com.sk89q.worldedit.WorldEdit;
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/SimplexPatternParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/SimplexPatternParser.java
index 547f96390..f8f4a0311 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/SimplexPatternParser.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/SimplexPatternParser.java
@@ -22,19 +22,7 @@ public class SimplexPatternParser extends RichParser {
@Override
protected Stream getSuggestions(String argumentInput, int index) {
if (index == 0) {
- if (argumentInput.isEmpty()) {
- return Stream.of("1", "2", "3", "4", "5", "6", "7", "8", "9");
- }
- // if already a valid number, suggest more digits
- if (isDouble(argumentInput)) {
- Stream numbers = Stream.of("", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9");
- if (argumentInput.indexOf('.') == -1) {
- numbers = Stream.concat(numbers, Stream.of("."));
- }
- return numbers.map(s -> argumentInput + s);
- }
- // no valid input anymore
- return Stream.empty();
+ return suggestPositiveDoubles(argumentInput);
}
if (index == 1) {
return worldEdit.getPatternFactory().getSuggestions(argumentInput).stream();
@@ -58,18 +46,4 @@ public class SimplexPatternParser extends RichParser {
throw new InputParseException("Pattern " + inner.getClass().getSimpleName() + " cannot be used with #simplex");
}
}
-
- private static boolean isDouble(String input) {
- boolean point = false;
- for (char c : input.toCharArray()) {
- if (!Character.isDigit(c)) {
- if (c == '.' && !point) {
- point = true;
- } else {
- return false;
- }
- }
- }
- return true;
- }
}
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/AbstractNonPlayerActor.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/AbstractNonPlayerActor.java
index a4aefaba2..448425e59 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/AbstractNonPlayerActor.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/AbstractNonPlayerActor.java
@@ -65,8 +65,7 @@ public abstract class AbstractNonPlayerActor implements Actor {
// Queue for async tasks
private AtomicInteger runningCount = new AtomicInteger();
- private AsyncNotifyQueue asyncNotifyQueue = new AsyncNotifyQueue(
- (thread, throwable) -> {
+ private AsyncNotifyQueue asyncNotifyQueue = new AsyncNotifyQueue((thread, throwable) -> {
while (throwable.getCause() != null) {
throwable = throwable.getCause();
}
@@ -83,11 +82,11 @@ public abstract class AbstractNonPlayerActor implements Actor {
});
/**
- * Run a task either async, or on the current thread
+ * Run a task either async, or on the current thread.
*
- * @param ifFree
+ * @param ifFree the task to run if free
* @param checkFree Whether to first check if a task is running
- * @param async
+ * @param async TODO Description
* @return false if the task was ran or queued
*/
@Override
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/AbstractPlayerActor.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/AbstractPlayerActor.java
index 4419f34f6..868711c7a 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/AbstractPlayerActor.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/AbstractPlayerActor.java
@@ -19,14 +19,12 @@
package com.sk89q.worldedit.extension.platform;
-import com.boydti.fawe.object.task.AsyncNotifyQueue;
-import com.sk89q.worldedit.EditSession;
-
-import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.boydti.fawe.object.exception.FaweException;
+import com.boydti.fawe.object.task.AsyncNotifyQueue;
import com.boydti.fawe.regions.FaweMaskManager;
import com.boydti.fawe.util.TaskManager;
import com.boydti.fawe.util.WEManager;
+import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.MaxChangedBlocksException;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.WorldEditException;
@@ -43,8 +41,6 @@ import com.sk89q.worldedit.regions.Polygonal2DRegion;
import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.regions.RegionSelector;
import com.sk89q.worldedit.regions.selector.ConvexPolyhedralRegionSelector;
-
-import javax.annotation.Nullable;
import com.sk89q.worldedit.regions.selector.CuboidRegionSelector;
import com.sk89q.worldedit.regions.selector.CylinderRegionSelector;
import com.sk89q.worldedit.regions.selector.Polygonal2DRegionSelector;
@@ -53,8 +49,10 @@ import com.sk89q.worldedit.util.HandSide;
import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.util.TargetBlock;
import com.sk89q.worldedit.util.auth.AuthorizationException;
+import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.block.BaseBlock;
+import com.sk89q.worldedit.world.block.BlockCategories;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.block.BlockType;
@@ -65,10 +63,12 @@ import com.sk89q.worldedit.world.gamemode.GameModes;
import com.sk89q.worldedit.world.item.ItemType;
import com.sk89q.worldedit.world.item.ItemTypes;
import com.sk89q.worldedit.world.registry.BlockMaterial;
+
import java.io.File;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicInteger;
+import javax.annotation.Nullable;
/**
* An abstract implementation of both a {@link Actor} and a {@link Player}
@@ -150,37 +150,45 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
public boolean isHoldingPickAxe() {
ItemType item = getItemInHand(HandSide.MAIN_HAND).getType();
return item == ItemTypes.IRON_PICKAXE
- || item == ItemTypes.WOODEN_PICKAXE
- || item == ItemTypes.STONE_PICKAXE
- || item == ItemTypes.DIAMOND_PICKAXE
- || item == ItemTypes.GOLDEN_PICKAXE;
+ || item == ItemTypes.WOODEN_PICKAXE
+ || item == ItemTypes.STONE_PICKAXE
+ || item == ItemTypes.DIAMOND_PICKAXE
+ || item == ItemTypes.GOLDEN_PICKAXE
+ || item == ItemTypes.NETHERITE_PICKAXE;
}
@Override
public void findFreePosition(Location searchPos) {
Extent world = searchPos.getExtent();
- int x = searchPos.getBlockX();
- int y = Math.max(0, searchPos.getBlockY());
- int origY = y;
- int yPlusSearchHeight = y + WorldEdit.getInstance().getConfiguration().defaultVerticalHeight;
- int z = searchPos.getBlockZ();
- int maxY = Math.min(255, yPlusSearchHeight) + 2;
+ int worldMinY = world.getMinimumPoint().getY();
+ int worldMaxY = world.getMaximumPoint().getY();
+
+ int x = searchPos.getBlockX();
+ int y = Math.max(worldMinY, searchPos.getBlockY());
+ int origY = y;
+ int z = searchPos.getBlockZ();
+ int yPlusSearchHeight = y + WorldEdit.getInstance().getConfiguration().defaultVerticalHeight;
+ int maxY = Math.min(worldMaxY, yPlusSearchHeight) + 2;
byte free = 0;
BlockVector3 mutablePos = MutableBlockVector3.ZERO;
while (y <= maxY) {
- if (!world.getBlock(mutablePos.setComponents(x, y, z)).getBlockType().getMaterial()
- .isMovementBlocker()) {
+ if (!world.getBlock(mutablePos.setComponents(x, y, z)).getBlockType().getMaterial().isMovementBlocker()) {
++free;
} else {
free = 0;
}
if (free == 2) {
+ boolean worked = true;
+
if (y - 1 != origY) {
- setPosition(Vector3.at(x + 0.5, y - 2 + 1, z + 0.5));
+ worked = trySetPosition(Vector3.at(x + 0.5, y - 2 + 1, z + 0.5));
+ }
+
+ if (worked) {
return;
}
}
@@ -192,15 +200,20 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
@Override
public void setOnGround(Location searchPos) {
Extent world = searchPos.getExtent();
- int x = searchPos.getBlockX();
- int y = Math.max(0, searchPos.getBlockY());
- int z = searchPos.getBlockZ();
- while (y >= 0) {
+ int worldMinY = world.getMinimumPoint().getY();
+
+ int x = searchPos.getBlockX();
+ int y = Math.max(worldMinY, searchPos.getBlockY());
+ int z = searchPos.getBlockZ();
+ int yLessSearchHeight = y - WorldEdit.getInstance().getConfiguration().defaultVerticalHeight;
+ int minY = Math.min(worldMinY, yLessSearchHeight) + 2;
+
+ while (y >= minY) {
final BlockVector3 pos = BlockVector3.at(x, y, z);
final BlockState id = world.getBlock(pos);
- if (id.getBlockType().getMaterial().isMovementBlocker()) {
- setPosition(Vector3.at(x + 0.5, y + +BlockTypeUtil.centralTopLimit(id), z + 0.5));
+ if (id.getBlockType().getMaterial().isMovementBlocker()
+ && trySetPosition(Vector3.at(x + 0.5, y + 1, z + 0.5))) {
return;
}
@@ -213,6 +226,33 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
findFreePosition(getBlockLocation());
}
+ /**
+ * Determines if the block at the given location "harms" the player, either by suffocation
+ * or other means.
+ */
+ private boolean isPlayerHarmingBlock(BlockVector3 location) {
+ BlockType type = getWorld().getBlock(location).getBlockType();
+ return type.getMaterial().isMovementBlocker() || type == BlockTypes.LAVA
+ || BlockCategories.FIRE.contains(type);
+ }
+
+ /**
+ * Check if the location is a good place to leave a standing player.
+ *
+ * @param location where the player would be placed (not Y offset)
+ * @return if the player can stand at the location
+ */
+ private boolean isLocationGoodForStanding(BlockVector3 location) {
+ if (isPlayerHarmingBlock(location.add(0, 1, 0))) {
+ return false;
+ }
+ if (isPlayerHarmingBlock(location)) {
+ return false;
+ }
+ return getWorld().getBlock(location.add(0, -1, 0)).getBlockType().getMaterial()
+ .isMovementBlocker();
+ }
+
@Override
public boolean ascendLevel() {
final Location pos = getBlockLocation();
@@ -247,21 +287,21 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
if (!lastState) {
lastState = BlockTypeUtil.centralBottomLimit(state) != 1;
continue;
- }
+ }
if (freeStart == -1) {
freeStart = level + BlockTypeUtil.centralTopLimit(state);
} else {
double bottomLimit = BlockTypeUtil.centralBottomLimit(state);
double space = level + bottomLimit - freeStart;
if (space >= height) {
- setPosition(Vector3.at(x + 0.5, freeStart, z + 0.5));
- return true;
- }
+ trySetPosition(Vector3.at(x + 0.5, freeStart, z + 0.5));
+ return true;
+ }
// Not enough room, reset the free position
if (bottomLimit != 1) {
freeStart = -1;
- }
- }
+ }
+ }
} else {
freeStart = -1;
lastState = true;
@@ -312,7 +352,7 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
double freeStart = level + topLimit;
double space = freeEnd - freeStart;
if (space >= height) {
- setPosition(Vector3.at(x + 0.5, freeStart, z + 0.5));
+ trySetPosition(Vector3.at(x + 0.5, freeStart, z + 0.5));
return true;
}
// Not enough room, reset the free position
@@ -350,8 +390,7 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
while (y <= world.getMaximumPoint().getY()) {
// Found a ceiling!
- if (world.getBlock(BlockVector3.at(x, y, z)).getBlockType().getMaterial()
- .isMovementBlocker()) {
+ if (world.getBlock(BlockVector3.at(x, y, z)).getBlockType().getMaterial().isMovementBlocker()) {
int platformY = Math.max(initialY, y - 3 - clearance);
if (platformY < initialY) { // if ==, they already have the given clearance, if <, clearance is too large
return false;
@@ -375,17 +414,16 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
@Override
public boolean ascendUpwards(int distance, boolean alwaysGlass) {
+ final World world = getWorld();
final Location pos = getBlockLocation();
final int x = pos.getBlockX();
final int initialY = Math.max(0, pos.getBlockY());
int y = Math.max(0, pos.getBlockY() + 1);
final int z = pos.getBlockZ();
- final int maxY = Math.min(getWorld().getMaxY() + 1, initialY + distance);
- final Extent world = getLocation().getExtent();
+ final int maxY = Math.min(world.getMaxY() + 1, initialY + distance);
- while (y <= world.getMaximumPoint().getY() + 2) {
- if (world.getBlock(BlockVector3.at(x, y, z)).getBlockType().getMaterial()
- .isMovementBlocker()) {
+ while (y <= world.getMaxY() + 2) {
+ if (world.getBlock(BlockVector3.at(x, y, z)).getBlockType().getMaterial().isMovementBlocker()) {
break; // Hit something
} else if (y > maxY + 1) {
break;
@@ -409,12 +447,12 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
try (EditSession session = WorldEdit.getInstance().getEditSessionFactory().getEditSession(world, 1, this)) {
session.setBlock(spot, BlockTypes.GLASS.getDefaultState());
} catch (MaxChangedBlocksException ignored) {
+ }
}
- }
} else {
setFlying(true);
}
- setPosition(Vector3.at(x + 0.5, y, z + 0.5));
+ trySetPosition(Vector3.at(x + 0.5, y, z + 0.5));
}
/**
@@ -473,7 +511,6 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
return getBlockTrace(range, false);
}
-
@Override
public Location getSolidBlockTrace(int range) {
TargetBlock tb = new TargetBlock(this, range, 0.2);
@@ -510,9 +547,6 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
return typeId.getBlockType().getDefaultState().toBaseBlock();
} else {
return BlockTypes.AIR.getDefaultState().toBaseBlock(); // FAWE returns air here
- /*
- throw new NotABlockException();
- */
}
}
@@ -523,7 +557,8 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
}
/**
- * Advances the block target block until the current block is a wall
+ * Advances the block target block until the current block is a wall.
+ *
* @return true if a wall is found
*/
private boolean advanceToWall(TargetBlock hitBlox) {
@@ -540,7 +575,8 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
}
/**
- * Advances the block target block until the current block is a free
+ * Advances the block target block until the current block is a free spot.
+ *
* @return true if a free spot is found
*/
private boolean advanceToFree(TargetBlock hitBlox) {
@@ -555,31 +591,32 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
return false;
}
+
@Override
public boolean passThroughForwardWall(int range) {
TargetBlock hitBlox = new TargetBlock(this, range, 0.2);
if (!advanceToWall(hitBlox)) {
return false;
- }
+ }
if (!advanceToFree(hitBlox)) {
- return false;
- }
+ return false;
+ }
Location foundBlock = hitBlox.getCurrentBlock();
if (foundBlock != null) {
setOnGround(foundBlock);
- return true;
- }
+ return true;
+ }
return false;
}
@Override
- public void setPosition(Vector3 pos) {
+ public boolean trySetPosition(Vector3 pos) {
final Location location = getLocation();
- setPosition(pos, location.getPitch(), location.getYaw());
+ return trySetPosition(pos, location.getPitch(), location.getYaw());
}
@Override
@@ -655,11 +692,11 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
}
/**
- * Run a task either async, or on the current thread
+ * Run a task either async, or on the current thread.
*
- * @param ifFree
+ * @param ifFree the task to run if free
* @param checkFree Whether to first check if a task is running
- * @param async
+ * @param async TODO description
* @return false if the task was ran or queued
*/
public boolean runAction(Runnable ifFree, boolean checkFree, boolean async) {
@@ -686,7 +723,7 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
/**
- * Get the player's current allowed WorldEdit regions
+ * Get the player's current allowed WorldEdit regions.
*
* @return an array of allowed regions
*/
@@ -699,7 +736,7 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
}
/**
- * Get the largest region in the player's allowed WorldEdit region
+ * Get the largest region in the player's allowed WorldEdit region.
*
* @return
*/
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/Actor.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/Actor.java
index e72fb2d1a..909f6817b 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/Actor.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/Actor.java
@@ -20,8 +20,6 @@
package com.sk89q.worldedit.extension.platform;
import com.boydti.fawe.Fawe;
-import com.sk89q.worldedit.util.formatting.text.TextComponent;
-import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.boydti.fawe.config.Settings;
import com.boydti.fawe.object.FaweLimit;
import com.boydti.fawe.object.brush.visualization.VirtualWorld;
@@ -173,7 +171,7 @@ public interface Actor extends Identifiable, SessionOwner, Subject, MapMetadatab
boolean runAction(Runnable ifFree, boolean checkFree, boolean async);
/**
- * Decline any pending actions
+ * Decline any pending actions.
* @return true if an action was pending
*/
default boolean decline() {
@@ -186,7 +184,7 @@ public interface Actor extends Identifiable, SessionOwner, Subject, MapMetadatab
}
/**
- * Confirm any pending actions
+ * Confirm any pending actions.
* @return true if an action was pending
*/
default boolean confirm() {
@@ -199,9 +197,9 @@ public interface Actor extends Identifiable, SessionOwner, Subject, MapMetadatab
}
/**
- * Queue an action to run async
+ * Queue an action to run async.
*
- * @param run
+ * @param run the action to run
*/
default void queueAction(Runnable run) {
runAction(run, false, true);
@@ -227,7 +225,7 @@ public interface Actor extends Identifiable, SessionOwner, Subject, MapMetadatab
}
/**
- * Attempt to cancel all pending and running actions
+ * Attempt to cancel all pending and running actions.
* @param close if Extents are closed
* @return number of cancelled actions
*/
@@ -252,8 +250,7 @@ public interface Actor extends Identifiable, SessionOwner, Subject, MapMetadatab
} catch (IOException e) {
e.printStackTrace();
}
- }
- else {
+ } else {
try {
world.close(false);
} catch (IOException e) {
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/Capability.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/Capability.java
index 0e43e960a..246b55704 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/Capability.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/Capability.java
@@ -19,11 +19,6 @@
package com.sk89q.worldedit.extension.platform;
-import com.sk89q.worldedit.internal.block.BlockStateIdAccess;
-import com.sk89q.worldedit.world.block.BlockState;
-import com.sk89q.worldedit.world.block.BlockType;
-import com.sk89q.worldedit.world.registry.BlockRegistry;
-
/**
* A collection of capabilities that a {@link Platform} may support.
*/
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/Locatable.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/Locatable.java
index cc25ab5c7..da50537cd 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/Locatable.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/Locatable.java
@@ -54,9 +54,27 @@ public interface Locatable {
* Sets the position of this actor.
*
* @param pos where to move them
+ * @deprecated This method may fail without indication. Use {@link #trySetPosition(Vector3)}
+ * instead
*/
+ @Deprecated
default void setPosition(Vector3 pos) {
- setLocation(new Location(getExtent(), pos));
+ trySetPosition(pos);
+ }
+
+ /**
+ * Attempts to set the position of this actor.
+ *
+ *
+ * This action may fail, due to other mods cancelling the move.
+ * If so, this method will return {@code false}.
+ *
+ *
+ * @param pos the position to set
+ * @return if the position was able to be set
+ */
+ default boolean trySetPosition(Vector3 pos) {
+ return setLocation(new Location(getExtent(), pos));
}
/**
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/Platform.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/Platform.java
index 1f92543aa..929bbefc4 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/Platform.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/Platform.java
@@ -27,11 +27,10 @@ import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.registry.Registries;
import org.enginehub.piston.CommandManager;
-import javax.annotation.Nullable;
-
import java.util.List;
import java.util.Map;
import java.util.Set;
+import javax.annotation.Nullable;
/**
* Represents a platform that WorldEdit has been implemented for.
@@ -177,5 +176,10 @@ public interface Platform {
*/
Map getCapabilities();
+ /**
+ * Get a set of {@link SideEffect}s supported by this platform.
+ *
+ * @return A set of supported side effects
+ */
Set getSupportedSideEffects();
}
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlatformCommandManager.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlatformCommandManager.java
index 2b533f170..475737f0d 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlatformCommandManager.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlatformCommandManager.java
@@ -19,8 +19,6 @@
package com.sk89q.worldedit.extension.platform;
-import static com.google.common.base.Preconditions.checkNotNull;
-
import com.boydti.fawe.Fawe;
import com.boydti.fawe.command.AnvilCommands;
import com.boydti.fawe.command.AnvilCommandsRegistration;
@@ -131,21 +129,6 @@ import com.sk89q.worldedit.util.formatting.text.format.TextColor;
import com.sk89q.worldedit.util.logging.DynamicStreamHandler;
import com.sk89q.worldedit.util.logging.LogFormat;
import com.sk89q.worldedit.world.World;
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import java.util.Optional;
-import java.util.function.BiConsumer;
-import java.util.function.Consumer;
-import java.util.logging.FileHandler;
-import java.util.logging.Level;
-import java.util.regex.Pattern;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-import javax.annotation.Nullable;
import org.enginehub.piston.Command;
import org.enginehub.piston.CommandManager;
import org.enginehub.piston.converter.ArgumentConverter;
@@ -171,6 +154,24 @@ import org.jetbrains.annotations.NotNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.Optional;
+import java.util.function.BiConsumer;
+import java.util.function.Consumer;
+import java.util.logging.FileHandler;
+import java.util.logging.Level;
+import java.util.regex.Pattern;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+import javax.annotation.Nullable;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
/**
* Handles the registration and invocation of commands.
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlatformManager.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlatformManager.java
index 6ce088ac3..da181a270 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlatformManager.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlatformManager.java
@@ -19,15 +19,11 @@
package com.sk89q.worldedit.extension.platform;
-import static com.google.common.base.Preconditions.checkNotNull;
-
import com.boydti.fawe.config.Settings;
-import com.boydti.fawe.wrappers.AsyncPlayer;
-import com.boydti.fawe.wrappers.LocationMaskedPlayerWrapper;
-import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.boydti.fawe.object.brush.visualization.VirtualWorld;
import com.boydti.fawe.object.exception.FaweException;
import com.boydti.fawe.object.pattern.PatternTraverser;
+import com.boydti.fawe.wrappers.LocationMaskedPlayerWrapper;
import com.boydti.fawe.wrappers.WorldWrapper;
import com.sk89q.worldedit.LocalConfiguration;
import com.sk89q.worldedit.LocalSession;
@@ -50,7 +46,11 @@ import com.sk89q.worldedit.session.request.Request;
import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.util.SideEffect;
import com.sk89q.worldedit.util.eventbus.Subscribe;
+import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.sk89q.worldedit.world.World;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import java.util.ArrayList;
import java.util.Collection;
import java.util.EnumMap;
@@ -60,8 +60,8 @@ import java.util.Map;
import java.util.Map.Entry;
import java.util.concurrent.atomic.AtomicBoolean;
import javax.annotation.Nullable;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+
+import static com.google.common.base.Preconditions.checkNotNull;
/**
* Manages registered {@link Platform}s for WorldEdit. Platforms are
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlayerProxy.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlayerProxy.java
index 6cd5dfa5f..aa8fa9359 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlayerProxy.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlayerProxy.java
@@ -19,8 +19,6 @@
package com.sk89q.worldedit.extension.platform;
-import static com.google.common.base.Preconditions.checkNotNull;
-
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.blocks.BaseItemStack;
import com.sk89q.worldedit.entity.BaseEntity;
@@ -37,12 +35,13 @@ import com.sk89q.worldedit.util.formatting.text.TextComponent;
import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockStateHolder;
-
-import java.util.Locale;
import com.sk89q.worldedit.world.gamemode.GameMode;
-import javax.annotation.Nullable;
+import java.util.Locale;
import java.util.UUID;
+import javax.annotation.Nullable;
+
+import static com.google.common.base.Preconditions.checkNotNull;
public class PlayerProxy extends AbstractPlayerActor {
@@ -131,8 +130,8 @@ public class PlayerProxy extends AbstractPlayerActor {
}
@Override
- public void setPosition(Vector3 pos, float pitch, float yaw) {
- basePlayer.setPosition(pos, pitch, yaw);
+ public boolean trySetPosition(Vector3 pos, float pitch, float yaw) {
+ return basePlayer.trySetPosition(pos, pitch, yaw);
}
@Override
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/binding/Bindings.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/binding/Bindings.java
index 5be75cf5f..19e50170f 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/binding/Bindings.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/binding/Bindings.java
@@ -1,13 +1,7 @@
package com.sk89q.worldedit.extension.platform.binding;
-import static org.slf4j.LoggerFactory.getLogger;
-
-import com.boydti.fawe.Fawe;
-import com.boydti.fawe.util.MainUtil;
import com.boydti.fawe.util.StringMan;
import com.sk89q.worldedit.WorldEdit;
-import com.sk89q.worldedit.internal.annotation.Selection;
-import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.util.formatting.text.Component;
import com.sk89q.worldedit.util.formatting.text.TextComponent;
import org.enginehub.piston.CommandManager;
@@ -17,14 +11,14 @@ import org.enginehub.piston.converter.SuccessfulConversion;
import org.enginehub.piston.inject.InjectedValueAccess;
import org.enginehub.piston.inject.InjectedValueStore;
import org.enginehub.piston.inject.Key;
-import org.enginehub.piston.util.ValueProvider;
import java.lang.annotation.Annotation;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Optional;
import java.util.function.Function;
-import java.util.function.Supplier;
+
+import static org.slf4j.LoggerFactory.getLogger;
public class Bindings {
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/binding/PrimitiveBindings.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/binding/PrimitiveBindings.java
index 7c5436818..af9cc9a68 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/binding/PrimitiveBindings.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/binding/PrimitiveBindings.java
@@ -9,6 +9,7 @@ import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.Vector2;
import com.sk89q.worldedit.math.Vector3;
+
import java.util.Locale;
import javax.annotation.Nullable;
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/binding/ProvideBindings.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/binding/ProvideBindings.java
index 1a50ad03f..3028007af 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/binding/ProvideBindings.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/binding/ProvideBindings.java
@@ -14,25 +14,12 @@ import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.extension.input.InputParseException;
import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.extent.Extent;
-import com.sk89q.worldedit.history.changeset.ChangeSet;
import com.sk89q.worldedit.internal.annotation.AllowedRegion;
import com.sk89q.worldedit.internal.annotation.Selection;
import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.session.request.Request;
-import com.sk89q.worldedit.util.TreeGenerator;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.sk89q.worldedit.world.World;
-import com.sk89q.worldedit.world.biome.BiomeType;
-import com.sk89q.worldedit.world.biome.BiomeTypes;
-import com.sk89q.worldedit.world.biome.Biomes;
-import com.sk89q.worldedit.world.block.BaseBlock;
-import com.sk89q.worldedit.world.block.BlockState;
-import com.sk89q.worldedit.world.block.BlockType;
-import com.sk89q.worldedit.world.registry.BiomeRegistry;
-import java.awt.image.BufferedImage;
-import java.net.URI;
-import java.util.Collection;
-import java.util.Optional;
import org.enginehub.piston.inject.InjectedValueAccess;
import org.enginehub.piston.inject.InjectedValueStore;
import org.enginehub.piston.inject.Key;
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/permission/ActorSelectorLimits.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/permission/ActorSelectorLimits.java
index 5712fcb4e..b8eecb071 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/permission/ActorSelectorLimits.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/permission/ActorSelectorLimits.java
@@ -19,8 +19,6 @@
package com.sk89q.worldedit.extension.platform.permission;
-import static com.google.common.base.Preconditions.checkNotNull;
-
import com.sk89q.worldedit.LocalConfiguration;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.extension.platform.Actor;
@@ -28,6 +26,8 @@ import com.sk89q.worldedit.regions.selector.limit.SelectorLimits;
import java.util.Optional;
+import static com.google.common.base.Preconditions.checkNotNull;
+
public class ActorSelectorLimits implements SelectorLimits {
private final LocalConfiguration configuration;
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/AbstractBufferingExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/AbstractBufferingExtent.java
index 98d5f3c04..e2f0fe2b4 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/AbstractBufferingExtent.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/AbstractBufferingExtent.java
@@ -20,6 +20,8 @@
package com.sk89q.worldedit.extent;
import com.sk89q.worldedit.WorldEditException;
+import com.sk89q.worldedit.internal.util.DeprecationUtil;
+import com.sk89q.worldedit.internal.util.NonAbstractForCompatibility;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockState;
@@ -68,22 +70,33 @@ public abstract class AbstractBufferingExtent extends AbstractDelegateExtent {
return block;
}
+ /**
+ * Gets a block from the buffer.
+ *
+ * @deprecated New subclasses should override {@link #getBufferedFullBlock(BlockVector3)}
+ * instead
+ */
@Deprecated
protected Optional getBufferedBlock(BlockVector3 position) {
throw new IllegalStateException("Invalid BufferingExtent provided. Must override `getBufferedFullBlock(BlockVector3)`.");
}
- //TODO make below abstract
/**
* Gets a block from the buffer, or null if not buffered.
*
- * This **must** be overridden, and will be abstract in WorldEdit 8.
- *
* @param position The position
* @return The buffered block, or null
+ * @apiNote This must be overridden by new subclasses. See {@link NonAbstractForCompatibility}
+ * for details
*/
+ @NonAbstractForCompatibility(
+ delegateName = "getBufferedBlock",
+ delegateParams = { BlockVector3.class }
+ )
@Nullable
protected BaseBlock getBufferedFullBlock(BlockVector3 position) {
+ DeprecationUtil.checkDelegatingOverride(getClass());
return getBufferedBlock(position).orElse(null);
}
+
}
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/AbstractDelegateExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/AbstractDelegateExtent.java
index 467de473d..bf46bfeaa 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/AbstractDelegateExtent.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/AbstractDelegateExtent.java
@@ -19,9 +19,6 @@
package com.sk89q.worldedit.extent;
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.slf4j.LoggerFactory.getLogger;
-
import com.boydti.fawe.beta.IBatchProcessor;
import com.boydti.fawe.config.Settings;
import com.boydti.fawe.object.HistoryExtent;
@@ -32,7 +29,6 @@ import com.sk89q.jnbt.CompoundTag;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.entity.BaseEntity;
import com.sk89q.worldedit.entity.Entity;
-import com.sk89q.worldedit.extension.platform.PlatformManager;
import com.sk89q.worldedit.extent.buffer.ForgetfulExtentBuffer;
import com.sk89q.worldedit.function.operation.Operation;
import com.sk89q.worldedit.function.operation.OperationQueue;
@@ -53,6 +49,11 @@ import org.jetbrains.annotations.Range;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import javax.annotation.Nullable;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static org.slf4j.LoggerFactory.getLogger;
+
/**
* A base class for {@link Extent}s that merely passes extents onto another.
*/
@@ -84,7 +85,7 @@ public class AbstractDelegateExtent implements Extent {
@Override
public BlockState getBlock(BlockVector3 position) {
- return extent.getBlock(position.getX(),position.getY(),position.getZ());
+ return extent.getBlock(position.getX(), position.getY(), position.getZ());
}
/*
@@ -198,8 +199,8 @@ public class AbstractDelegateExtent implements Extent {
}
@Override
- public > boolean setBlock(int x, @Range(from = 0, to = 255) int y, int z, T block)
- throws WorldEditException {
+ public > boolean setBlock(int x, @Range(from = 0, to = 255) int y,
+ int z, T block) throws WorldEditException {
return extent.setBlock(x, y, z, block);
}
@@ -252,7 +253,7 @@ public class AbstractDelegateExtent implements Extent {
public int getBrightness(int x, int y, int z) {
return extent.getBrightness(x, y, z);
}
-
+
@Override
public String toString() {
return super.toString() + ":" + (extent == this ? "" : extent.toString());
@@ -273,7 +274,8 @@ public class AbstractDelegateExtent implements Extent {
}
@Override
- public @Nullable Operation commit() {
+ public @Nullable
+ Operation commit() {
Operation ours = commitBefore();
Operation other = null;
if (extent != this) {
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/ChangeSetExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/ChangeSetExtent.java
index 0c3de3d4f..b03c0f62b 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/ChangeSetExtent.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/ChangeSetExtent.java
@@ -19,8 +19,6 @@
package com.sk89q.worldedit.extent;
-import static com.google.common.base.Preconditions.checkNotNull;
-
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.entity.BaseEntity;
import com.sk89q.worldedit.entity.Entity;
@@ -37,9 +35,11 @@ import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockStateHolder;
-import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.List;
+import javax.annotation.Nullable;
+
+import static com.google.common.base.Preconditions.checkNotNull;
/**
* Stores changes to a {@link ChangeSet}.
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/Extent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/Extent.java
index b9c20c8f0..caa5086a6 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/Extent.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/Extent.java
@@ -19,13 +19,10 @@
package com.sk89q.worldedit.extent;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import com.boydti.fawe.Fawe;
import com.boydti.fawe.FaweCache;
-import com.boydti.fawe.beta.implementation.filter.block.ExtentFilterBlock;
import com.boydti.fawe.beta.Filter;
import com.boydti.fawe.beta.IBatchProcessor;
+import com.boydti.fawe.beta.implementation.filter.block.ExtentFilterBlock;
import com.boydti.fawe.object.changeset.AbstractChangeSet;
import com.boydti.fawe.object.clipboard.WorldCopyClipboard;
import com.boydti.fawe.object.exception.FaweException;
@@ -76,9 +73,10 @@ import java.util.List;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.ThreadLocalRandom;
-
import javax.annotation.Nullable;
+import static com.google.common.base.Preconditions.checkNotNull;
+
/**
* A world, portion of a world, clipboard, or other object that can have blocks
* set or entities placed.
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/InputExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/InputExtent.java
index 134e29f95..1b531e12f 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/InputExtent.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/InputExtent.java
@@ -20,9 +20,10 @@
package com.sk89q.worldedit.extent;
import com.sk89q.worldedit.function.pattern.Pattern;
+import com.sk89q.worldedit.internal.util.DeprecationUtil;
+import com.sk89q.worldedit.internal.util.NonAbstractForCompatibility;
import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.math.BlockVector3;
-import com.sk89q.worldedit.math.MutableBlockVector2;
import com.sk89q.worldedit.math.MutableBlockVector3;
import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.block.BaseBlock;
@@ -77,17 +78,48 @@ public interface InputExtent {
*
* @param position the (x, z) location to check the biome at
* @return the biome at the location
+ * @deprecated Biomes in Minecraft are 3D now, use {@link InputExtent#getBiome(BlockVector3)}
*/
+ @Deprecated
default BiomeType getBiome(BlockVector2 position) {
return getBiomeType(position.getX(), 0, position.getZ());
}
default BiomeType getBiomeType(int x, int y, int z) {
- return getBiome(MutableBlockVector2.get(x, z));
+ return getBiome(MutableBlockVector3.get(x, y, z));
}
/**
- * Get the light level at the given location
+ * Get the biome at the given location.
+ *
+ *
+ * If there is no biome available, then the ocean biome should be
+ * returned.
+ *
+ *
+ *
+ * As implementation varies per Minecraft version, this may not exactly get
+ * this positions biome. On versions prior to 1.15, this will get the entire
+ * column. On later versions it will get the 4x4x4 cube's biome.
+ *
+ *
+ * @param position the (x, y, z) location to check the biome at
+ * @return the biome at the location
+ * @apiNote This must be overridden by new subclasses. See {@link NonAbstractForCompatibility}
+ * for details
+ */
+ @NonAbstractForCompatibility(
+ delegateName = "getBiome",
+ delegateParams = { BlockVector2.class }
+ )
+ default BiomeType getBiome(BlockVector3 position) {
+ DeprecationUtil.checkDelegatingOverride(getClass());
+
+ return getBiome(position.toBlockVector2());
+ }
+
+ /**
+ * Get the light level at the given location.
*
* @param position location
* @return the light level at the location
@@ -101,7 +133,7 @@ public interface InputExtent {
}
/**
- * Get the sky light level at the given location
+ * Get the sky light level at the given location.
*
* @param position location
* @return the sky light level at the location
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/NullExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/NullExtent.java
index c2bc8f7a7..8d033df9e 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/NullExtent.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/NullExtent.java
@@ -37,7 +37,6 @@ import com.sk89q.worldedit.world.block.BlockTypes;
import java.util.Collections;
import java.util.List;
-
import javax.annotation.Nullable;
/**
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/PassthroughExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/PassthroughExtent.java
index d6b387d94..5488ee124 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/PassthroughExtent.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/PassthroughExtent.java
@@ -20,6 +20,7 @@ import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.block.BlockType;
+
import java.util.List;
import java.util.Set;
import java.util.UUID;
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/buffer/ExtentBuffer.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/buffer/ExtentBuffer.java
index 699b73d43..6cdb36654 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/buffer/ExtentBuffer.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/buffer/ExtentBuffer.java
@@ -19,8 +19,6 @@
package com.sk89q.worldedit.extent.buffer;
-import static com.google.common.base.Preconditions.checkNotNull;
-
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.extent.AbstractBufferingExtent;
import com.sk89q.worldedit.extent.Extent;
@@ -30,8 +28,11 @@ import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.util.collection.BlockMap;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockStateHolder;
+
import java.util.Map;
+import static com.google.common.base.Preconditions.checkNotNull;
+
/**
* Buffers changes to an {@link Extent} and allows retrieval of the changed blocks,
* without modifying the underlying extent.
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/buffer/ForgetfulExtentBuffer.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/buffer/ForgetfulExtentBuffer.java
index 0c3aa726e..357fe5053 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/buffer/ForgetfulExtentBuffer.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/buffer/ForgetfulExtentBuffer.java
@@ -19,8 +19,6 @@
package com.sk89q.worldedit.extent.buffer;
-import static com.google.common.base.Preconditions.checkNotNull;
-
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.extent.AbstractDelegateExtent;
import com.sk89q.worldedit.extent.Extent;
@@ -31,18 +29,21 @@ import com.sk89q.worldedit.function.pattern.BiomePattern;
import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.math.BlockVector3;
+import com.sk89q.worldedit.regions.AbstractFlatRegion;
import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.regions.RegionOperationException;
import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.biome.BiomeTypes;
import com.sk89q.worldedit.world.block.BaseBlock;
-import com.sk89q.worldedit.regions.AbstractFlatRegion;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.block.BlockTypes;
+
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
+import static com.google.common.base.Preconditions.checkNotNull;
+
/**
* Buffers changes to an {@link Extent} and allows later retrieval for
* actual application of the changes.
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/BlockArrayClipboard.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/BlockArrayClipboard.java
index 4d0bb889f..1d3228c80 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/BlockArrayClipboard.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/BlockArrayClipboard.java
@@ -37,12 +37,12 @@ import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.block.BlockTypes;
+import org.jetbrains.annotations.NotNull;
-import javax.annotation.Nullable;
import java.util.Iterator;
import java.util.List;
import java.util.UUID;
-import org.jetbrains.annotations.NotNull;
+import javax.annotation.Nullable;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.stream.Collectors;
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/Clipboard.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/Clipboard.java
index bb416743c..b478a99c7 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/Clipboard.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/Clipboard.java
@@ -19,8 +19,6 @@
package com.sk89q.worldedit.extent.clipboard;
-import static com.google.common.base.Preconditions.checkNotNull;
-
import com.boydti.fawe.beta.Filter;
import com.boydti.fawe.config.Settings;
import com.boydti.fawe.object.clipboard.CPUOptimizedClipboard;
@@ -50,6 +48,8 @@ import com.sk89q.worldedit.regions.Regions;
import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.block.BaseBlock;
+import org.jetbrains.annotations.NotNull;
+
import java.io.Closeable;
import java.io.File;
import java.io.FileOutputStream;
@@ -59,7 +59,8 @@ import java.net.URI;
import java.util.Iterator;
import java.util.UUID;
import javax.annotation.Nullable;
-import org.jetbrains.annotations.NotNull;
+
+import static com.google.common.base.Preconditions.checkNotNull;
/**
* Specifies an object that implements something suitable as a "clipboard."
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/StoredEntity.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/StoredEntity.java
index ebece5abf..a44923892 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/StoredEntity.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/StoredEntity.java
@@ -19,13 +19,13 @@
package com.sk89q.worldedit.extent.clipboard;
-import static com.google.common.base.Preconditions.checkNotNull;
-
import com.sk89q.worldedit.entity.BaseEntity;
import com.sk89q.worldedit.entity.Entity;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.util.Location;
+import static com.google.common.base.Preconditions.checkNotNull;
+
/**
* An implementation of {@link Entity} that stores a {@link BaseEntity} with it.
*
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/BuiltInClipboardFormat.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/BuiltInClipboardFormat.java
index 9baaa2b21..6a6eb4f38 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/BuiltInClipboardFormat.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/BuiltInClipboardFormat.java
@@ -21,9 +21,8 @@ package com.sk89q.worldedit.extent.clipboard.io;
import com.boydti.fawe.object.io.PGZIPOutputStream;
import com.boydti.fawe.object.io.ResettableFileInputStream;
-import com.boydti.fawe.object.schematic.PNGWriter;
import com.boydti.fawe.object.schematic.MinecraftStructure;
-
+import com.boydti.fawe.object.schematic.PNGWriter;
import com.google.common.collect.ImmutableSet;
import com.sk89q.jnbt.NBTInputStream;
import com.sk89q.jnbt.NBTOutputStream;
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/ClipboardFormat.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/ClipboardFormat.java
index 67c589c26..91ec599c5 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/ClipboardFormat.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/ClipboardFormat.java
@@ -19,19 +19,15 @@
package com.sk89q.worldedit.extent.clipboard.io;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import com.boydti.fawe.config.Settings;
import com.boydti.fawe.object.RunnableVal;
import com.boydti.fawe.object.clipboard.URIClipboardHolder;
import com.boydti.fawe.object.io.PGZIPOutputStream;
import com.boydti.fawe.util.MainUtil;
-import com.google.gson.Gson;
import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.extent.clipboard.Clipboard;
-import com.sk89q.worldedit.math.BlockVector3;
+
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
@@ -39,9 +35,10 @@ import java.io.InputStream;
import java.io.OutputStream;
import java.net.URI;
import java.net.URL;
-import java.util.HashMap;
import java.util.Set;
+import static com.google.common.base.Preconditions.checkNotNull;
+
/**
* A collection of supported clipboard formats.
*/
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/ClipboardFormats.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/ClipboardFormats.java
index 509a69809..f3e6b6874 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/ClipboardFormats.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/ClipboardFormats.java
@@ -19,8 +19,6 @@
package com.sk89q.worldedit.extent.clipboard.io;
-import static com.google.common.base.Preconditions.checkNotNull;
-
import com.boydti.fawe.config.Caption;
import com.boydti.fawe.config.Settings;
import com.boydti.fawe.object.clipboard.LazyClipboardHolder;
@@ -36,6 +34,7 @@ import com.google.common.io.Files;
import com.sk89q.worldedit.LocalConfiguration;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.extension.platform.Actor;
+
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
@@ -59,6 +58,8 @@ import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import javax.annotation.Nullable;
+import static com.google.common.base.Preconditions.checkNotNull;
+
public class ClipboardFormats {
private static final Map aliasMap = new HashMap<>();
@@ -73,7 +74,9 @@ public class ClipboardFormats {
ClipboardFormat old = aliasMap.put(lowKey, format);
if (old != null) {
aliasMap.put(lowKey, old);
- WorldEdit.logger.warn(format.getClass().getName() + " cannot override existing alias '" + lowKey + "' used by " + old.getClass().getName());
+ WorldEdit.logger.warn(
+ format.getClass().getName() + " cannot override existing alias '" + lowKey
+ + "' used by " + old.getClass().getName());
}
}
for (String ext : format.getFileExtensions()) {
@@ -124,6 +127,7 @@ public class ClipboardFormats {
/**
* Detect the format using the given extension
+ *
* @param extension the extension
* @return the format, otherwise null if one cannot be detected
*/
@@ -132,8 +136,8 @@ public class ClipboardFormats {
checkNotNull(extension);
Collection> entries = getFileExtensionMap().entries();
- for(Map.Entry entry : entries) {
- if(entry.getKey().equalsIgnoreCase(extension)) {
+ for (Map.Entry entry : entries) {
+ if (entry.getKey().equalsIgnoreCase(extension)) {
return entry.getValue();
}
}
@@ -142,6 +146,8 @@ public class ClipboardFormats {
}
/**
+ * A mapping from extensions to formats.
+ *
* @return a multimap from a file extension to the potential matching formats.
*/
public static Multimap getFileExtensionMap() {
@@ -170,21 +176,27 @@ public class ClipboardFormats {
LocalConfiguration config = worldEdit.getConfiguration();
if (input.startsWith("url:")) {
if (!player.hasPermission("worldedit.schematic.load.web")) {
- if (message) player.print(Caption.of("fawe.error.no-perm", "worldedit.schematic.load.web"));
+ if (message) {
+ player.print(Caption.of("fawe.error.no-perm", "worldedit.schematic.load.web"));
+ }
return null;
}
URL base = new URL(Settings.IMP.WEB.URL);
- input = new URL(base, "uploads/" + input.substring(4) + "." + format.getPrimaryFileExtension()).toString();
+ input = new URL(base, "uploads/" + input.substring(4) + "."
+ + format.getPrimaryFileExtension()).toString();
}
if (input.startsWith("http")) {
return null;
}
- if (Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS && Pattern.compile("[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}").matcher(input).find() && !player.hasPermission("worldedit.schematic.load.other")) {
+ if (Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS
+ && Pattern.compile("[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}").matcher(input).find()
+ && !player.hasPermission("worldedit.schematic.load.other")) {
player.print(Caption.of("fawe.error.no-perm", "worldedit.schematic.load.other"));
return null;
}
File working = worldEdit.getWorkingDirectoryFile(config.saveDir);
- File dir = Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS ? new File(working, player.getUniqueId().toString()) : working;
+ File dir = Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS ?
+ new File(working, player.getUniqueId().toString()) : working;
File f;
if (input.startsWith("#")) {
String[] extensions;
@@ -195,12 +207,18 @@ public class ClipboardFormats {
}
f = player.openFileOpenDialog(extensions);
if (f == null || !f.exists()) {
- if (message) player.printError("Schematic " + input + " does not exist! (" + f + ")");
+ if (message) {
+ player.printError("Schematic " + input + " does not exist! (" + f + ")");
+ }
return null;
}
} else {
- if (Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS && Pattern.compile("[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}").matcher(input).find() && !player.hasPermission("worldedit.schematic.load.other")) {
- if (message) player.print(Caption.of("fawe.error.no-perm", "worldedit.schematic.load.other"));
+ if (Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS
+ && Pattern.compile("[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}").matcher(input).find()
+ && !player.hasPermission("worldedit.schematic.load.other")) {
+ if (message) {
+ player.print(Caption.of("fawe.error.no-perm", "worldedit.schematic.load.other"));
+ }
return null;
}
if (format == null && input.matches(".*\\.[\\w].*")) {
@@ -216,18 +234,24 @@ public class ClipboardFormats {
}
}
if (f == null || !f.exists() || !MainUtil.isInSubDirectory(working, f)) {
- if (message) player.printError("Schematic " + input + " does not exist! (" + ((f != null) && f.exists()) + "|" + f + "|" + (f != null && !MainUtil.isInSubDirectory(working, f)) + ")");
+ if (message) {
+ player.printError(
+ "Schematic " + input + " does not exist! (" + ((f != null) && f.exists()) + "|"
+ + f + "|" + (f != null && !MainUtil.isInSubDirectory(working, f)) + ")");
+ }
return null;
}
if (format == null && f.isFile()) {
format = findByFile(f);
if (format == null) {
- player.print(Caption.of("fawe.worldedit.clipboard.clipboard.invalid.format" , f.getName()));
+ player.print(Caption.of("fawe.worldedit.clipboard.clipboard.invalid.format", f.getName()));
return null;
}
}
if (!f.exists()) {
- if (message) player.print(Caption.of("fawe.error.schematic.not.found" , input));
+ if (message) {
+ player.print(Caption.of("fawe.error.schematic.not.found", input));
+ }
return null;
}
if (!f.isDirectory()) {
@@ -237,7 +261,9 @@ public class ClipboardFormats {
}
URIClipboardHolder[] clipboards = loadAllFromDirectory(f);
if (clipboards.length < 1) {
- if (message) player.print(Caption.of("fawe.error.schematic.not.found" , input));
+ if (message) {
+ player.print(Caption.of("fawe.error.schematic.not.found", input));
+ }
return null;
}
return new MultiClipboardHolder(f.toURI(), clipboards);
@@ -290,7 +316,9 @@ public class ClipboardFormats {
LazyClipboardHolder[] arr = clipboards.toArray(new LazyClipboardHolder[0]);
try {
MultiClipboardHolder multi = new MultiClipboardHolder(url.toURI());
- for (LazyClipboardHolder h : arr) multi.add(h);
+ for (LazyClipboardHolder h : arr) {
+ multi.add(h);
+ }
return multi;
} catch (URISyntaxException e) {
throw new RuntimeException(e);
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/ClipboardReader.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/ClipboardReader.java
index 974bf7616..a0c479040 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/ClipboardReader.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/ClipboardReader.java
@@ -22,6 +22,7 @@ package com.sk89q.worldedit.extent.clipboard.io;
import com.boydti.fawe.object.clipboard.DiskOptimizedClipboard;
import com.sk89q.worldedit.extent.clipboard.Clipboard;
import com.sk89q.worldedit.math.BlockVector3;
+
import java.io.Closeable;
import java.io.IOException;
import java.util.OptionalInt;
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/ClipboardWriter.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/ClipboardWriter.java
index c23306fd5..096a5e67f 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/ClipboardWriter.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/ClipboardWriter.java
@@ -24,9 +24,9 @@ import com.sk89q.jnbt.FloatTag;
import com.sk89q.jnbt.ListTag;
import com.sk89q.jnbt.Tag;
import com.sk89q.worldedit.extent.clipboard.Clipboard;
-
import com.sk89q.worldedit.math.Vector3;
import com.sk89q.worldedit.util.Location;
+
import java.io.Closeable;
import java.io.IOException;
import java.util.ArrayList;
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/MCEditSchematicReader.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/MCEditSchematicReader.java
index e20059636..cbd10c53e 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/MCEditSchematicReader.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/MCEditSchematicReader.java
@@ -20,8 +20,6 @@
package com.sk89q.worldedit.extent.clipboard.io;
import com.google.common.collect.ImmutableList;
-
-import static com.google.common.base.Preconditions.checkNotNull;
import com.sk89q.jnbt.ByteArrayTag;
import com.sk89q.jnbt.CompoundTag;
import com.sk89q.jnbt.IntTag;
@@ -60,12 +58,14 @@ import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Map;
-import java.util.HashSet;
import java.util.Set;
+import static com.google.common.base.Preconditions.checkNotNull;
+
/**
* Reads schematic files that are compatible with MCEdit and other editors.
* @deprecated Use SchematicStreamer
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/NBTSchematicReader.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/NBTSchematicReader.java
index 085d29531..2f85025c9 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/NBTSchematicReader.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/NBTSchematicReader.java
@@ -21,9 +21,9 @@ package com.sk89q.worldedit.extent.clipboard.io;
import com.sk89q.jnbt.Tag;
-import javax.annotation.Nullable;
import java.io.IOException;
import java.util.Map;
+import javax.annotation.Nullable;
/**
* Base class for NBT schematic readers
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/SchematicReader.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/SchematicReader.java
index 358edc19c..fcf335fce 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/SchematicReader.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/SchematicReader.java
@@ -19,12 +19,7 @@
package com.sk89q.worldedit.extent.clipboard.io;
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.slf4j.LoggerFactory.getLogger;
-
import com.boydti.fawe.FaweCache;
-import com.boydti.fawe.jnbt.streamer.InfoReader;
-import com.boydti.fawe.jnbt.streamer.IntValueReader;
import com.boydti.fawe.jnbt.streamer.StreamDelegate;
import com.boydti.fawe.jnbt.streamer.ValueReader;
import com.boydti.fawe.object.FaweInputStream;
@@ -48,8 +43,6 @@ import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.registry.state.PropertyKey;
import com.sk89q.worldedit.util.Direction;
import com.sk89q.worldedit.util.Location;
-import com.sk89q.worldedit.world.biome.BiomeType;
-import com.sk89q.worldedit.world.biome.BiomeTypes;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockCategories;
import com.sk89q.worldedit.world.block.BlockID;
@@ -61,6 +54,9 @@ import com.sk89q.worldedit.world.entity.EntityType;
import com.sk89q.worldedit.world.entity.EntityTypes;
import com.sk89q.worldedit.world.registry.BlockMaterial;
import com.sk89q.worldedit.world.registry.LegacyMapper;
+import net.jpountz.lz4.LZ4BlockInputStream;
+import net.jpountz.lz4.LZ4BlockOutputStream;
+
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
@@ -68,8 +64,9 @@ import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.function.Function;
-import net.jpountz.lz4.LZ4BlockInputStream;
-import net.jpountz.lz4.LZ4BlockOutputStream;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static org.slf4j.LoggerFactory.getLogger;
/**
* Reads schematic files based that are compatible with MCEdit and other editors.
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/SpongeSchematicWriter.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/SpongeSchematicWriter.java
index a461fbcc6..78fdd2303 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/SpongeSchematicWriter.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/SpongeSchematicWriter.java
@@ -19,8 +19,6 @@
package com.sk89q.worldedit.extent.clipboard.io;
-import static com.google.common.base.Preconditions.checkNotNull;
-
import com.google.common.collect.Maps;
import com.sk89q.jnbt.ByteArrayTag;
import com.sk89q.jnbt.CompoundTag;
@@ -54,6 +52,8 @@ import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
+import static com.google.common.base.Preconditions.checkNotNull;
+
/**
* Writes schematic files using the Sponge schematic format.
*/
@@ -292,4 +292,4 @@ public class SpongeSchematicWriter implements ClipboardWriter {
public void close() throws IOException {
outputStream.close();
}
-}
\ No newline at end of file
+}
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/inventory/BlockBagExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/inventory/BlockBagExtent.java
index c2187ff1b..c2ea290a3 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/inventory/BlockBagExtent.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/inventory/BlockBagExtent.java
@@ -20,7 +20,6 @@
package com.sk89q.worldedit.extent.inventory;
import com.boydti.fawe.FaweCache;
-import com.boydti.fawe.object.exception.FaweException;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.extent.AbstractDelegateExtent;
import com.sk89q.worldedit.extent.Extent;
@@ -29,6 +28,7 @@ import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.block.BlockTypes;
+
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/MultiStageReorder.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/MultiStageReorder.java
index 246eff4c7..ab1d96735 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/MultiStageReorder.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/MultiStageReorder.java
@@ -39,8 +39,6 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.Objects;
-import java.util.Optional;
/**
* Re-orders blocks into several stages.
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/transform/BlockTransformExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/transform/BlockTransformExtent.java
index be7f26b24..b9b444a15 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/transform/BlockTransformExtent.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/transform/BlockTransformExtent.java
@@ -18,23 +18,6 @@
*/
package com.sk89q.worldedit.extent.transform;
-import static com.sk89q.worldedit.util.Direction.ASCENDING_EAST;
-import static com.sk89q.worldedit.util.Direction.ASCENDING_NORTH;
-import static com.sk89q.worldedit.util.Direction.ASCENDING_SOUTH;
-import static com.sk89q.worldedit.util.Direction.ASCENDING_WEST;
-import static com.sk89q.worldedit.util.Direction.DOWN;
-import static com.sk89q.worldedit.util.Direction.EAST;
-import static com.sk89q.worldedit.util.Direction.Flag;
-import static com.sk89q.worldedit.util.Direction.NORTH;
-import static com.sk89q.worldedit.util.Direction.NORTHEAST;
-import static com.sk89q.worldedit.util.Direction.NORTHWEST;
-import static com.sk89q.worldedit.util.Direction.SOUTH;
-import static com.sk89q.worldedit.util.Direction.SOUTHEAST;
-import static com.sk89q.worldedit.util.Direction.SOUTHWEST;
-import static com.sk89q.worldedit.util.Direction.UP;
-import static com.sk89q.worldedit.util.Direction.WEST;
-import static com.sk89q.worldedit.util.Direction.findClosest;
-import static com.sk89q.worldedit.util.Direction.values;
import com.boydti.fawe.object.extent.ResettableExtent;
import com.sk89q.jnbt.ByteTag;
@@ -57,6 +40,9 @@ import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.block.BlockTypes;
+import com.sk89q.worldedit.world.block.BlockTypesCache;
+import org.jetbrains.annotations.NotNull;
+
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
@@ -65,10 +51,24 @@ import java.util.Locale;
import java.util.Map;
import javax.annotation.Nullable;
-import com.sk89q.worldedit.world.block.BlockTypesCache;
-import org.jetbrains.annotations.NotNull;
-
import static com.google.common.base.Preconditions.checkNotNull;
+import static com.sk89q.worldedit.util.Direction.ASCENDING_EAST;
+import static com.sk89q.worldedit.util.Direction.ASCENDING_NORTH;
+import static com.sk89q.worldedit.util.Direction.ASCENDING_SOUTH;
+import static com.sk89q.worldedit.util.Direction.ASCENDING_WEST;
+import static com.sk89q.worldedit.util.Direction.DOWN;
+import static com.sk89q.worldedit.util.Direction.EAST;
+import static com.sk89q.worldedit.util.Direction.Flag;
+import static com.sk89q.worldedit.util.Direction.NORTH;
+import static com.sk89q.worldedit.util.Direction.NORTHEAST;
+import static com.sk89q.worldedit.util.Direction.NORTHWEST;
+import static com.sk89q.worldedit.util.Direction.SOUTH;
+import static com.sk89q.worldedit.util.Direction.SOUTHEAST;
+import static com.sk89q.worldedit.util.Direction.SOUTHWEST;
+import static com.sk89q.worldedit.util.Direction.UP;
+import static com.sk89q.worldedit.util.Direction.WEST;
+import static com.sk89q.worldedit.util.Direction.findClosest;
+import static com.sk89q.worldedit.util.Direction.values;
/**
* Transforms blocks themselves (but not their position) according to a
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/validation/BlockChangeLimiter.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/validation/BlockChangeLimiter.java
index 7e89fa721..0ff2d4d1d 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/validation/BlockChangeLimiter.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/validation/BlockChangeLimiter.java
@@ -19,8 +19,6 @@
package com.sk89q.worldedit.extent.validation;
-import static com.google.common.base.Preconditions.checkArgument;
-
import com.sk89q.worldedit.MaxChangedBlocksException;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.extent.AbstractDelegateExtent;
@@ -28,6 +26,8 @@ import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.world.block.BlockStateHolder;
+import static com.google.common.base.Preconditions.checkArgument;
+
/**
* Limits the number of blocks that can be changed before a
* {@link MaxChangedBlocksException} is thrown.
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/validation/DataValidatorExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/validation/DataValidatorExtent.java
index 63ca586e6..376c6534c 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/validation/DataValidatorExtent.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/validation/DataValidatorExtent.java
@@ -19,8 +19,6 @@
package com.sk89q.worldedit.extent.validation;
-import static com.google.common.base.Preconditions.checkNotNull;
-
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.extent.AbstractDelegateExtent;
import com.sk89q.worldedit.extent.Extent;
@@ -29,6 +27,8 @@ import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.block.BlockType;
+import static com.google.common.base.Preconditions.checkNotNull;
+
/**
* Validates set data to prevent creating invalid blocks and such.
*/
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/BlockQuirkExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/BlockQuirkExtent.java
index 50f2a9a30..b87416080 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/BlockQuirkExtent.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/BlockQuirkExtent.java
@@ -19,8 +19,6 @@
package com.sk89q.worldedit.extent.world;
-import static com.google.common.base.Preconditions.checkNotNull;
-
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.extent.AbstractDelegateExtent;
import com.sk89q.worldedit.extent.Extent;
@@ -30,6 +28,8 @@ import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.block.BlockTypes;
+import static com.google.common.base.Preconditions.checkNotNull;
+
/**
* Handles various quirks when setting blocks, such as ice turning
* into water or containers dropping their contents.
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/ChunkLoadingExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/ChunkLoadingExtent.java
index a2ea51ed4..af139e40d 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/ChunkLoadingExtent.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/ChunkLoadingExtent.java
@@ -19,8 +19,6 @@
package com.sk89q.worldedit.extent.world;
-import static com.google.common.base.Preconditions.checkNotNull;
-
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.extent.AbstractDelegateExtent;
import com.sk89q.worldedit.extent.Extent;
@@ -30,6 +28,8 @@ import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.block.BlockStateHolder;
+import static com.google.common.base.Preconditions.checkNotNull;
+
/**
* Automatically loads chunks when blocks are accessed.
*/
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/SideEffectExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/SideEffectExtent.java
index 1a6b78505..f63a855e1 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/SideEffectExtent.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/SideEffectExtent.java
@@ -19,8 +19,6 @@
package com.sk89q.worldedit.extent.world;
-import static com.google.common.base.Preconditions.checkNotNull;
-
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.extent.AbstractDelegateExtent;
import com.sk89q.worldedit.function.operation.Operation;
@@ -39,6 +37,8 @@ import java.util.Iterator;
import java.util.Map;
import java.util.Set;
+import static com.google.common.base.Preconditions.checkNotNull;
+
/**
* An extent that sets blocks in the world, with a {@link SideEffectSet}.
*/
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/SurvivalModeExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/SurvivalModeExtent.java
index 941d49d13..637646e22 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/SurvivalModeExtent.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/SurvivalModeExtent.java
@@ -19,7 +19,6 @@
package com.sk89q.worldedit.extent.world;
-import static com.google.common.base.Preconditions.checkNotNull;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.extent.AbstractDelegateExtent;
import com.sk89q.worldedit.extent.Extent;
@@ -27,6 +26,8 @@ import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.block.BlockStateHolder;
+import static com.google.common.base.Preconditions.checkNotNull;
+
/**
* Makes changes to the world as if a player had done so during survival mode.
*
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/CombinedRegionFunction.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/CombinedRegionFunction.java
index 3ea4c642e..114cd7fd8 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/CombinedRegionFunction.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/CombinedRegionFunction.java
@@ -19,14 +19,15 @@
package com.sk89q.worldedit.function;
-import static com.google.common.base.Preconditions.checkNotNull;
-
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.math.BlockVector3;
+
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
+import static com.google.common.base.Preconditions.checkNotNull;
+
/**
* Executes several region functions in order.
*/
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/EditContext.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/EditContext.java
index b26f8d74f..9a048cd82 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/EditContext.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/EditContext.java
@@ -19,8 +19,6 @@
package com.sk89q.worldedit.function;
-import static com.google.common.base.Preconditions.checkNotNull;
-
import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.function.pattern.Pattern;
@@ -28,6 +26,8 @@ import com.sk89q.worldedit.regions.Region;
import javax.annotation.Nullable;
+import static com.google.common.base.Preconditions.checkNotNull;
+
public class EditContext {
private Extent destination;
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/EntityFunction.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/EntityFunction.java
index 9ce9915fa..6bbb669f0 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/EntityFunction.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/EntityFunction.java
@@ -21,7 +21,6 @@ package com.sk89q.worldedit.function;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.entity.Entity;
-import java.util.function.Predicate;
/**
* Applies a function to entities.
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/FlatRegionMaskingFilter.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/FlatRegionMaskingFilter.java
index 02b3f42d0..980ba9538 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/FlatRegionMaskingFilter.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/FlatRegionMaskingFilter.java
@@ -19,12 +19,12 @@
package com.sk89q.worldedit.function;
-import static com.google.common.base.Preconditions.checkNotNull;
-
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.function.mask.Mask2D;
import com.sk89q.worldedit.math.BlockVector2;
+import static com.google.common.base.Preconditions.checkNotNull;
+
/**
* Passes calls to {@link #apply(BlockVector2)} to the
* delegate {@link com.sk89q.worldedit.function.FlatRegionFunction} if they
@@ -54,4 +54,4 @@ public class FlatRegionMaskingFilter implements FlatRegionFunction {
return mask.test(position) && function.apply(position);
}
-}
\ No newline at end of file
+}
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/GroundFunction.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/GroundFunction.java
index 5e4c7c545..321f6ca81 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/GroundFunction.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/GroundFunction.java
@@ -19,12 +19,12 @@
package com.sk89q.worldedit.function;
-import static com.google.common.base.Preconditions.checkNotNull;
-
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.function.mask.Mask;
import com.sk89q.worldedit.math.BlockVector3;
+import static com.google.common.base.Preconditions.checkNotNull;
+
/**
* Applies a {@link RegionFunction} to the first ground block.
*/
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/RegionMaskTestFunction.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/RegionMaskTestFunction.java
index 1214497b7..6b4bd0cc7 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/RegionMaskTestFunction.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/RegionMaskTestFunction.java
@@ -19,12 +19,13 @@
package com.sk89q.worldedit.function;
-import static com.google.common.base.Preconditions.checkNotNull;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.extent.NullExtent;
import com.sk89q.worldedit.function.mask.Mask;
import com.sk89q.worldedit.math.BlockVector3;
+import static com.google.common.base.Preconditions.checkNotNull;
+
/**
* Passes calls to {@link #apply(BlockVector3)} to the
* delegate {@link RegionFunction} if they
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/RegionMaskingFilter.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/RegionMaskingFilter.java
index d1ab8957d..ffb0b4e47 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/RegionMaskingFilter.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/RegionMaskingFilter.java
@@ -19,13 +19,13 @@
package com.sk89q.worldedit.function;
-import static com.google.common.base.Preconditions.checkNotNull;
-
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.function.mask.Mask;
import com.sk89q.worldedit.math.BlockVector3;
+import static com.google.common.base.Preconditions.checkNotNull;
+
/**
* Passes calls to {@link #apply(BlockVector3)} to the
* delegate {@link com.sk89q.worldedit.function.RegionFunction} if they
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/biome/BiomeReplace.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/biome/BiomeReplace.java
index 9b98bd48d..0ec6c2c80 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/biome/BiomeReplace.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/biome/BiomeReplace.java
@@ -19,8 +19,6 @@
package com.sk89q.worldedit.function.biome;
-import static com.google.common.base.Preconditions.checkNotNull;
-
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.function.FlatRegionFunction;
@@ -28,6 +26,8 @@ import com.sk89q.worldedit.function.pattern.BiomePattern;
import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.world.biome.BiomeType;
+import static com.google.common.base.Preconditions.checkNotNull;
+
/**
* Replaces the biome at the locations that this function is applied to.
*/
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/biome/ExtentBiomeCopy.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/biome/ExtentBiomeCopy.java
index 94f3256f3..fa1ee8b34 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/biome/ExtentBiomeCopy.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/biome/ExtentBiomeCopy.java
@@ -19,8 +19,6 @@
package com.sk89q.worldedit.function.biome;
-import static com.google.common.base.Preconditions.checkNotNull;
-
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.function.FlatRegionFunction;
@@ -28,6 +26,8 @@ import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.math.transform.Transform;
import com.sk89q.worldedit.world.biome.BiomeType;
+import static com.google.common.base.Preconditions.checkNotNull;
+
/**
* Copies the biome from one extent to another.
*/
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/BlockReplace.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/BlockReplace.java
index 00fbcd553..460997585 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/BlockReplace.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/BlockReplace.java
@@ -19,14 +19,14 @@
package com.sk89q.worldedit.function.block;
-import static com.google.common.base.Preconditions.checkNotNull;
-
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.function.RegionFunction;
import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.math.BlockVector3;
+import static com.google.common.base.Preconditions.checkNotNull;
+
/**
* Replaces blocks with a given pattern.
*/
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/ExtentBlockCopy.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/ExtentBlockCopy.java
index 1e5c62873..9c5675a7f 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/ExtentBlockCopy.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/ExtentBlockCopy.java
@@ -19,8 +19,6 @@
package com.sk89q.worldedit.function.block;
-import static com.google.common.base.Preconditions.checkNotNull;
-
import com.sk89q.jnbt.CompoundTag;
import com.sk89q.jnbt.CompoundTagBuilder;
import com.sk89q.worldedit.WorldEditException;
@@ -34,6 +32,8 @@ import com.sk89q.worldedit.util.Direction;
import com.sk89q.worldedit.util.Direction.Flag;
import com.sk89q.worldedit.world.block.BaseBlock;
+import static com.google.common.base.Preconditions.checkNotNull;
+
/**
* Copies blocks from one extent to another.
*/
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/Naturalizer.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/Naturalizer.java
index 51886a60a..eb21f28fb 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/Naturalizer.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/Naturalizer.java
@@ -19,8 +19,6 @@
package com.sk89q.worldedit.function.block;
-import static com.google.common.base.Preconditions.checkNotNull;
-
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.function.LayerFunction;
@@ -30,6 +28,8 @@ import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockTypes;
+import static com.google.common.base.Preconditions.checkNotNull;
+
/**
* Makes a layer of grass on top, three layers of dirt below, and smooth stone
* only below that for all layers that originally consist of grass, dirt,
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/entity/ExtentEntityCopy.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/entity/ExtentEntityCopy.java
index 2ce4e64e4..b097b9eca 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/entity/ExtentEntityCopy.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/entity/ExtentEntityCopy.java
@@ -19,16 +19,8 @@
package com.sk89q.worldedit.function.entity;
-import com.boydti.fawe.util.ReflectionUtils;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import com.sk89q.jnbt.ByteTag;
import com.sk89q.jnbt.CompoundTag;
import com.sk89q.jnbt.CompoundTagBuilder;
-import com.sk89q.jnbt.FloatTag;
-import com.sk89q.jnbt.IntTag;
-import com.sk89q.jnbt.ListTag;
import com.sk89q.jnbt.Tag;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.entity.BaseEntity;
@@ -44,8 +36,7 @@ import com.sk89q.worldedit.util.Direction.Flag;
import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.world.entity.EntityTypes;
-import java.util.Arrays;
-import java.util.Map;
+import static com.google.common.base.Preconditions.checkNotNull;
/**
* Copies entities provided to the function to the provided destination
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/factory/Apply.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/factory/Apply.java
index 324fe72f1..7ff183a37 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/factory/Apply.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/factory/Apply.java
@@ -19,9 +19,6 @@
package com.sk89q.worldedit.function.factory;
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.sk89q.worldedit.util.GuavaUtil.firstNonNull;
-
import com.sk89q.worldedit.function.Contextual;
import com.sk89q.worldedit.function.EditContext;
import com.sk89q.worldedit.function.RegionFunction;
@@ -30,6 +27,9 @@ import com.sk89q.worldedit.function.visitor.RegionVisitor;
import com.sk89q.worldedit.regions.NullRegion;
import com.sk89q.worldedit.regions.Region;
+import static com.google.common.base.Preconditions.checkNotNull;
+import static com.sk89q.worldedit.util.GuavaUtil.firstNonNull;
+
public class Apply implements Contextual {
private final Region region;
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/factory/Deform.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/factory/Deform.java
index aab9adb8d..9d0f11d2d 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/factory/Deform.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/factory/Deform.java
@@ -19,9 +19,6 @@
package com.sk89q.worldedit.function.factory;
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.sk89q.worldedit.util.GuavaUtil.firstNonNull;
-
import com.google.common.collect.ImmutableList;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.LocalSession;
@@ -42,6 +39,9 @@ import com.sk89q.worldedit.util.formatting.text.TextComponent;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
+import static com.google.common.base.Preconditions.checkNotNull;
+import static com.sk89q.worldedit.util.GuavaUtil.firstNonNull;
+
public class Deform implements Contextual {
private Extent destination;
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/factory/Paint.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/factory/Paint.java
index 908608b81..4f1c1453b 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/factory/Paint.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/factory/Paint.java
@@ -19,12 +19,6 @@
package com.sk89q.worldedit.function.factory;
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.sk89q.worldedit.regions.Regions.asFlatRegion;
-import static com.sk89q.worldedit.regions.Regions.maximumBlockY;
-import static com.sk89q.worldedit.regions.Regions.minimumBlockY;
-import static com.sk89q.worldedit.util.GuavaUtil.firstNonNull;
-
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.extent.NullExtent;
import com.sk89q.worldedit.function.Contextual;
@@ -39,6 +33,12 @@ import com.sk89q.worldedit.math.noise.RandomNoise;
import com.sk89q.worldedit.regions.NullRegion;
import com.sk89q.worldedit.regions.Region;
+import static com.google.common.base.Preconditions.checkNotNull;
+import static com.sk89q.worldedit.regions.Regions.asFlatRegion;
+import static com.sk89q.worldedit.regions.Regions.maximumBlockY;
+import static com.sk89q.worldedit.regions.Regions.minimumBlockY;
+import static com.sk89q.worldedit.util.GuavaUtil.firstNonNull;
+
public class Paint implements Contextual {
private final Extent destination;
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/SchemGen.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/SchemGen.java
index 8e65302c9..598a219fd 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/SchemGen.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/SchemGen.java
@@ -1,13 +1,14 @@
package com.sk89q.worldedit.function.generator;
-import com.sk89q.worldedit.math.MutableBlockVector3;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.extent.clipboard.Clipboard;
import com.sk89q.worldedit.function.mask.Mask;
+import com.sk89q.worldedit.math.MutableBlockVector3;
import com.sk89q.worldedit.math.transform.AffineTransform;
import com.sk89q.worldedit.math.transform.Transform;
import com.sk89q.worldedit.session.ClipboardHolder;
+
import java.util.List;
import java.util.Random;
import java.util.concurrent.ThreadLocalRandom;
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/ABlockMask.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/ABlockMask.java
index 7ab06f2ff..b1bb9aaee 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/ABlockMask.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/ABlockMask.java
@@ -15,15 +15,13 @@ public abstract class ABlockMask extends AbstractExtentMask {
super(extent);
}
- @Override
- public boolean test(Extent extent, BlockVector3 vector) {
+ @Override public boolean test(Extent extent, BlockVector3 vector) {
return test(vector.getBlock(extent));
}
public abstract boolean test(BlockState state);
- @Override
- public String toString() {
+ @Override public String toString() {
List strings = new ArrayList<>();
for (BlockType type : BlockTypesCache.values) {
if (type != null) {
@@ -44,8 +42,7 @@ public abstract class ABlockMask extends AbstractExtentMask {
return StringMan.join(strings, ",");
}
- @Override
- public Mask tryCombine(Mask mask) {
+ @Override public Mask tryCombine(Mask mask) {
if (mask instanceof ABlockMask) {
ABlockMask other = (ABlockMask) mask;
BlockMask newMask = new BlockMask(getExtent());
@@ -57,14 +54,15 @@ public abstract class ABlockMask extends AbstractExtentMask {
}
}
Mask tmp = newMask.tryOptimize();
- if (tmp == null) tmp = newMask;
+ if (tmp == null) {
+ tmp = newMask;
+ }
return tmp;
}
return null;
}
- @Override
- public Mask tryOr(Mask mask) {
+ @Override public Mask tryOr(Mask mask) {
if (mask instanceof ABlockMask) {
ABlockMask other = (ABlockMask) mask;
BlockMask newMask = new BlockMask(getExtent());
@@ -76,7 +74,9 @@ public abstract class ABlockMask extends AbstractExtentMask {
}
}
Mask tmp = newMask.tryOptimize();
- if (tmp == null) tmp = newMask;
+ if (tmp == null) {
+ tmp = newMask;
+ }
return tmp;
}
return null;
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/AbstractExtentMask.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/AbstractExtentMask.java
index dd87fafdb..e7dc75dc5 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/AbstractExtentMask.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/AbstractExtentMask.java
@@ -19,11 +19,10 @@
package com.sk89q.worldedit.function.mask;
-import static com.google.common.base.Preconditions.checkNotNull;
-
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.math.BlockVector3;
-import com.sk89q.worldedit.session.request.Request;
+
+import static com.google.common.base.Preconditions.checkNotNull;
/**
* An abstract implementation of {@link Mask} that takes uses an {@link Extent}.
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BiomeMask2D.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BiomeMask2D.java
index 30124bb93..27ef80d40 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BiomeMask2D.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BiomeMask2D.java
@@ -19,8 +19,6 @@
package com.sk89q.worldedit.function.mask;
-import static com.google.common.base.Preconditions.checkNotNull;
-
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.world.biome.BiomeType;
@@ -30,6 +28,8 @@ import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
+import static com.google.common.base.Preconditions.checkNotNull;
+
/**
* Tests true if the biome at applied points is the same as the one given.
*/
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BlockCategoryMask.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BlockCategoryMask.java
index 5b679f748..fb5ce2387 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BlockCategoryMask.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BlockCategoryMask.java
@@ -19,13 +19,14 @@
package com.sk89q.worldedit.function.mask;
-import static com.google.common.base.Preconditions.checkNotNull;
-
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.world.block.BlockCategory;
+
import javax.annotation.Nullable;
+import static com.google.common.base.Preconditions.checkNotNull;
+
/**
* A mask that tests whether a block matches a given {@link BlockCategory}, or tag.
*/
@@ -37,6 +38,7 @@ public class BlockCategoryMask extends AbstractExtentMask {
super(extent);
checkNotNull(category);
this.category = category;
+ this.category.getAll(); // load category so BlockCategory#contains actually works
}
@Override
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BlockMask.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BlockMask.java
index 31259f5dd..160d1a28d 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BlockMask.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BlockMask.java
@@ -19,8 +19,6 @@
package com.sk89q.worldedit.function.mask;
-import static com.google.common.base.Preconditions.checkNotNull;
-
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.extent.NullExtent;
import com.sk89q.worldedit.math.BlockVector3;
@@ -38,6 +36,8 @@ import java.util.List;
import java.util.function.Predicate;
import javax.annotation.Nullable;
+import static com.google.common.base.Preconditions.checkNotNull;
+
/**
* A mask that checks whether blocks at the given positions are matched by
* a block in a list.
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BlockMaskBuilder.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BlockMaskBuilder.java
index 76bc67c8a..f075f735c 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BlockMaskBuilder.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BlockMaskBuilder.java
@@ -4,7 +4,6 @@ import com.boydti.fawe.command.SuggestInputParseException;
import com.boydti.fawe.object.collection.FastBitSet;
import com.boydti.fawe.object.string.MutableCharSequence;
import com.boydti.fawe.util.StringMan;
-
import com.sk89q.worldedit.extension.input.InputParseException;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.registry.state.AbstractProperty;
@@ -16,7 +15,17 @@ import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.block.BlockTypes;
import com.sk89q.worldedit.world.block.BlockTypesCache;
-import java.util.*;
+import java.util.AbstractMap;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.EnumSet;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Set;
import java.util.function.BiPredicate;
import java.util.function.Predicate;
import java.util.stream.Collectors;
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BlockTypeMask.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BlockTypeMask.java
index 2d420cd6c..36159f9b7 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BlockTypeMask.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BlockTypeMask.java
@@ -19,17 +19,18 @@
package com.sk89q.worldedit.function.mask;
-import static com.google.common.base.Preconditions.checkNotNull;
-
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.block.BlockTypes;
+import org.jetbrains.annotations.NotNull;
+
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
import javax.annotation.Nullable;
-import org.jetbrains.annotations.NotNull;
+
+import static com.google.common.base.Preconditions.checkNotNull;
/**
* A mask that checks whether blocks at the given positions are matched by
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BoundedHeightMask.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BoundedHeightMask.java
index fce4714c5..6c0c7a925 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BoundedHeightMask.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BoundedHeightMask.java
@@ -19,12 +19,13 @@
package com.sk89q.worldedit.function.mask;
-import static com.google.common.base.Preconditions.checkArgument;
-
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.math.BlockVector3;
+
import javax.annotation.Nullable;
+import static com.google.common.base.Preconditions.checkArgument;
+
/**
* Has the criteria where the Y value of passed positions must be within
* a certain range of Y values (inclusive).
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/ExistingBlockMask.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/ExistingBlockMask.java
index 730cb93aa..edef9f5b5 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/ExistingBlockMask.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/ExistingBlockMask.java
@@ -21,6 +21,7 @@ package com.sk89q.worldedit.function.mask;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.math.BlockVector3;
+
import javax.annotation.Nullable;
/**
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/ExpressionMask.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/ExpressionMask.java
index 55dd8e034..2385af935 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/ExpressionMask.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/ExpressionMask.java
@@ -19,17 +19,17 @@
package com.sk89q.worldedit.function.mask;
-import static com.google.common.base.Preconditions.checkNotNull;
-
import com.sk89q.worldedit.extent.Extent;
+import com.sk89q.worldedit.internal.expression.EvaluationException;
import com.sk89q.worldedit.internal.expression.Expression;
import com.sk89q.worldedit.internal.expression.ExpressionException;
-import com.sk89q.worldedit.internal.expression.EvaluationException;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.shape.WorldEditExpressionEnvironment;
-import javax.annotation.Nullable;
import java.util.function.IntSupplier;
+import javax.annotation.Nullable;
+
+import static com.google.common.base.Preconditions.checkNotNull;
/**
* A mask that evaluates an expression.
@@ -90,4 +90,4 @@ public class ExpressionMask extends AbstractMask {
return new ExpressionMask2D(expression, timeout);
}
-}
\ No newline at end of file
+}
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/ExpressionMask2D.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/ExpressionMask2D.java
index 123c0a54c..bf906f22e 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/ExpressionMask2D.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/ExpressionMask2D.java
@@ -19,16 +19,17 @@
package com.sk89q.worldedit.function.mask;
-import static com.google.common.base.Preconditions.checkNotNull;
-
import com.sk89q.worldedit.extent.Extent;
-import com.sk89q.worldedit.internal.expression.Expression;
import com.sk89q.worldedit.internal.expression.EvaluationException;
+import com.sk89q.worldedit.internal.expression.Expression;
import com.sk89q.worldedit.internal.expression.ExpressionException;
import com.sk89q.worldedit.math.BlockVector2;
+
import java.util.function.IntSupplier;
import javax.annotation.Nullable;
+import static com.google.common.base.Preconditions.checkNotNull;
+
public class ExpressionMask2D extends AbstractMask2D {
private final Expression expression;
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/InverseMask.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/InverseMask.java
index 9adc170ea..99bc0f869 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/InverseMask.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/InverseMask.java
@@ -1,10 +1,10 @@
package com.sk89q.worldedit.function.mask;
-import javax.annotation.Nullable;
-
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.math.BlockVector3;
+import javax.annotation.Nullable;
+
public class InverseMask extends AbstractMask {
private final Mask mask;
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/Mask.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/Mask.java
index 8a9c9a4aa..eb333069e 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/Mask.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/Mask.java
@@ -26,8 +26,8 @@ import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.extent.NullExtent;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.session.request.Request;
-
import org.jetbrains.annotations.Nullable;
+
import java.util.function.Consumer;
/**
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/MaskIntersection.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/MaskIntersection.java
index 26374f2cf..d10714aae 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/MaskIntersection.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/MaskIntersection.java
@@ -19,11 +19,9 @@
package com.sk89q.worldedit.function.mask;
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.slf4j.LoggerFactory.getLogger;
-
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.math.BlockVector3;
+
import java.util.AbstractMap;
import java.util.ArrayList;
import java.util.Arrays;
@@ -38,6 +36,9 @@ import java.util.Set;
import java.util.function.Function;
import javax.annotation.Nullable;
+import static com.google.common.base.Preconditions.checkNotNull;
+import static org.slf4j.LoggerFactory.getLogger;
+
/**
* Combines several masks and requires that all masks return true
* when a certain position is tested. It serves as a logical AND operation
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/MaskIntersection2D.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/MaskIntersection2D.java
index e10dfb53d..9eb4a3f82 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/MaskIntersection2D.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/MaskIntersection2D.java
@@ -19,8 +19,6 @@
package com.sk89q.worldedit.function.mask;
-import static com.google.common.base.Preconditions.checkNotNull;
-
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.math.BlockVector2;
@@ -29,6 +27,8 @@ import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
+import static com.google.common.base.Preconditions.checkNotNull;
+
/**
* Tests true if all contained masks test true.
*/
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/MaskUnion.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/MaskUnion.java
index 9ba06d73a..551c1f7c4 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/MaskUnion.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/MaskUnion.java
@@ -21,6 +21,7 @@ package com.sk89q.worldedit.function.mask;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.math.BlockVector3;
+
import java.util.ArrayList;
import java.util.Collection;
import java.util.LinkedHashSet;
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/Masks.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/Masks.java
index a255a0436..b6c141ff7 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/Masks.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/Masks.java
@@ -19,14 +19,14 @@
package com.sk89q.worldedit.function.mask;
-import static com.google.common.base.Preconditions.checkNotNull;
-
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.math.BlockVector3;
import javax.annotation.Nullable;
+import static com.google.common.base.Preconditions.checkNotNull;
+
/**
* Various utility functions related to {@link Mask} and {@link Mask2D}.
*/
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/NoiseFilter.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/NoiseFilter.java
index 22a77f209..909caefa9 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/NoiseFilter.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/NoiseFilter.java
@@ -19,15 +19,16 @@
package com.sk89q.worldedit.function.mask;
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.MutableVector3;
import com.sk89q.worldedit.math.noise.NoiseGenerator;
+
import javax.annotation.Nullable;
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkNotNull;
+
/**
* A mask that uses a noise generator and returns true whenever the noise
* generator returns a value above the given density.
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/NoiseFilter2D.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/NoiseFilter2D.java
index b4a7a5aad..0945f3143 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/NoiseFilter2D.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/NoiseFilter2D.java
@@ -19,13 +19,13 @@
package com.sk89q.worldedit.function.mask;
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.math.noise.NoiseGenerator;
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkNotNull;
+
/**
* A mask that uses a noise generator and returns true whenever the noise
* generator returns a value above the given density.
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/OffsetMask.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/OffsetMask.java
index d6a3dc7f6..d086f6c88 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/OffsetMask.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/OffsetMask.java
@@ -19,13 +19,13 @@
package com.sk89q.worldedit.function.mask;
-import static com.google.common.base.Preconditions.checkNotNull;
-
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.math.BlockVector3;
import javax.annotation.Nullable;
+import static com.google.common.base.Preconditions.checkNotNull;
+
/**
* Checks whether another mask tests true for a position that is offset
* a given vector.
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/OffsetMask2D.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/OffsetMask2D.java
index cb0832beb..cb7b2307f 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/OffsetMask2D.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/OffsetMask2D.java
@@ -19,12 +19,12 @@
package com.sk89q.worldedit.function.mask;
-import static com.google.common.base.Preconditions.checkNotNull;
-
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.math.MutableBlockVector2;
+import static com.google.common.base.Preconditions.checkNotNull;
+
/**
* Checks whether another mask tests true for a position that is offset
* a given vector.
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/RegionMask.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/RegionMask.java
index 10a02ca27..b35496e1a 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/RegionMask.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/RegionMask.java
@@ -19,14 +19,14 @@
package com.sk89q.worldedit.function.mask;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import com.boydti.fawe.Fawe;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.Region;
+
import javax.annotation.Nullable;
+import static com.google.common.base.Preconditions.checkNotNull;
+
/**
* A mask that tests whether given positions are contained within a region.
*/
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/SolidBlockMask.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/SolidBlockMask.java
index cf28fe38f..67b0ce75b 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/SolidBlockMask.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/SolidBlockMask.java
@@ -20,7 +20,6 @@
package com.sk89q.worldedit.function.mask;
import com.sk89q.worldedit.extent.Extent;
-import com.sk89q.worldedit.math.BlockVector3;
import javax.annotation.Nullable;
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/BackwardsExtentBlockCopy.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/BackwardsExtentBlockCopy.java
index 10e910dde..881781271 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/BackwardsExtentBlockCopy.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/BackwardsExtentBlockCopy.java
@@ -2,7 +2,6 @@ package com.sk89q.worldedit.function.operation;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.function.RegionFunction;
-import com.sk89q.worldedit.function.visitor.FlatRegionVisitor;
import com.sk89q.worldedit.function.visitor.RegionVisitor;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.MutableBlockVector3;
@@ -11,6 +10,7 @@ import com.sk89q.worldedit.math.Vector3;
import com.sk89q.worldedit.math.transform.Transform;
import com.sk89q.worldedit.regions.CuboidRegion;
import com.sk89q.worldedit.regions.Region;
+
import java.util.List;
public class BackwardsExtentBlockCopy extends RegionVisitor implements Operation {
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/ChangeSetExecutor.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/ChangeSetExecutor.java
index 1559d4bba..7168b3d60 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/ChangeSetExecutor.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/ChangeSetExecutor.java
@@ -19,16 +19,17 @@
package com.sk89q.worldedit.function.operation;
-import static com.google.common.base.Preconditions.checkNotNull;
-
import com.boydti.fawe.object.changeset.AbstractChangeSet;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.extent.inventory.BlockBag;
import com.sk89q.worldedit.history.UndoContext;
import com.sk89q.worldedit.history.change.Change;
import com.sk89q.worldedit.history.changeset.ChangeSet;
+
import java.util.Iterator;
+import static com.google.common.base.Preconditions.checkNotNull;
+
/**
* Performs an undo or redo from a given {@link ChangeSet}.
*/
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/DelegateOperation.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/DelegateOperation.java
index b0a881eae..6c1611455 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/DelegateOperation.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/DelegateOperation.java
@@ -19,14 +19,11 @@
package com.sk89q.worldedit.function.operation;
-import static com.google.common.base.Preconditions.checkNotNull;
-
import com.google.common.collect.Iterables;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.util.formatting.text.Component;
-import java.util.Collection;
-import java.util.List;
+import static com.google.common.base.Preconditions.checkNotNull;
/**
* Executes a delegete operation, but returns to another operation upon
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/ForwardExtentCopy.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/ForwardExtentCopy.java
index e12921516..5c8f188c4 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/ForwardExtentCopy.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/ForwardExtentCopy.java
@@ -19,7 +19,6 @@
package com.sk89q.worldedit.function.operation;
-import com.boydti.fawe.object.clipboard.DiskOptimizedClipboard;
import com.boydti.fawe.object.extent.BlockTranslateExtent;
import com.boydti.fawe.object.extent.PositionTransformExtent;
import com.boydti.fawe.object.function.block.BiomeCopy;
@@ -32,9 +31,6 @@ import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.entity.Entity;
import com.sk89q.worldedit.entity.metadata.EntityProperties;
import com.sk89q.worldedit.extent.Extent;
-import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
-import com.sk89q.worldedit.extent.clipboard.Clipboard;
-import com.sk89q.worldedit.extent.clipboard.io.FastSchematicReader;
import com.sk89q.worldedit.function.CombinedRegionFunction;
import com.sk89q.worldedit.function.RegionFunction;
import com.sk89q.worldedit.function.RegionMaskTestFunction;
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/OperationQueue.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/OperationQueue.java
index b9a9a36ab..09b45f8e0 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/OperationQueue.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/OperationQueue.java
@@ -19,8 +19,6 @@
package com.sk89q.worldedit.function.operation;
-import static com.google.common.base.Preconditions.checkNotNull;
-
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import com.sk89q.worldedit.WorldEditException;
@@ -32,6 +30,8 @@ import java.util.Deque;
import java.util.List;
import java.util.stream.Collectors;
+import static com.google.common.base.Preconditions.checkNotNull;
+
/**
* Executes multiple queues in order.
*/
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/SetBlockMap.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/SetBlockMap.java
index 99607ae16..ede81dea5 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/SetBlockMap.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/SetBlockMap.java
@@ -22,7 +22,6 @@ package com.sk89q.worldedit.function.operation;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.math.BlockVector3;
-import com.sk89q.worldedit.util.LocatedBlock;
import com.sk89q.worldedit.util.collection.BlockMap;
import com.sk89q.worldedit.world.block.BaseBlock;
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/SetLocatedBlocks.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/SetLocatedBlocks.java
index 2989bdcec..68c120904 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/SetLocatedBlocks.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/SetLocatedBlocks.java
@@ -19,13 +19,11 @@
package com.sk89q.worldedit.function.operation;
-import static com.google.common.base.Preconditions.checkNotNull;
-
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.util.LocatedBlock;
-import java.util.List;
+import static com.google.common.base.Preconditions.checkNotNull;
public class SetLocatedBlocks implements Operation {
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/BlockPattern.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/BlockPattern.java
index a934bc17a..d2b516fd4 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/BlockPattern.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/BlockPattern.java
@@ -19,12 +19,12 @@
package com.sk89q.worldedit.function.pattern;
-import static com.google.common.base.Preconditions.checkNotNull;
-
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockStateHolder;
+import static com.google.common.base.Preconditions.checkNotNull;
+
/**
* A pattern that returns the same {@link BaseBlock} each time.
*
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/RandomPattern.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/RandomPattern.java
index 3e02cdfaa..3539a110c 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/RandomPattern.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/RandomPattern.java
@@ -22,8 +22,6 @@ package com.sk89q.worldedit.function.pattern;
import com.boydti.fawe.object.collection.RandomCollection;
import com.boydti.fawe.object.random.SimpleRandom;
import com.boydti.fawe.object.random.TrueRandom;
-
-import static com.google.common.base.Preconditions.checkNotNull;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.math.BlockVector3;
@@ -34,6 +32,8 @@ import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Set;
+import static com.google.common.base.Preconditions.checkNotNull;
+
/**
* Uses a random pattern of a weighted list of patterns.
*/
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/RepeatingExtentPattern.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/RepeatingExtentPattern.java
index 0746ac06b..cfef0cf92 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/RepeatingExtentPattern.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/RepeatingExtentPattern.java
@@ -19,14 +19,13 @@
package com.sk89q.worldedit.function.pattern;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.MutableBlockVector3;
import com.sk89q.worldedit.world.block.BaseBlock;
+import static com.google.common.base.Preconditions.checkNotNull;
+
/**
* Returns the blocks from {@link Extent}, repeating when out of bounds.
*/
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/WaterloggedRemover.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/WaterloggedRemover.java
index a8610b80d..d84b2d2ac 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/WaterloggedRemover.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/WaterloggedRemover.java
@@ -21,7 +21,6 @@ package com.sk89q.worldedit.function.pattern;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.math.BlockVector3;
-import com.sk89q.worldedit.registry.state.Property;
import com.sk89q.worldedit.registry.state.PropertyKey;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockState;
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/util/FlatRegionOffset.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/util/FlatRegionOffset.java
index 9682ff378..f21368c72 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/util/FlatRegionOffset.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/util/FlatRegionOffset.java
@@ -19,12 +19,12 @@
package com.sk89q.worldedit.function.util;
-import static com.google.common.base.Preconditions.checkNotNull;
-
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.function.FlatRegionFunction;
import com.sk89q.worldedit.math.BlockVector2;
+import static com.google.common.base.Preconditions.checkNotNull;
+
/**
* Offsets the position parameter by adding a given offset vector.
*/
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/util/RegionOffset.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/util/RegionOffset.java
index 7ac57da1f..b721d7dbb 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/util/RegionOffset.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/util/RegionOffset.java
@@ -19,12 +19,12 @@
package com.sk89q.worldedit.function.util;
-import static com.google.common.base.Preconditions.checkNotNull;
-
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.function.RegionFunction;
import com.sk89q.worldedit.math.BlockVector3;
+import static com.google.common.base.Preconditions.checkNotNull;
+
/**
* Offsets the position parameter by adding a given offset vector.
*/
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/BreadthFirstSearch.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/BreadthFirstSearch.java
index e85b7a4f1..8ae8a7168 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/BreadthFirstSearch.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/BreadthFirstSearch.java
@@ -19,12 +19,8 @@
package com.sk89q.worldedit.function.visitor;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import com.google.common.collect.ImmutableList;
-
-import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.boydti.fawe.object.collection.BlockVectorSet;
+import com.google.common.collect.ImmutableList;
import com.google.common.collect.Sets;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.function.RegionFunction;
@@ -32,16 +28,20 @@ import com.sk89q.worldedit.function.operation.Operation;
import com.sk89q.worldedit.function.operation.RunContext;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.MutableBlockVector3;
-import com.sk89q.worldedit.util.formatting.text.Component;
import com.sk89q.worldedit.util.Direction;
+import com.sk89q.worldedit.util.formatting.text.Component;
import com.sk89q.worldedit.util.formatting.text.TextComponent;
+import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
+
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
+import static com.google.common.base.Preconditions.checkNotNull;
+
/**
* Performs a breadth-first search starting from points added with
* {@link #visit(BlockVector3)}. The search continues
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/DownwardVisitor.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/DownwardVisitor.java
index 3d03c6c49..3283d24c6 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/DownwardVisitor.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/DownwardVisitor.java
@@ -19,12 +19,12 @@
package com.sk89q.worldedit.function.visitor;
-import static com.google.common.base.Preconditions.checkNotNull;
-
import com.sk89q.worldedit.function.RegionFunction;
import com.sk89q.worldedit.function.mask.Mask;
import com.sk89q.worldedit.math.BlockVector3;
+import static com.google.common.base.Preconditions.checkNotNull;
+
/**
* Visits adjacent points on the same X-Z plane as long as the points
* pass the given mask, and then executes the provided region
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/EntityVisitor.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/EntityVisitor.java
index 9d4405ca2..3d0444cf7 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/EntityVisitor.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/EntityVisitor.java
@@ -20,22 +20,19 @@
package com.sk89q.worldedit.function.visitor;
import com.google.common.collect.ImmutableList;
-import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import com.google.common.collect.Lists;
-
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.entity.Entity;
import com.sk89q.worldedit.function.EntityFunction;
import com.sk89q.worldedit.function.operation.Operation;
import com.sk89q.worldedit.function.operation.RunContext;
import com.sk89q.worldedit.util.formatting.text.Component;
+import com.sk89q.worldedit.util.formatting.text.TextComponent;
+import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
+import com.sk89q.worldedit.util.formatting.text.format.TextColor;
import java.util.Iterator;
-import com.sk89q.worldedit.util.formatting.text.TextComponent;
-import com.sk89q.worldedit.util.formatting.text.format.TextColor;
+
+import static com.google.common.base.Preconditions.checkNotNull;
/**
* Visits entities as provided by an {@code Iterator}.
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/FlatRegionVisitor.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/FlatRegionVisitor.java
index 799f69bb1..d15557670 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/FlatRegionVisitor.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/FlatRegionVisitor.java
@@ -20,21 +20,19 @@
package com.sk89q.worldedit.function.visitor;
import com.google.common.collect.ImmutableList;
-import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
-
-import com.google.common.collect.Lists;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.function.FlatRegionFunction;
import com.sk89q.worldedit.function.operation.Operation;
import com.sk89q.worldedit.function.operation.RunContext;
import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.regions.FlatRegion;
-
-import static com.google.common.base.Preconditions.checkNotNull;
import com.sk89q.worldedit.util.formatting.text.Component;
import com.sk89q.worldedit.util.formatting.text.TextComponent;
+import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
+import static com.google.common.base.Preconditions.checkNotNull;
+
/**
* Applies region functions to columns in a {@link FlatRegion}.
*/
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/LayerVisitor.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/LayerVisitor.java
index 3fed7f678..b3b49a2b1 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/LayerVisitor.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/LayerVisitor.java
@@ -19,9 +19,6 @@
package com.sk89q.worldedit.function.visitor;
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.function.LayerFunction;
import com.sk89q.worldedit.function.mask.Mask2D;
@@ -32,7 +29,8 @@ import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.FlatRegion;
-import java.util.List;
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkNotNull;
/**
* Visits the layers within a region.
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/NonRisingVisitor.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/NonRisingVisitor.java
index 1bafdb45d..ca3396675 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/NonRisingVisitor.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/NonRisingVisitor.java
@@ -23,8 +23,6 @@ import com.sk89q.worldedit.function.RegionFunction;
import com.sk89q.worldedit.function.mask.Mask;
import com.sk89q.worldedit.math.BlockVector3;
-import java.util.Collection;
-
/**
* A {@link RecursiveVisitor} that goes orthogonally to the side and down, but never up.
*/
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/RecursiveVisitor.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/RecursiveVisitor.java
index 0ce97d0c8..62ffb185e 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/RecursiveVisitor.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/RecursiveVisitor.java
@@ -19,12 +19,12 @@
package com.sk89q.worldedit.function.visitor;
-import static com.google.common.base.Preconditions.checkNotNull;
-
import com.sk89q.worldedit.function.RegionFunction;
import com.sk89q.worldedit.function.mask.Mask;
import com.sk89q.worldedit.math.BlockVector3;
+import static com.google.common.base.Preconditions.checkNotNull;
+
/**
* An implementation of an {@link BreadthFirstSearch} that uses a mask to
* determine where a block should be visited.
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/ScanChunk.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/ScanChunk.java
index 7e8b00667..92ebb7673 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/ScanChunk.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/ScanChunk.java
@@ -4,6 +4,7 @@ import com.sk89q.worldedit.function.RegionFunction;
import com.sk89q.worldedit.math.BlockVector3;
import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap;
import it.unimi.dsi.fastutil.longs.LongArraySet;
+
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ConcurrentLinkedQueue;
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/history/change/BiomeChange.java b/worldedit-core/src/main/java/com/sk89q/worldedit/history/change/BiomeChange.java
index f8c0ef597..8ca920042 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/history/change/BiomeChange.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/history/change/BiomeChange.java
@@ -19,14 +19,14 @@
package com.sk89q.worldedit.history.change;
-import static com.google.common.base.Preconditions.checkNotNull;
-
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.history.UndoContext;
import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.world.biome.BiomeType;
+import static com.google.common.base.Preconditions.checkNotNull;
+
/**
* Represents a biome change that may be undone or replayed.
*
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/history/change/BlockChange.java b/worldedit-core/src/main/java/com/sk89q/worldedit/history/change/BlockChange.java
index ce7c26926..637c4375d 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/history/change/BlockChange.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/history/change/BlockChange.java
@@ -19,8 +19,6 @@
package com.sk89q.worldedit.history.change;
-import static com.google.common.base.Preconditions.checkNotNull;
-
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.history.UndoContext;
@@ -28,6 +26,8 @@ import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockStateHolder;
+import static com.google.common.base.Preconditions.checkNotNull;
+
/**
* Represents a block change that may be undone or replayed.
*
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/history/change/EntityCreate.java b/worldedit-core/src/main/java/com/sk89q/worldedit/history/change/EntityCreate.java
index e406f8403..79330510e 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/history/change/EntityCreate.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/history/change/EntityCreate.java
@@ -19,14 +19,14 @@
package com.sk89q.worldedit.history.change;
-import static com.google.common.base.Preconditions.checkNotNull;
-
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.entity.BaseEntity;
import com.sk89q.worldedit.entity.Entity;
import com.sk89q.worldedit.history.UndoContext;
import com.sk89q.worldedit.util.Location;
+import static com.google.common.base.Preconditions.checkNotNull;
+
/**
* Logs the creation of an entity and removes the entity upon undo.
*/
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/history/change/EntityRemove.java b/worldedit-core/src/main/java/com/sk89q/worldedit/history/change/EntityRemove.java
index 3af1c4072..8ad6c9ae0 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/history/change/EntityRemove.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/history/change/EntityRemove.java
@@ -19,14 +19,14 @@
package com.sk89q.worldedit.history.change;
-import static com.google.common.base.Preconditions.checkNotNull;
-
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.entity.BaseEntity;
import com.sk89q.worldedit.entity.Entity;
import com.sk89q.worldedit.history.UndoContext;
import com.sk89q.worldedit.util.Location;
+import static com.google.common.base.Preconditions.checkNotNull;
+
/**
* Tracks the removal of an entity.
*/
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/history/changeset/ArrayListHistory.java b/worldedit-core/src/main/java/com/sk89q/worldedit/history/changeset/ArrayListHistory.java
index 47c957419..f9d31b78f 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/history/changeset/ArrayListHistory.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/history/changeset/ArrayListHistory.java
@@ -19,8 +19,6 @@
package com.sk89q.worldedit.history.changeset;
-import static com.google.common.base.Preconditions.checkNotNull;
-
import com.boydti.fawe.object.changeset.SimpleChangeSetSummary;
import com.google.common.collect.Lists;
import com.sk89q.worldedit.history.change.BlockChange;
@@ -32,6 +30,8 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
+import static com.google.common.base.Preconditions.checkNotNull;
+
/**
* Stores all {@link Change}s in an {@link ArrayList}.
*/
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/history/changeset/BlockOptimizedHistory.java b/worldedit-core/src/main/java/com/sk89q/worldedit/history/changeset/BlockOptimizedHistory.java
index 05ac90c78..8d01e153f 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/history/changeset/BlockOptimizedHistory.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/history/changeset/BlockOptimizedHistory.java
@@ -19,8 +19,6 @@
package com.sk89q.worldedit.history.changeset;
-import static com.google.common.base.Preconditions.checkNotNull;
-
import com.google.common.collect.Iterators;
import com.sk89q.worldedit.history.change.BlockChange;
import com.sk89q.worldedit.history.change.Change;
@@ -31,6 +29,8 @@ import com.sk89q.worldedit.util.collection.LocatedBlockList;
import java.util.ArrayList;
import java.util.Iterator;
+import static com.google.common.base.Preconditions.checkNotNull;
+
/**
* An extension of {@link ArrayListHistory} that stores {@link BlockChange}s
* separately in two {@link ArrayList}s.
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/history/changeset/ChangeSetSummary.java b/worldedit-core/src/main/java/com/sk89q/worldedit/history/changeset/ChangeSetSummary.java
index 78e4a8b8a..b8367ea3b 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/history/changeset/ChangeSetSummary.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/history/changeset/ChangeSetSummary.java
@@ -2,7 +2,6 @@ package com.sk89q.worldedit.history.changeset;
import com.sk89q.worldedit.util.Countable;
import com.sk89q.worldedit.world.block.BlockState;
-import com.sk89q.worldedit.world.block.BlockTypesCache;
import java.util.ArrayList;
import java.util.HashMap;
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/anvil/ChunkDeleter.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/anvil/ChunkDeleter.java
index 665210694..d0f25e16a 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/anvil/ChunkDeleter.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/anvil/ChunkDeleter.java
@@ -38,7 +38,6 @@ import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;
-import java.nio.file.StandardOpenOption;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/block/BlockStateIdAccess.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/block/BlockStateIdAccess.java
index 5447b944a..67eda6795 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/block/BlockStateIdAccess.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/block/BlockStateIdAccess.java
@@ -23,9 +23,9 @@ import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.registry.BlockRegistry;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
-import javax.annotation.Nullable;
import java.util.BitSet;
import java.util.OptionalInt;
+import javax.annotation.Nullable;
import static com.google.common.base.Preconditions.checkState;
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/command/ConfirmHandler.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/command/ConfirmHandler.java
index 3f3f7786a..5396da859 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/command/ConfirmHandler.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/command/ConfirmHandler.java
@@ -22,13 +22,13 @@ package com.sk89q.worldedit.internal.command;
import com.sk89q.worldedit.command.util.annotation.Confirm;
import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.util.formatting.text.TextComponent;
-import java.util.Optional;
import org.enginehub.piston.CommandParameters;
import org.enginehub.piston.exception.StopExecutionException;
import org.enginehub.piston.gen.CommandCallListener;
import org.enginehub.piston.inject.Key;
import java.lang.reflect.Method;
+import java.util.Optional;
/**
* Logs called commands to a logger.
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/command/MethodInjector.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/command/MethodInjector.java
index f0ead981f..0ca5e85b7 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/command/MethodInjector.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/command/MethodInjector.java
@@ -2,13 +2,11 @@ package com.sk89q.worldedit.internal.command;
import org.enginehub.piston.CommandParameters;
import org.enginehub.piston.gen.CommandCallListener;
-import org.enginehub.piston.inject.InjectedValueAccess;
import org.enginehub.piston.inject.InjectedValueStore;
import org.enginehub.piston.inject.Key;
import org.enginehub.piston.util.ValueProvider;
import java.lang.reflect.Method;
-import java.util.Optional;
public class MethodInjector implements CommandCallListener {
@Override
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/cui/ServerCUIHandler.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/cui/ServerCUIHandler.java
index 2ca8f3bd3..e56b6a135 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/cui/ServerCUIHandler.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/cui/ServerCUIHandler.java
@@ -38,7 +38,6 @@ import com.sk89q.worldedit.world.block.BlockTypes;
import java.util.HashMap;
import java.util.Map;
-
import javax.annotation.Nullable;
/**
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/invoke/ExpressionHandles.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/invoke/ExpressionHandles.java
index 892fca4fd..1985c5a99 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/invoke/ExpressionHandles.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/invoke/ExpressionHandles.java
@@ -30,7 +30,6 @@ import it.unimi.dsi.fastutil.doubles.Double2ObjectMaps;
import org.antlr.v4.runtime.ParserRuleContext;
import org.antlr.v4.runtime.Token;
-import javax.annotation.Nullable;
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.MethodType;
@@ -38,6 +37,7 @@ import java.util.Objects;
import java.util.function.DoubleBinaryOperator;
import java.util.function.Supplier;
import java.util.stream.Collectors;
+import javax.annotation.Nullable;
import static com.sk89q.worldedit.internal.expression.ExpressionHelper.check;
import static com.sk89q.worldedit.internal.expression.ExpressionHelper.checkIterations;
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/invoke/ReturnException.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/invoke/ReturnException.java
index bd4a757fb..66066223f 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/invoke/ReturnException.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/invoke/ReturnException.java
@@ -22,9 +22,11 @@ package com.sk89q.worldedit.internal.expression.invoke;
/**
* Thrown when a return is encountered, to pop the stack frames and return the value easily.
*
+ *
* Should be caught by the executor.
+ *
*/
-class ReturnException extends RuntimeException {
+public class ReturnException extends RuntimeException {
private final Double result;
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/registry/AbstractFactory.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/registry/AbstractFactory.java
index a5844306d..0ad5e90b7 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/registry/AbstractFactory.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/registry/AbstractFactory.java
@@ -19,8 +19,6 @@
package com.sk89q.worldedit.internal.registry;
-import static com.google.common.base.Preconditions.checkNotNull;
-
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.extension.input.InputParseException;
import com.sk89q.worldedit.extension.input.NoMatchException;
@@ -31,6 +29,8 @@ import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
+import static com.google.common.base.Preconditions.checkNotNull;
+
/**
* An abstract implementation of a factory for internal usage.
*
@@ -58,7 +58,9 @@ public abstract class AbstractFactory {
/**
* Gets an immutable list of parsers.
*
+ *
* To add parsers, use the register method.
+ *
*
* @return the parsers
*/
@@ -82,12 +84,12 @@ public abstract class AbstractFactory {
public List getSuggestions(String input) {
return parsers.stream().flatMap(
- p -> p.getSuggestions(input)
+ p -> p.getSuggestions(input)
).collect(Collectors.toList());
}
/**
- * Registers an InputParser to this factory
+ * Registers an InputParser to this factory.
*
* @param inputParser The input parser
*/
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/util/BiomeMath.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/util/BiomeMath.java
index a8e4a9518..c2d6abfe1 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/util/BiomeMath.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/util/BiomeMath.java
@@ -25,7 +25,7 @@ public class BiomeMath {
// From BiomeArray / BiomeContainer
public static final int HORIZONTAL_SECTION_COUNT = (int) Math.round(Math.log(16.0D) / Math.log(2.0D)) - 2;
- public static final int VERTICAL_SECTION_COUNT = (int)Math.round(Math.log(256.0D) / Math.log(2.0D)) - 2;
+ public static final int VERTICAL_SECTION_COUNT = (int) Math.round(Math.log(256.0D) / Math.log(2.0D)) - 2;
public static final int HORIZONTAL_BIT_MASK = (1 << HORIZONTAL_SECTION_COUNT) - 1;
public static final int VERTICAL_BIT_MASK = (1 << VERTICAL_SECTION_COUNT) - 1;
@@ -41,9 +41,9 @@ public class BiomeMath {
* @return the index into the standard MC biome array
*/
public static int computeBiomeIndex(int x, int y, int z) {
- int l = x & HORIZONTAL_BIT_MASK;
- int m = MathHelper.clamp(y, 0, VERTICAL_BIT_MASK);
- int n = z & HORIZONTAL_BIT_MASK;
+ int l = (x >> 2) & HORIZONTAL_BIT_MASK;
+ int m = MathHelper.clamp(y >> 2, 0, VERTICAL_BIT_MASK);
+ int n = (z >> 2) & HORIZONTAL_BIT_MASK;
return m << HORIZONTAL_SECTION_COUNT + HORIZONTAL_SECTION_COUNT
| n << HORIZONTAL_SECTION_COUNT
| l;
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/util/DeprecationUtil.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/util/DeprecationUtil.java
new file mode 100644
index 000000000..089d0411a
--- /dev/null
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/util/DeprecationUtil.java
@@ -0,0 +1,109 @@
+/*
+ * WorldEdit, a Minecraft world manipulation toolkit
+ * Copyright (C) sk89q
+ * Copyright (C) WorldEdit team and contributors
+ *
+ * This program is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ */
+
+package com.sk89q.worldedit.internal.util;
+
+import com.google.common.base.Joiner;
+import com.google.common.base.Throwables;
+import com.sk89q.worldedit.world.block.BlockCategories;
+import com.sk89q.worldedit.world.block.BlockType;
+import com.sk89q.worldedit.world.block.BlockTypes;
+
+import java.lang.reflect.Method;
+import java.util.stream.Stream;
+
+public class DeprecationUtil {
+
+ private DeprecationUtil() {
+ }
+
+ /**
+ * Verify that one of the two functions is overridden. Caller method must be the new method,
+ * annotated with {@link NonAbstractForCompatibility}.
+ *
+ * @param implementingClass the result of calling {@link Object#getClass()}
+ */
+ public static void checkDelegatingOverride(Class> implementingClass) {
+ // pull the information about the caller
+ StackTraceElement caller = Throwables.lazyStackTrace(new Throwable()).get(1);
+ // find the matching caller method
+ Method callingMethod = getCallingMethod(caller);
+ NonAbstractForCompatibility annotation =
+ callingMethod.getAnnotation(NonAbstractForCompatibility.class);
+ // get the deprecated method
+ Method deprecatedMethod;
+ try {
+ deprecatedMethod = implementingClass.getMethod(
+ annotation.delegateName(), annotation.delegateParams()
+ );
+ } catch (NoSuchMethodException e) {
+ throw new AssertionError(
+ "Missing method referenced by " + NonAbstractForCompatibility.class, e
+ );
+ }
+ // Check if the deprecated method was overridden. If the declaring class is the caller's
+ // class, then it wasn't. That means that the caller method (i.e. the new method) should be
+ // overridden by the implementing class.
+ // There's no need to check if the new method has been overridden, since the only other
+ // way this could be reached is if someone calls `super.xyz`, which they have no reason to.
+ if (deprecatedMethod.getDeclaringClass().getName().equals(caller.getClassName())) {
+ throw new IllegalStateException("Class " + implementingClass.getName()
+ + " must override " + methodToString(callingMethod));
+ }
+ }
+
+ private static Method getCallingMethod(StackTraceElement callerInfo) {
+ Method[] declaredMethods;
+ try {
+ declaredMethods = Class.forName(callerInfo.getClassName()).getDeclaredMethods();
+ } catch (ClassNotFoundException e) {
+ throw new AssertionError("Caller class missing?", e);
+ }
+ for (Method declaredMethod : declaredMethods) {
+ if (declaredMethod.isAnnotationPresent(NonAbstractForCompatibility.class)
+ && declaredMethod.getName().equals(callerInfo.getMethodName())) {
+ return declaredMethod;
+ }
+ }
+ throw new IllegalStateException("Failed to find caller method "
+ + callerInfo.getMethodName() + " annotated with " + NonAbstractForCompatibility.class);
+ }
+
+ private static String methodToString(Method method) {
+ StringBuilder builder = new StringBuilder(method.getDeclaringClass().getCanonicalName())
+ .append('.')
+ .append(method.getName())
+ .append('(');
+ Joiner.on(", ").appendTo(builder, Stream.of(method.getParameterTypes())
+ .map(Class::getSimpleName)
+ .iterator());
+ builder.append(')');
+ return builder.toString();
+ }
+
+ public static boolean isSign(BlockType blockType) {
+ @SuppressWarnings("deprecation")
+ BlockType sign = BlockTypes.SIGN;
+ @SuppressWarnings("deprecation")
+ BlockType wallSign = BlockTypes.WALL_SIGN;
+ return blockType == sign || blockType == wallSign
+ || BlockCategories.SIGNS.contains(blockType);
+ }
+
+}
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/util/NonAbstractForCompatibility.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/util/NonAbstractForCompatibility.java
new file mode 100644
index 000000000..f67131d73
--- /dev/null
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/util/NonAbstractForCompatibility.java
@@ -0,0 +1,57 @@
+/*
+ * WorldEdit, a Minecraft world manipulation toolkit
+ * Copyright (C) sk89q
+ * Copyright (C) WorldEdit team and contributors
+ *
+ * This program is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ */
+
+package com.sk89q.worldedit.internal.util;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * The annotated method is only non-{@code abstract} for compatibility with old subclasses,
+ * and will be made {@code abstract} in the next major version of WorldEdit.
+ *
+ *
+ * Any new subclasses must override the annotated method, failing to do so will result in
+ * an exception at runtime.
+ *