diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java
index 887b48e7b..1a8769094 100644
--- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java
+++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java
@@ -47,10 +47,12 @@ import org.bukkit.block.Chest;
import org.bukkit.entity.Entity;
import org.bukkit.inventory.DoubleChestInventory;
import org.bukkit.inventory.Inventory;
+import org.bukkit.inventory.InventoryHolder;
import org.slf4j.Logger;
import javax.annotation.Nullable;
import java.lang.ref.WeakReference;
+import java.nio.file.Path;
import java.util.ArrayList;
import java.util.EnumMap;
import java.util.HashMap;
@@ -154,6 +156,11 @@ public class BukkitWorld extends AbstractWorld {
return getWorld().getName();
}
+ @Override
+ public Path getStoragePath() {
+ return getWorld().getWorldFolder().toPath();
+ }
+
@Override
public int getBlockLightLevel(BlockVector3 pt) {
return getWorld().getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ()).getLightLevel();
@@ -239,11 +246,11 @@ public class BukkitWorld extends AbstractWorld {
return false;
}
BlockState state = block.getState();
- if (!(state instanceof org.bukkit.inventory.InventoryHolder)) {
+ if (!(state instanceof InventoryHolder)) {
return false;
}
- org.bukkit.inventory.InventoryHolder chest = (org.bukkit.inventory.InventoryHolder) state;
+ InventoryHolder chest = (InventoryHolder) state;
Inventory inven = chest.getInventory();
if (chest instanceof Chest) {
inven = getBlockInventory((Chest) chest);
diff --git a/worldedit-core/src/main/java/com/boydti/fawe/FaweAPI.java b/worldedit-core/src/main/java/com/boydti/fawe/FaweAPI.java
index 763b22c02..656a5c51b 100644
--- a/worldedit-core/src/main/java/com/boydti/fawe/FaweAPI.java
+++ b/worldedit-core/src/main/java/com/boydti/fawe/FaweAPI.java
@@ -17,6 +17,7 @@ import com.boydti.fawe.util.SetQueue;
import com.boydti.fawe.util.TaskManager;
import com.boydti.fawe.util.WEManager;
import com.boydti.fawe.wrappers.WorldWrapper;
+
import com.google.common.collect.Sets;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.WorldEdit;
@@ -36,24 +37,18 @@ import com.sk89q.worldedit.internal.registry.InputParser;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.util.Location;
-import com.sk89q.worldedit.world.AbstractWorld;
import com.sk89q.worldedit.world.World;
-import org.jetbrains.annotations.NotNull;
+import javax.annotation.Nullable;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.Field;
import java.net.URL;
import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.UUID;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
/**
* The FaweAPI class offers a few useful functions.
diff --git a/worldedit-core/src/main/java/com/boydti/fawe/FaweCache.java b/worldedit-core/src/main/java/com/boydti/fawe/FaweCache.java
index c3ed20bf8..cf345ef95 100644
--- a/worldedit-core/src/main/java/com/boydti/fawe/FaweCache.java
+++ b/worldedit-core/src/main/java/com/boydti/fawe/FaweCache.java
@@ -1,12 +1,17 @@
package com.boydti.fawe;
import com.boydti.fawe.object.collection.IterableThreadLocal;
+
import com.sk89q.jnbt.*;
-import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.block.BlockTypes;
import java.lang.reflect.Field;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
public class FaweCache {
public static final IterableThreadLocal BLOCK_TO_PALETTE = new IterableThreadLocal() {
@@ -115,7 +120,7 @@ public class FaweCache {
} else if (value instanceof String) {
return asTag((String) value);
} else if (value instanceof Map) {
- return asTag((Map) value);
+ return asTag((Map) value);
} else if (value instanceof Collection) {
return asTag((Collection) value);
} else if (value instanceof Object[]) {
@@ -153,7 +158,7 @@ public class FaweCache {
}
public static ListTag asTag(Object... values) {
- Class clazz = null;
+ Class extends Tag> clazz = null;
List list = new ArrayList<>(values.length);
for (Object value : values) {
Tag tag = asTag(value);
@@ -167,7 +172,7 @@ public class FaweCache {
}
public static ListTag asTag(Collection values) {
- Class clazz = null;
+ Class extends Tag> clazz = null;
List list = new ArrayList<>(values.size());
for (Object value : values) {
Tag tag = asTag(value);
diff --git a/worldedit-core/src/main/java/com/boydti/fawe/command/AnvilCommands.java b/worldedit-core/src/main/java/com/boydti/fawe/command/AnvilCommands.java
index c1430dab8..26e19a352 100644
--- a/worldedit-core/src/main/java/com/boydti/fawe/command/AnvilCommands.java
+++ b/worldedit-core/src/main/java/com/boydti/fawe/command/AnvilCommands.java
@@ -1,10 +1,12 @@
package com.boydti.fawe.command;
-import com.boydti.fawe.Fawe;
import com.boydti.fawe.FaweAPI;
-import com.boydti.fawe.FaweCache;
import com.boydti.fawe.config.BBC;
-import com.boydti.fawe.jnbt.anvil.*;
+import com.boydti.fawe.jnbt.anvil.MCAClipboard;
+import com.boydti.fawe.jnbt.anvil.MCAFile;
+import com.boydti.fawe.jnbt.anvil.MCAFilter;
+import com.boydti.fawe.jnbt.anvil.MCAFilterCounter;
+import com.boydti.fawe.jnbt.anvil.MCAQueue;
import com.boydti.fawe.jnbt.anvil.filters.*;
import com.boydti.fawe.jnbt.anvil.history.IAnvilHistory;
import com.boydti.fawe.jnbt.anvil.history.NullAnvilHistory;
@@ -14,17 +16,18 @@ import com.boydti.fawe.object.RegionWrapper;
import com.boydti.fawe.object.RunnableVal4;
import com.boydti.fawe.object.changeset.AnvilHistory;
import com.boydti.fawe.object.clipboard.remap.ClipboardRemapper;
-import com.boydti.fawe.object.mask.FaweBlockMatcher;
import com.boydti.fawe.util.MainUtil;
import com.boydti.fawe.util.SetQueue;
-import com.boydti.fawe.util.StringMan;
+
+import static com.google.common.base.Preconditions.checkNotNull;
import com.sk89q.minecraft.util.commands.Command;
import com.sk89q.minecraft.util.commands.CommandPermissions;
-import com.sk89q.worldedit.*;
-import com.sk89q.worldedit.world.block.BlockState;
+import com.sk89q.worldedit.EditSession;
+import com.sk89q.worldedit.LocalSession;
+import com.sk89q.worldedit.WorldEdit;
+import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.function.pattern.Pattern;
-import com.sk89q.worldedit.function.pattern.RandomPattern;
import com.sk89q.worldedit.internal.annotation.Selection;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.CuboidRegion;
@@ -36,17 +39,12 @@ import com.sk89q.worldedit.world.biome.BiomeType;
import java.io.IOException;
import java.io.RandomAccessFile;
-import java.util.*;
import java.util.function.Consumer;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-@Command(aliases = {"/anvil"}, desc = "Manipulate billions of blocks: [More Info](https://github.com/boy0001/FastAsyncWorldedit/wiki/Anvil-API)")
+@Command(aliases = {"/anvil"},
+ desc = "Manipulate billions of blocks: [More Info](https://github.com/boy0001/FastAsyncWorldedit/wiki/Anvil-API)")
public class AnvilCommands {
- private final WorldEdit worldEdit;
-
/**
* Create a new instance.
*
@@ -54,7 +52,6 @@ public class AnvilCommands {
*/
public AnvilCommands(WorldEdit worldEdit) {
checkNotNull(worldEdit);
- this.worldEdit = worldEdit;
}
/**
@@ -170,19 +167,20 @@ public class AnvilCommands {
)
@CommandPermissions("worldedit.anvil.remapall")
public void remapall(Player player, String folder) throws WorldEditException {
- ClipboardRemapper mapper;
ClipboardRemapper.RemapPlatform from;
ClipboardRemapper.RemapPlatform to;
from = ClipboardRemapper.RemapPlatform.PE;
to = ClipboardRemapper.RemapPlatform.PC;
RemapFilter filter = new RemapFilter(from, to);
RemapFilter result = runWithWorld(player, folder, filter, true);
- if (result != null) player.print(BBC.VISITOR_BLOCK.format(result.getTotal()));
+ if (result != null) {
+ player.print(BBC.VISITOR_BLOCK.format(result.getTotal()));
+ }
}
@Command(
- aliases = {"deleteallunvisited", "delunvisited" },
+ aliases = {"deleteallunvisited", "delunvisited"},
usage = " [file-age=60000]",
desc = "Delete all chunks which haven't been occupied",
help = "Delete all chunks which haven't been occupied for `age-ticks` (20t = 1s) and \n" +
@@ -196,11 +194,13 @@ public class AnvilCommands {
public void deleteAllUnvisited(Player player, String folder, int inhabitedTicks, @Optional("60000") int fileDurationMillis) throws WorldEditException {
DeleteUninhabitedFilter filter = new DeleteUninhabitedFilter(fileDurationMillis, inhabitedTicks, fileDurationMillis);
DeleteUninhabitedFilter result = runWithWorld(player, folder, filter, true);
- if (result != null) player.print(BBC.VISITOR_BLOCK.format(result.getTotal()));
+ if (result != null) {
+ player.print(BBC.VISITOR_BLOCK.format(result.getTotal()));
+ }
}
@Command(
- aliases = {"deleteallunclaimed", "delallunclaimed" },
+ aliases = {"deleteallunclaimed", "delallunclaimed"},
usage = " [file-age=60000]",
desc = "(Supports: WG, P2, GP) Delete all chunks which haven't been occupied AND claimed",
help = "(Supports: WG, P2, GP) Delete all chunks which aren't claimed AND haven't been occupied for `age-ticks` (20t = 1s) and \n" +
@@ -211,12 +211,17 @@ public class AnvilCommands {
max = 3
)
@CommandPermissions("worldedit.anvil.deleteallunclaimed")
- public void deleteAllUnclaimed(Player player, int inhabitedTicks, @Optional("60000") int fileDurationMillis, @Switch('d') boolean debug) throws WorldEditException {
+ public void deleteAllUnclaimed(Player player, int inhabitedTicks, @Optional("60000") int fileDurationMillis, @Switch(
+ 'd') boolean debug) throws WorldEditException {
String folder = player.getWorld().getName();
DeleteUnclaimedFilter filter = new DeleteUnclaimedFilter(player.getWorld(), fileDurationMillis, inhabitedTicks, fileDurationMillis);
- if (debug) filter.enableDebug();
+ if (debug) {
+ filter.enableDebug();
+ }
DeleteUnclaimedFilter result = runWithWorld(player, folder, filter, true);
- if (result != null) player.print(BBC.VISITOR_BLOCK.format(result.getTotal()));
+ if (result != null) {
+ player.print(BBC.VISITOR_BLOCK.format(result.getTotal()));
+ }
}
@Command(
@@ -231,15 +236,20 @@ public class AnvilCommands {
max = 3
)
@CommandPermissions("worldedit.anvil.deleteunclaimed")
- public void deleteUnclaimed(Player player, EditSession editSession, @Selection Region selection, int inhabitedTicks, @Optional("60000") int fileDurationMillis, @Switch('d') boolean debug) throws WorldEditException {
+ public void deleteUnclaimed(Player player, EditSession editSession, @Selection Region selection, int inhabitedTicks, @Optional(
+ "60000") int fileDurationMillis, @Switch('d') boolean debug) throws WorldEditException {
DeleteUnclaimedFilter filter = new DeleteUnclaimedFilter(player.getWorld(), fileDurationMillis, inhabitedTicks, fileDurationMillis);
- if (debug) filter.enableDebug();
+ if (debug) {
+ filter.enableDebug();
+ }
DeleteUnclaimedFilter result = runWithSelection(player, editSession, selection, filter);
- if (result != null) player.print(BBC.VISITOR_BLOCK.format(result.getTotal()));
+ if (result != null) {
+ player.print(BBC.VISITOR_BLOCK.format(result.getTotal()));
+ }
}
@Command(
- aliases = {"deletealloldregions", "deloldreg" },
+ aliases = {"deletealloldregions", "deloldreg"},
usage = "