diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/command/VoxelUndoCommand.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/command/VoxelUndoCommand.java index 97d9cd2eb..c22f2e6d5 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/command/VoxelUndoCommand.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/command/VoxelUndoCommand.java @@ -22,7 +22,7 @@ public class VoxelUndoCommand extends VoxelCommand { int amount = Integer.parseInt(args[0]); sniper.undo(amount); } catch (NumberFormatException exception) { - player.sendMessage(BBC.getPrefix() + "Number expected; string given."); + player.sendMessage("Number expected; string given."); } } else { sniper.undo(); diff --git a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/BukkitPlayer.java b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/BukkitPlayer.java index 7f97d3a52..032894787 100644 --- a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/BukkitPlayer.java +++ b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/BukkitPlayer.java @@ -85,6 +85,10 @@ public class BukkitPlayer extends FawePlayer { this.parent.sendMessage(BBC.color(message)); } + @Override public void printError(String msg) { + this.sendMessage(msg); + } + @Override public void executeCommand(final String cmd) { Bukkit.getServer().dispatchCommand(this.parent, cmd); 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 e020b3f71..5a1a05ce0 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 @@ -194,9 +194,9 @@ public class FaweBukkit implements IFawe, Listener { } @Override - public void debug(final String s) { + public void debug(final String message) { ConsoleCommandSender console = Bukkit.getConsoleSender(); - console.sendMessage(BBC.color(s)); + console.sendMessage(BBC.color(message)); } @Override @@ -273,7 +273,7 @@ public class FaweBukkit implements IFawe, Listener { try { this.vault = new VaultUtil(); } catch (final Throwable e) { - this.debug(BBC.getPrefix() + "&dVault is used for persistent `/wea` toggles."); + this.debug("&dVault is used for persistent `/wea` toggles."); } } diff --git a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/v1_13/BukkitQueue_1_13.java b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/v1_13/BukkitQueue_1_13.java index 0944fb232..68041ca76 100644 --- a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/v1_13/BukkitQueue_1_13.java +++ b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/v1_13/BukkitQueue_1_13.java @@ -194,8 +194,8 @@ public class BukkitQueue_1_13 extends BukkitQueue_0 split = StringMan.split(from, ','); // filter = new MappedReplacePatternFilter(from, (RandomPattern) to, useData); // } else { -// player.print(BBC.getPrefix() + "Must be a pattern list!"); +// player.print("Must be a pattern list!"); // return; // } // } else { @@ -348,7 +348,7 @@ public class AnvilCommands { // filter = new ReplacePatternFilter(matchFrom, to); // } // MCAFilterCounter result = runWithWorld(player, folder, filter, true); -// if (result != null) player.print(BBC.getPrefix() + BBC.VISITOR_BLOCK.format(result.getTotal())); +// if (result != null) player.print(BBC.VISITOR_BLOCK.format(result.getTotal())); } // @Command( @@ -373,7 +373,7 @@ public class AnvilCommands { // filter = counter; // } // MCAFilterCounter result = runWithWorld(player, folder, filter, true); -// if (result != null) player.print(BBC.getPrefix() + BBC.SELECTION_COUNT.format(result.getTotal())); +// if (result != null) player.print(BBC.SELECTION_COUNT.format(result.getTotal())); } @Command( @@ -423,7 +423,7 @@ public class AnvilCommands { } }; MCAFilterCounter result = runWithSelection(player, editSession, selection, filter); - if (result != null) player.print(BBC.getPrefix() + BBC.VISITOR_BLOCK.format(result.getTotal())); + if (result != null) player.print(BBC.VISITOR_BLOCK.format(result.getTotal())); } @Command( @@ -448,7 +448,7 @@ public class AnvilCommands { // filter = counter; // } // MCAFilterCounter result = runWithSelection(player, editSession, selection, filter); -// if (result != null) player.print(BBC.getPrefix() + BBC.SELECTION_COUNT.format(result.getTotal())); +// if (result != null) player.print(BBC.SELECTION_COUNT.format(result.getTotal())); } // @Command( @@ -514,7 +514,7 @@ public class AnvilCommands { // ((c[1] * 10000) / total) / 100d, // name == null ? "Unknown" : name, // block.getType(), block.getData()); -// player.print(BBC.getPrefix() + str); +// player.print(str); // } // } else { // for (long[] c : map) { @@ -523,7 +523,7 @@ public class AnvilCommands { // String.valueOf(c[1]), // ((c[1] * 10000) / total) / 100d, // block == null ? "Unknown" : block.getName(), c[0]); -// player.print(BBC.getPrefix() + str); +// player.print(str); // } // } } @@ -545,7 +545,7 @@ public class AnvilCommands { // ReplaceSimpleFilter filter = new ReplaceSimpleFilter(matchFrom, matchTo); // MCAFilterCounter result = runWithSelection(player, editSession, selection, filter); // if (result != null) { -// player.print(BBC.getPrefix() + BBC.VISITOR_BLOCK.format(result.getTotal())); +// player.print(BBC.VISITOR_BLOCK.format(result.getTotal())); // } } // @@ -563,7 +563,7 @@ public class AnvilCommands { // List split = StringMan.split(from, ','); // filter = new MappedReplacePatternFilter(from, (RandomPattern) to, useData); // } else { -// player.print(BBC.getPrefix() + "Must be a pattern list!"); +// player.print("Must be a pattern list!"); // return; // } // } else { @@ -577,7 +577,7 @@ public class AnvilCommands { // } // MCAFilterCounter result = runWithSelection(player, editSession, selection, filter); // if (result != null) { -// player.print(BBC.getPrefix() + BBC.VISITOR_BLOCK.format(result.getTotal())); +// player.print(BBC.VISITOR_BLOCK.format(result.getTotal())); // } } @@ -592,7 +592,7 @@ public class AnvilCommands { MCAFilterCounter filter = new SetPatternFilter(to); MCAFilterCounter result = runWithSelection(player, editSession, selection, filter); if (result != null) { - player.print(BBC.getPrefix() + BBC.VISITOR_BLOCK.format(result.getTotal())); + player.print(BBC.VISITOR_BLOCK.format(result.getTotal())); } } @@ -611,7 +611,7 @@ public class AnvilCommands { RemoveLayerFilter filter = new RemoveLayerFilter(minY, maxY, id); MCAFilterCounter result = runWithSelection(player, editSession, selection, filter); if (result != null) { - player.print(BBC.getPrefix() + BBC.VISITOR_BLOCK.format(result.getTotal())); + player.print(BBC.VISITOR_BLOCK.format(result.getTotal())); } } @@ -651,7 +651,7 @@ public class AnvilCommands { // FawePlayer fp = FawePlayer.wrap(player); // MCAClipboard clipboard = fp.getMeta(FawePlayer.METADATA_KEYS.ANVIL_CLIPBOARD); // if (clipboard == null) { -// fp.sendMessage(BBC.getPrefix() + "You must first use `//anvil copy`"); +// fp.sendMessage("You must first use `//anvil copy`"); // return; // } // CuboidRegion cuboid = clipboard.getRegion(); @@ -676,4 +676,4 @@ public class AnvilCommands { // }); // BBC.COMMAND_PASTE.send(player, player.getPosition().toBlockVector()); } -} \ No newline at end of file +} diff --git a/worldedit-core/src/main/java/com/boydti/fawe/command/CFICommands.java b/worldedit-core/src/main/java/com/boydti/fawe/command/CFICommands.java index 404fef5da..feff6cd22 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/command/CFICommands.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/command/CFICommands.java @@ -177,7 +177,7 @@ public class CFICommands extends MethodCommands { @CommandPermissions("worldedit.anvil.cfi") public void cancel(FawePlayer fp) throws ParameterException, IOException { getSettings(fp).remove(); - fp.sendMessage(BBC.getPrefix() + "Cancelled!"); + fp.sendMessage("Cancelled!"); } @Command( @@ -196,12 +196,12 @@ public class CFICommands extends MethodCommands { if (folder != null) { try { generator.setFolder(folder); - fp.sendMessage(BBC.getPrefix() + "Generating " + folder); + fp.sendMessage("Generating " + folder); generator.generate(); generator.setPacketViewer(null); generator.setImageViewer(null); settings.remove(); - fp.sendMessage(BBC.getPrefix() + "Done!"); + fp.sendMessage("Done!"); return true; } catch (IOException e) { throw new RuntimeException(e); @@ -215,8 +215,8 @@ public class CFICommands extends MethodCommands { try { new PlotLoader().load(fp, settings, function); - } catch (Throwable ignore) { - ignore.printStackTrace(); + } catch (Throwable e) { + e.printStackTrace(); function.apply(generator.getFolder().getParentFile()); } @@ -879,7 +879,7 @@ public class CFICommands extends MethodCommands { ByteArrayOutputStream baos = new ByteArrayOutputStream(); ImageIO.write(image, "jpg", baos ); byte[] data = baos.toByteArray(); - fp.sendMessage(BBC.getPrefix() + "Please wait..."); + fp.sendMessage("Please wait..."); URL url = ImgurUtility.uploadImage(data); BBC.DOWNLOAD_LINK.send(fp, url); } diff --git a/worldedit-core/src/main/java/com/boydti/fawe/command/PlotLoader.java b/worldedit-core/src/main/java/com/boydti/fawe/command/PlotLoader.java index ba0ca4477..4cecdfe0c 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/command/PlotLoader.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/command/PlotLoader.java @@ -50,7 +50,7 @@ public class PlotLoader { SinglePlotArea area = sManager.getArea(); PlotPlayer player = PlotPlayer.wrap(fp.parent); - fp.sendMessage(BBC.getPrefix() + "Claiming world"); + fp.sendMessage("Claiming world"); Plot plot = TaskManager.IMP.sync(new RunnableVal() { @Override public void run(Plot o) { diff --git a/worldedit-core/src/main/java/com/boydti/fawe/config/BBC.java b/worldedit-core/src/main/java/com/boydti/fawe/config/BBC.java index 0b733b015..fee3aa180 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/config/BBC.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/config/BBC.java @@ -10,7 +10,6 @@ import com.boydti.fawe.util.StringMan; import com.boydti.fawe.util.chat.Message; import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; -import com.sk89q.worldedit.entity.Player; import java.io.File; import java.lang.reflect.InvocationTargetException; @@ -380,49 +379,25 @@ public enum BBC { /** * Translated */ - private String s; + private String translatedMessage; /** * Default */ - private String d; + private String defaultMessage; /** * What locale category should this translation fall under */ - private String cat; - /** - * Should the string be prefixed? - */ - private boolean prefix; - - /** - * Constructor for custom strings. - */ - BBC() { - /* - * use setCustomString(); - */ - } + private String category; /** * Constructor * - * @param d default - * @param prefix use prefix + * @param defaultMessage default */ - BBC(final String d, final boolean prefix, final String cat) { - this.d = d; - this.s = d; - this.prefix = prefix; - this.cat = cat.toLowerCase(); - } - - /** - * Constructor - * - * @param d default - */ - BBC(final String d, final String cat) { - this(d, true, cat.toLowerCase()); + BBC(final String defaultMessage, final String category) { + this.defaultMessage = defaultMessage; + this.translatedMessage = defaultMessage; + this.category = category.toLowerCase(); } public String f(final Object... args) { @@ -430,7 +405,7 @@ public enum BBC { } public String format(final Object... args) { - String m = this.s; + String m = this.translatedMessage; for (int i = args.length - 1; i >= 0; i--) { if (args[i] == null) { continue; @@ -457,7 +432,7 @@ public enum BBC { final HashSet toRemove = new HashSet<>(); for (final BBC c : all) { allNames.add(c.name()); - allCats.add(c.cat.toLowerCase()); + allCats.add(c.category.toLowerCase()); } final HashSet captions = new HashSet<>(); boolean changed = false; @@ -470,13 +445,13 @@ public enum BBC { final String node = split[split.length - 1].toUpperCase(); final BBC caption = allNames.contains(node) ? valueOf(node) : null; if (caption != null) { - if (!split[0].equalsIgnoreCase(caption.cat)) { + if (!split[0].equalsIgnoreCase(caption.category)) { changed = true; yml.set(key, null); - yml.set(caption.cat + "." + caption.name().toLowerCase(), value); + yml.set(caption.category + "." + caption.name().toLowerCase(), value); } captions.add(caption); - caption.s = (String) value; + caption.translatedMessage = (String) value; } else { toRemove.add(key); } @@ -488,9 +463,9 @@ public enum BBC { for (final BBC caption : all) { if (!captions.contains(caption)) { changed = true; - yml.set(caption.cat + "." + caption.name().toLowerCase(), caption.d); + yml.set(caption.category + "." + caption.name().toLowerCase(), caption.defaultMessage); } - caption.s = StringMan.replaceFromMap(caption.s, replacements); + caption.translatedMessage = StringMan.replaceFromMap(caption.translatedMessage, replacements); } if (changed) { yml.save(file); @@ -523,7 +498,7 @@ public enum BBC { } public String s() { - return this.s; + return this.translatedMessage; } public Message m(Object... args) { @@ -531,15 +506,11 @@ public enum BBC { } public String original() { - return d; + return defaultMessage; } - public boolean usePrefix() { - return this.prefix; - } - - public String getCat() { - return this.cat; + public String getCategory() { + return this.category; } public BBC or(BBC... others) { @@ -695,7 +666,7 @@ public enum BBC { } for (Map.Entry entry2 : obj.entrySet()) { if (StringMan.isEqualIgnoreCaseToAny(entry2.getKey(), "bold", "italic", "underlined", "strikethrough", "obfuscated")) { - boolean newValue = Boolean.valueOf((String) entry2.getValue()); + boolean newValue = Boolean.parseBoolean((String) entry2.getValue()); if (properties.put(entry2.getKey(), newValue) != newValue) { if (newValue) { char code = BBC.getCode(entry2.getKey().toUpperCase()); diff --git a/worldedit-core/src/main/java/com/boydti/fawe/jnbt/anvil/generator/CavesGen.java b/worldedit-core/src/main/java/com/boydti/fawe/jnbt/anvil/generator/CavesGen.java index db2971b0e..25e4bb415 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/jnbt/anvil/generator/CavesGen.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/jnbt/anvil/generator/CavesGen.java @@ -56,7 +56,7 @@ public class CavesGen extends GenBase { double f2 = 0.0F; if (maxAngle <= 0) { - int checkAreaSize = this.getCheckAreaSize() * 16 - 16; + int checkAreaSize = (this.getCheckAreaSize() * 16) - 16; maxAngle = checkAreaSize - ThreadLocalRandom.current().nextInt(checkAreaSize / 4); } boolean isLargeCave = false; @@ -70,7 +70,7 @@ public class CavesGen extends GenBase { int k = ThreadLocalRandom.current().nextInt(6) == 0 ? 1 : 0; for (; angle < maxAngle; angle++) { - double d3 = 1.5D + MathMan.sinInexact(angle * 3.141593F / maxAngle) * paramdouble1 * 1.0F; + double d3 = 1.5D + MathMan.sinInexact(angle * Math.PI / maxAngle) * paramdouble1 * 1.0F; double d4 = d3 * paramDouble4; double f3 = MathMan.cosInexact(paramdouble3); diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/FaweCommand.java b/worldedit-core/src/main/java/com/boydti/fawe/object/FaweCommand.java index 9598b78b2..bab4cf69c 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/object/FaweCommand.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/object/FaweCommand.java @@ -27,19 +27,9 @@ public abstract class FaweCommand { execute(player, args); return true; } else if (player == null) { - TaskManager.IMP.async(new Runnable() { - @Override - public void run() { - execute(player, args); - } - }); + TaskManager.IMP.async(() -> execute(player, args)); } else { - if (!player.runAction(new Runnable() { - @Override - public void run() { - execute(player, args); - } - }, true, true)) { + if (!player.runAction(() -> execute(player, args), true, true)) { BBC.WORLDEDIT_COMMAND_LIMIT.send(player); return true; } diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/FawePlayer.java b/worldedit-core/src/main/java/com/boydti/fawe/object/FawePlayer.java index c8b79ea2f..e1a99ae78 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/object/FawePlayer.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/object/FawePlayer.java @@ -457,6 +457,13 @@ public abstract class FawePlayer extends Metadatable { */ public abstract void sendMessage(final String message); + /** + * Print a WorldEdit error. + * + * @param msg The error message text + */ + public abstract void printError(String msg); + /** * Have the player execute a command * diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/HistoryExtent.java b/worldedit-core/src/main/java/com/boydti/fawe/object/HistoryExtent.java index e66e505c6..83e26f098 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/object/HistoryExtent.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/object/HistoryExtent.java @@ -1,12 +1,8 @@ package com.boydti.fawe.object; -import com.boydti.fawe.FaweCache; import com.boydti.fawe.object.changeset.FaweChangeSet; -import com.boydti.fawe.object.exception.FaweException; -import com.sk89q.jnbt.CompoundTag; import com.sk89q.worldedit.*; import com.sk89q.worldedit.world.block.BaseBlock; -import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.entity.Entity; import com.sk89q.worldedit.extent.AbstractDelegateExtent; @@ -14,12 +10,10 @@ import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.history.changeset.ChangeSet; import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.math.Vector2; import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.block.BlockStateHolder; -import com.sk89q.worldedit.world.block.BlockTypes; import java.util.ArrayList; import java.util.List; diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/progress/DefaultProgressTracker.java b/worldedit-core/src/main/java/com/boydti/fawe/object/progress/DefaultProgressTracker.java index bf544f01f..8aff1c4c4 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/object/progress/DefaultProgressTracker.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/object/progress/DefaultProgressTracker.java @@ -84,23 +84,14 @@ public class DefaultProgressTracker extends RunnableVal2>> 24) & 0xFF); out.write((v >>> 16) & 0xFF); out.write((v >>> 8) & 0xFF); out.write((v >>> 0) & 0xFF); } - public static final void writeVarInt(final OutputStream out, int i) throws IOException { - while((i & -128) != 0) { - out.write(i & 127 | 128); - i >>>= 7; - } - out.write(i); - } - - public static final int readVarInt(InputStream in) throws IOException { + public static int readVarInt(InputStream in) throws IOException { int i = 0; int offset = 0; int b; @@ -54,7 +37,7 @@ public final class IOUtil { return i; } - public static final void copy(InputStream in, OutputStream out) throws IOException { + public static void copy(InputStream in, OutputStream out) throws IOException { byte[] buf = new byte[8192]; while (true) { int r = in.read(buf); @@ -65,7 +48,7 @@ public final class IOUtil { } } - public static final int copy(InputStream in, OutputStream out, int len) throws IOException { + public static int copy(InputStream in, OutputStream out, int len) throws IOException { byte[] buf = new byte[8192]; while (len > 0) { int r = in.read(buf, 0, Math.min(buf.length, len)); @@ -78,7 +61,7 @@ public final class IOUtil { return len; } - public static final void copy(InputStream in, DataOutput out) throws IOException { + public static void copy(InputStream in, DataOutput out) throws IOException { byte[] buf = new byte[8192]; while (true) { int r = in.read(buf); diff --git a/worldedit-core/src/main/java/com/boydti/fawe/util/MathMan.java b/worldedit-core/src/main/java/com/boydti/fawe/util/MathMan.java index 711de5ff8..b9cb2d22e 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/util/MathMan.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/util/MathMan.java @@ -121,72 +121,72 @@ public class MathMan { } } - public static final long inverseRound(double val) { + public static long inverseRound(double val) { long round = Math.round(val); return (long) (round + Math.signum(val - round)); } - public static final int pair(short x, short y) { + public static int pair(short x, short y) { return (x << 16) | (y & 0xFFFF); } - public static final short unpairX(int hash) { + public static short unpairX(int hash) { return (short) (hash >> 16); } - public static final short unpairY(int hash) { + public static short unpairY(int hash) { return (short) (hash & 0xFFFF); } - public static final short pairByte(int x, int y) { + public static short pairByte(int x, int y) { return (short) ((x << 8) | (y & 0xFF)); } - public static final byte unpairShortX(short pair) { + public static byte unpairShortX(short pair) { return (byte) (pair >> 8); } - public static final byte unpairShortY(short pair) { + public static byte unpairShortY(short pair) { return (byte) pair; } - public static final long pairInt(int x, int y) { + public static long pairInt(int x, int y) { return (((long) x) << 32) | (y & 0xffffffffL); } - public static final long tripleWorldCoord(int x, int y, int z) { + public static long tripleWorldCoord(int x, int y, int z) { return y + (((long) x & 0x3FFFFFF) << 8) + (((long) z & 0x3FFFFFF) << 34); } - public static final long untripleWorldCoordX(long triple) { + public static long untripleWorldCoordX(long triple) { return (((triple >> 8) & 0x3FFFFFF) << 38) >> 38; } - public static final long untripleWorldCoordY(long triple) { + public static long untripleWorldCoordY(long triple) { return triple & 0xFF; } - public static final long untripleWorldCoordZ(long triple) { + public static long untripleWorldCoordZ(long triple) { return (((triple >> 34) & 0x3FFFFFF) << 38) >> 38; } - public static final short tripleBlockCoord(int x, int y, int z) { + public static short tripleBlockCoord(int x, int y, int z) { return (short) ((x & 15) << 12 | (z & 15) << 8 | y); } - public static final char tripleBlockCoordChar(int x, int y, int z) { + public static char tripleBlockCoordChar(int x, int y, int z) { return (char) ((x & 15) << 12 | (z & 15) << 8 | y); } - public static final int untripleBlockCoordX(int triple) { + public static int untripleBlockCoordX(int triple) { return (triple >> 12) & 0xF; } - public static final int untripleBlockCoordY(int triple) { + public static int untripleBlockCoordY(int triple) { return (triple & 0xFF); } - public static final int untripleBlockCoordZ(int triple) { + public static int untripleBlockCoordZ(int triple) { return (triple >> 8) & 0xF; } @@ -231,31 +231,31 @@ public class MathMan { return y3 + (y2 << 4) + (y1 << 12); } - public static final long chunkXZ2Int(int x, int z) { + public static long chunkXZ2Int(int x, int z) { return (long) x & 4294967295L | ((long) z & 4294967295L) << 32; } - public static final int unpairIntX(long pair) { + public static int unpairIntX(long pair) { return (int) (pair >> 32); } - public static final int unpairIntY(long pair) { + public static int unpairIntY(long pair) { return (int) pair; } - public static final byte pair16(int x, int y) { + public static byte pair16(int x, int y) { return (byte) (x + (y << 4)); } - public static final byte unpair16x(byte value) { + public static byte unpair16x(byte value) { return (byte) (value & 0xF); } - public static final byte unpair16y(byte value) { + public static byte unpair16y(byte value) { return (byte) ((value >> 4) & 0xF); } - public static final byte pair8(int x, int y) { + public static byte pair8(int x, int y) { return (byte) (x + (y << 3)); } @@ -267,18 +267,18 @@ public class MathMan { return (byte) ((value >> 3) & 0x7F); } - public static final int lossyFastDivide(int a, int b) { + public static int lossyFastDivide(int a, int b) { return (a * ((1 << 16) / b)) >> 16; } - public static final int gcd(int a, int b) { + public static int gcd(int a, int b) { if (b == 0) { return a; } return gcd(b, a % b); } - public static final int gcd(int[] a) { + public static int gcd(int[] a) { int result = a[0]; for (int i = 1; i < a.length; i++) { result = gcd(result, a[i]); @@ -287,7 +287,7 @@ public class MathMan { } - public static final double getMean(int[] array) { + public static double getMean(int[] array) { double count = 0; for (int i : array) { count += i; @@ -295,7 +295,7 @@ public class MathMan { return count / array.length; } - public static final double getMean(double[] array) { + public static double getMean(double[] array) { double count = 0; for (double i : array) { count += i; @@ -310,12 +310,12 @@ public class MathMan { * @param pitch * @return */ - public static final float[] getDirection(float yaw, float pitch) { + public static float[] getDirection(float yaw, float pitch) { double pitch_sin = Math.sin(pitch); return new float[]{(float) (pitch_sin * Math.cos(yaw)), (float) (pitch_sin * Math.sin(yaw)), (float) Math.cos(pitch)}; } - public static final int roundInt(double value) { + public static int roundInt(double value) { return (int) (value < 0 ? (value == (int) value) ? value : value - 1 : value); } @@ -327,24 +327,24 @@ public class MathMan { * @param z * @return */ - public static final float[] getPitchAndYaw(float x, float y, float z) { + public static float[] getPitchAndYaw(float x, float y, float z) { float distance = sqrtApprox((z * z) + (x * x)); return new float[]{atan2(y, distance), atan2(x, z)}; } - public static final float atan2(float y, float x) { + public static float atan2(float y, float x) { return CachedMathMan.atan2(y, x); } - public static final float sqrtApprox(float f) { + public static float sqrtApprox(float f) { return f * Float.intBitsToFloat(0x5f375a86 - (Float.floatToIntBits(f) >> 1)); } - public static final double sqrtApprox(double d) { + public static double sqrtApprox(double d) { return Double.longBitsToDouble(((Double.doubleToLongBits(d) - (1l << 52)) >> 1) + (1l << 61)); } - public static final float invSqrt(float x) { + public static float invSqrt(float x) { float xhalf = 0.5f * x; int i = Float.floatToIntBits(x); i = 0x5f3759df - (i >> 1); @@ -353,7 +353,7 @@ public class MathMan { return x; } - public static final boolean isInteger(CharSequence str) { + public static boolean isInteger(CharSequence str) { if (str == null) { return false; } @@ -377,7 +377,7 @@ public class MathMan { return true; } - public static final double getSD(double[] array, double av) { + public static double getSD(double[] array, double av) { double sd = 0; for (double element : array) { sd += Math.pow(Math.abs(element - av), 2); @@ -385,7 +385,7 @@ public class MathMan { return Math.sqrt(sd / array.length); } - public static final double getSD(int[] array, double av) { + public static double getSD(int[] array, double av) { double sd = 0; for (int element : array) { sd += Math.pow(Math.abs(element - av), 2); @@ -393,25 +393,25 @@ public class MathMan { return Math.sqrt(sd / array.length); } - public static final int absByte(int value) { + public static int absByte(int value) { return (value ^ (value >> 8)) - (value >> 8); } - public static final int mod(int x, int y) { + public static int mod(int x, int y) { if (isPowerOfTwo(y)) { return x & (y - 1); } return x % y; } - public static final int unsignedmod(int x, int y) { + public static int unsignedmod(int x, int y) { if (isPowerOfTwo(y)) { return x & (y - 1); } return x % y; } - public static final boolean isPowerOfTwo(int x) { + public static boolean isPowerOfTwo(int x) { return (x & (x - 1)) == 0; } } diff --git a/worldedit-core/src/main/java/com/boydti/fawe/util/ReflectionUtils9.java b/worldedit-core/src/main/java/com/boydti/fawe/util/ReflectionUtils9.java index 0270b5f16..b8fa6a621 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/util/ReflectionUtils9.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/util/ReflectionUtils9.java @@ -29,7 +29,7 @@ public class ReflectionUtils9 { // 2. Copy it T[] previousValues = (T[]) valuesField.get(enumType); - List values = new ArrayList(Arrays.asList(previousValues)); + List values = new ArrayList<>(Arrays.asList(previousValues)); // 3. build new enum T newValue = (T) makeEnum(enumType, // The target enum class diff --git a/worldedit-core/src/main/java/com/boydti/fawe/util/ShapeInterpolator.java b/worldedit-core/src/main/java/com/boydti/fawe/util/ShapeInterpolator.java index 9d23d38d4..1a4bd2e57 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/util/ShapeInterpolator.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/util/ShapeInterpolator.java @@ -672,21 +672,21 @@ public class ShapeInterpolator { } /** - * @{inheritDoc} + * {@inheritDoc} */ public int getWindingRule() { return (t < 0.5 ? g0.getWindingRule() : g1.getWindingRule()); } /** - * @{inheritDoc} + * {@inheritDoc} */ public boolean isDone() { return (cIndex > g0.getNumCoordinates()); } /** - * @{inheritDoc} + * {@inheritDoc} */ public void next() { if (cIndex == 0) { @@ -697,7 +697,7 @@ public class ShapeInterpolator { } /** - * @{inheritDoc} + * {@inheritDoc} */ public int currentSegment(float[] coordinates) { int type; diff --git a/worldedit-core/src/main/java/com/boydti/fawe/util/StringMan.java b/worldedit-core/src/main/java/com/boydti/fawe/util/StringMan.java index f621d01cd..8e3924d0b 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/util/StringMan.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/util/StringMan.java @@ -127,7 +127,7 @@ public class StringMan { int start = sb.indexOf(key, 0); while (start > -1) { final int end = start + key.length(); - final int nextSearchStart = start + 0; + final int nextSearchStart = start; sb.delete(start, end); size -= end - start; start = sb.indexOf(key, nextSearchStart); @@ -209,10 +209,10 @@ public class StringMan { } return "{ " + result + " }"; } else if (obj instanceof Collection) { - String result = ""; + StringBuilder result = new StringBuilder(); String prefix = ""; for (final Object element : (Collection) obj) { - result += prefix + getString(element); + result.append(prefix).append(getString(element)); prefix = ","; } return "( " + result + " )"; @@ -299,13 +299,7 @@ public class StringMan { public static String joinOrdered(final Collection collection, final String delimiter) { final Object[] array = collection.toArray(); - Arrays.sort(array, new Comparator() { - @Override - public int compare(final Object a, final Object b) { - return a.hashCode() - b.hashCode(); - } - - }); + Arrays.sort(array, Comparator.comparingInt(Object::hashCode)); return join(array, delimiter); } @@ -327,12 +321,7 @@ public class StringMan { } public static Comparator blockStateComparator(String input) { - return new Comparator() { - @Override - public int compare(String o1, String o2) { - return blockStateStringDistance(input, o1) - blockStateStringDistance(input, o2); - } - }; + return Comparator.comparingInt(o -> blockStateStringDistance(input, o)); } public static boolean blockStateMatches(String input, String item) { @@ -392,9 +381,9 @@ public class StringMan { n = m; m = t.length(); } - int p[] = new int[n + 1]; - int d[] = new int[n + 1]; - int _d[]; + int[] p = new int[n + 1]; + int[] d = new int[n + 1]; + int[] _d; int i; int j; char t_j; 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 8968ab652..bd2434086 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java @@ -105,6 +105,7 @@ import com.sk89q.worldedit.function.operation.Operation; import com.sk89q.worldedit.function.operation.Operations; import com.sk89q.worldedit.function.pattern.BlockPattern; import com.sk89q.worldedit.function.pattern.Pattern; +import com.sk89q.worldedit.function.pattern.WaterloggedRemover; import com.sk89q.worldedit.function.util.RegionOffset; import com.sk89q.worldedit.function.visitor.DirectionalVisitor; import com.sk89q.worldedit.function.visitor.DownwardVisitor; @@ -709,6 +710,7 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue, * Returns queue status. * * @return whether the queue is enabled + * @deprecated Use {@link EditSession#getReorderMode()} with MULTI_STAGE instead. */ @Deprecated public boolean isQueueEnabled() { @@ -717,6 +719,9 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue, /** * Queue certain types of block for better reproduction of those blocks. + * + * Uses {@link ReorderMode#MULTI_STAGE} + * @deprecated Use {@link EditSession#setReorderMode(ReorderMode)} with MULTI_STAGE instead. */ @Deprecated public void enableQueue() { @@ -2180,17 +2185,19 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue, // if (getWorld() != null) { // liquidMask = getWorld().createLiquidMask(); // } else { - liquidMask = new BlockTypeMask(this, - BlockTypes.LAVA, - BlockTypes.WATER); // } - final MaskIntersection mask = new MaskIntersection( - new BoundedHeightMask(0, EditSession.this.getMaximumPoint().getBlockY()), + liquidMask = new BlockTypeMask(this, BlockTypes.LAVA, BlockTypes.WATER); + MaskIntersection mask = new MaskIntersection( + new BoundedHeightMask(0, getWorld().getMaxY()), new RegionMask( new EllipsoidRegion(null, origin, Vector3.at(radius, radius, radius))), liquidMask); - - BlockReplace replace = new BlockReplace(this, BlockTypes.AIR.getDefaultState()); + BlockReplace replace; + if (waterlogged) { + replace = new BlockReplace(this, new WaterloggedRemover(this)); + } else { + replace = new BlockReplace(this, new BlockPattern(BlockTypes.AIR.getDefaultState())); + } RecursiveVisitor visitor = new RecursiveVisitor(mask, replace, (int) (radius * 2 + 1), this); // Around the origin in a 3x3 block @@ -3384,19 +3391,19 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue, if (block.getBlockType().getMaterial().isMovementBlocker()) { continue; } - + if (!outside.add(current)) { continue; } - + if (!region.contains(current)) { continue; } - + for (BlockVector3 recurseDirection : recurseDirections) { queue.add(current.add(recurseDirection)); } - } + } } public int makeBiomeShape(final Region region, final Vector3 zero, final Vector3 unit, final BiomeType biomeType, 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 ea7d83b2b..21081b8e0 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 @@ -208,7 +208,7 @@ public class BrushCommands extends BrushProcessor { @CommandPermissions("worldedit.brush.spline") public BrushSettings splineBrush(Player player, EditSession editSession, LocalSession session, Pattern fill, @Optional("25") Expression radius, CommandContext context) throws WorldEditException { getWorldEdit().checkMaxBrushRadius(radius); - player.print(BBC.getPrefix() + BBC.BRUSH_SPLINE.f(radius)); + player.print(BBC.BRUSH_SPLINE.f(radius)); return set(session, context, new SplineBrush(player, session)) .setSize(radius) @@ -227,7 +227,7 @@ public class BrushCommands extends BrushProcessor { ) @CommandPermissions("worldedit.brush.sweep") public BrushSettings sweepBrush(Player player, LocalSession session, EditSession editSession, @Optional("-1") int copies, CommandContext context) throws WorldEditException { - player.print(BBC.getPrefix() + BBC.BRUSH_SPLINE.s()); + player.print(BBC.BRUSH_SPLINE.s()); return set(session, context, new SweepBrush(copies)); } @@ -263,7 +263,7 @@ public class BrushCommands extends BrushProcessor { ) @CommandPermissions("worldedit.brush.surfacespline") // 0, 0, 0, 10, 0, public BrushSettings surfaceSpline(Player player, EditSession editSession, LocalSession session, Pattern fill, @Optional("0") Expression radius, @Optional("0") double tension, @Optional("0") double bias, @Optional("0") double continuity, @Optional("10") double quality, CommandContext context) throws WorldEditException { - player.print(BBC.getPrefix() + BBC.BRUSH_SPLINE.f(radius)); + player.print(BBC.BRUSH_SPLINE.f(radius)); getWorldEdit().checkMaxBrushRadius(radius); return set(session, context, new SurfaceSpline(tension, bias, continuity, quality)) @@ -794,7 +794,7 @@ public class BrushCommands extends BrushProcessor { @CommandPermissions("worldedit.brush.copy") public BrushSettings copy(Player player, LocalSession session, @Optional("5") Expression radius, @Switch('r') boolean randomRotate, @Switch('a') boolean autoRotate, CommandContext context) throws WorldEditException { getWorldEdit().checkMaxBrushRadius(radius); - player.print(BBC.getPrefix() + BBC.BRUSH_COPY.f(radius)); + player.print(BBC.BRUSH_COPY.f(radius)); return set(session, context, new CopyPastaBrush(player, session, randomRotate, autoRotate)) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/BrushOptionsCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/BrushOptionsCommands.java index e37098f12..716682532 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/BrushOptionsCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/BrushOptionsCommands.java @@ -355,7 +355,7 @@ public class BrushOptionsCommands extends MethodCommands { public void mask(Player player, LocalSession session, EditSession editSession, @Optional @Switch('h') boolean offHand, CommandContext context) throws WorldEditException { BrushTool tool = session.getBrushTool(player, false); if (tool == null) { - player.print(BBC.getPrefix() + BBC.BRUSH_NONE.f()); + player.print(BBC.BRUSH_NONE.f()); return; } if (context.argsLength() == 0) { @@ -388,7 +388,7 @@ public class BrushOptionsCommands extends MethodCommands { public void smask(Player player, LocalSession session, EditSession editSession, @Optional @Switch('h') boolean offHand, CommandContext context) throws WorldEditException { BrushTool tool = session.getBrushTool(player, false); if (tool == null) { - player.print(BBC.getPrefix() + BBC.BRUSH_NONE.f()); + player.print(BBC.BRUSH_NONE.f()); return; } if (context.argsLength() == 0) { @@ -420,7 +420,7 @@ public class BrushOptionsCommands extends MethodCommands { public void transform(Player player, LocalSession session, EditSession editSession, @Optional @Switch('h') boolean offHand, CommandContext context) throws WorldEditException { BrushTool tool = session.getBrushTool(player, false); if (tool == null) { - player.print(BBC.getPrefix() + BBC.BRUSH_NONE.f()); + player.print(BBC.BRUSH_NONE.f()); return; } if (context.argsLength() == 0) { @@ -452,7 +452,7 @@ public class BrushOptionsCommands extends MethodCommands { public void material(Player player, EditSession editSession, LocalSession session, Pattern pattern, @Switch('h') boolean offHand, CommandContext context) throws WorldEditException { BrushTool tool = session.getBrushTool(player, false); if (tool == null) { - player.print(BBC.getPrefix() + BBC.BRUSH_NONE.f()); + player.print(BBC.BRUSH_NONE.f()); return; } if (context.argsLength() == 0) { @@ -479,7 +479,7 @@ public class BrushOptionsCommands extends MethodCommands { int range = Math.max(0, Math.min(256, args.getInteger(0))); BrushTool tool = session.getBrushTool(player, false); if (tool == null) { - player.print(BBC.getPrefix() + BBC.BRUSH_NONE.f()); + player.print(BBC.BRUSH_NONE.f()); return; } tool.setRange(range); @@ -499,7 +499,7 @@ public class BrushOptionsCommands extends MethodCommands { worldEdit.checkMaxBrushRadius(radius); BrushTool tool = session.getBrushTool(player, false); if (tool == null) { - player.print(BBC.getPrefix() + BBC.BRUSH_NONE.f()); + player.print(BBC.BRUSH_NONE.f()); return; } BrushSettings settings = offHand ? tool.getOffHand() : tool.getContext(); @@ -509,4 +509,4 @@ public class BrushOptionsCommands extends MethodCommands { } -} \ No newline at end of file +} 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 9edebfa3d..3f662819c 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 @@ -31,7 +31,6 @@ import com.sk89q.minecraft.util.commands.Command; import com.sk89q.minecraft.util.commands.CommandContext; import com.sk89q.minecraft.util.commands.CommandPermissions; import com.sk89q.minecraft.util.commands.Logging; - import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.WorldEdit; @@ -44,17 +43,16 @@ import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.function.visitor.RegionVisitor; import com.sk89q.worldedit.internal.annotation.Selection; import com.sk89q.worldedit.internal.expression.ExpressionException; -import com.sk89q.worldedit.regions.CuboidRegion; import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.Vector3; +import com.sk89q.worldedit.regions.CuboidRegion; import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.util.TreeGenerator.TreeType; import com.sk89q.worldedit.util.command.binding.Range; import com.sk89q.worldedit.util.command.binding.Switch; import com.sk89q.worldedit.util.command.binding.Text; import com.sk89q.worldedit.util.command.parametric.Optional; -import com.sk89q.worldedit.util.command.parametric.ParameterException; import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.block.BlockType; @@ -63,7 +61,9 @@ import java.awt.image.BufferedImage; import java.io.IOException; import java.net.URL; -import static com.sk89q.minecraft.util.commands.Logging.LogMode.*; +import static com.sk89q.minecraft.util.commands.Logging.LogMode.ALL; +import static com.sk89q.minecraft.util.commands.Logging.LogMode.PLACEMENT; +import static com.sk89q.minecraft.util.commands.Logging.LogMode.POSITION; /** @@ -89,7 +89,7 @@ public class GenerationCommands extends MethodCommands { ) @CommandPermissions("worldedit.generation.caves") @Logging(PLACEMENT) - public void caves(FawePlayer fp, LocalSession session, EditSession editSession, @Selection Region region, @Optional("8") int size, @Optional("40") int frequency, @Optional("7") int rarity, @Optional("8") int minY, @Optional("127") int maxY, @Optional("1") int systemFrequency, @Optional("25") int individualRarity, @Optional("0") int pocketChance, @Optional("0") int pocketMin, @Optional("3") int pocketMax, CommandContext context) throws WorldEditException, ParameterException { + public void caves(FawePlayer fp, LocalSession session, EditSession editSession, @Selection Region region, @Optional("8") int size, @Optional("40") int frequency, @Optional("7") int rarity, @Optional("8") int minY, @Optional("127") int maxY, @Optional("1") int systemFrequency, @Optional("25") int individualRarity, @Optional("0") int pocketChance, @Optional("0") int pocketMin, @Optional("3") int pocketMax, CommandContext context) throws WorldEditException { fp.checkConfirmationRegion(() -> { CavesGen gen = new CavesGen(size, frequency, rarity, minY, maxY, systemFrequency, individualRarity, pocketChance, pocketMin, pocketMax); editSession.generate(region, gen); @@ -108,7 +108,7 @@ public class GenerationCommands extends MethodCommands { ) @CommandPermissions("worldedit.generation.ore") @Logging(PLACEMENT) - public void ores(FawePlayer player, LocalSession session, EditSession editSession, @Selection Region region, Mask mask, CommandContext context) throws WorldEditException, ParameterException { + public void ores(FawePlayer player, LocalSession session, EditSession editSession, @Selection Region region, Mask mask, CommandContext context) throws WorldEditException { player.checkConfirmationRegion(() -> { editSession.addOres(region, mask); BBC.VISITOR_BLOCK.send(player, editSession.getBlockChangeCount()); @@ -124,7 +124,7 @@ public class GenerationCommands extends MethodCommands { ) @CommandPermissions("worldedit.generation.image") @Logging(PLACEMENT) - public void image(Player player, LocalSession session, EditSession editSession, String arg, @Optional("true") boolean randomize, @Optional("100") int threshold, @Optional BlockVector2 dimensions) throws WorldEditException, ParameterException, IOException { + public void image(Player player, LocalSession session, EditSession editSession, String arg, @Optional("true") boolean randomize, @Optional("100") int threshold, @Optional BlockVector2 dimensions) throws WorldEditException, IOException { TextureUtil tu = Fawe.get().getCachedTextureUtil(randomize, 0, threshold); URL url = new URL(arg); if (!url.getHost().equalsIgnoreCase("i.imgur.com") && !url.getHost().equalsIgnoreCase("empcraft.com")) { @@ -174,7 +174,7 @@ public class GenerationCommands extends MethodCommands { ) @CommandPermissions("worldedit.generation.ore") @Logging(PLACEMENT) - public void ore(FawePlayer player, LocalSession session, EditSession editSession, @Selection Region region, Mask mask, Pattern material, @Range(min = 0) int size, int freq, @Range(min = 0, max = 100) int rarity, @Range(min = 0, max = 255) int minY, @Range(min = 0, max = 255) int maxY, CommandContext context) throws WorldEditException, ParameterException { + public void ore(FawePlayer player, LocalSession session, EditSession editSession, @Selection Region region, Mask mask, Pattern material, @Range(min = 0) int size, int freq, @Range(min = 0, max = 100) int rarity, @Range(min = 0, max = 255) int minY, @Range(min = 0, max = 255) int maxY, CommandContext context) throws WorldEditException { player.checkConfirmationRegion(() -> { editSession.addOre(region, mask, material, size, freq, rarity, minY, maxY); BBC.VISITOR_BLOCK.send(player, editSession.getBlockChangeCount()); @@ -182,20 +182,20 @@ public class GenerationCommands extends MethodCommands { } @Command( - aliases = {"/hcyl"}, - usage = " [,] [height]", - desc = "Generates a hollow cylinder.", - help = - "Generates a hollow cylinder.\n" + - "By specifying 2 radii, separated by a comma,\n" + - "you can generate elliptical cylinders.\n" + - "The 1st radius is north/south, the 2nd radius is east/west.", - min = 2, - max = 4 + aliases = { "/hcyl" }, + usage = " [,] [height]", + desc = "Generates a hollow cylinder.", + help = + "Generates a hollow cylinder.\n" + + "By specifying 2 radii, separated by a comma,\n" + + "you can generate elliptical cylinders.\n" + + "The 1st radius is north/south, the 2nd radius is east/west.", + min = 2, + max = 4 ) @CommandPermissions("worldedit.generation.cylinder") @Logging(PLACEMENT) - public void hcyl(FawePlayer fp, Player player, LocalSession session, EditSession editSession, Pattern pattern, BlockVector2 radius, @Optional("1") int height, @Range(min = 1) @Optional("1") double thickness, CommandContext context) throws WorldEditException, ParameterException { + public void hcyl(FawePlayer fp, Player player, LocalSession session, EditSession editSession, Pattern pattern, BlockVector2 radius, @Optional("1") int height, @Range(min = 1) @Optional("1") double thickness, CommandContext context) throws WorldEditException { double max = MathMan.max(radius.getBlockX(), radius.getBlockZ()); worldEdit.checkMaxRadius(max); BlockVector3 pos = session.getPlacementPosition(player); @@ -206,22 +206,22 @@ public class GenerationCommands extends MethodCommands { } @Command( - aliases = {"/cyl"}, - usage = " [,] [height]", - flags = "h", - desc = "Generates a cylinder.", - help = - "Generates a cylinder.\n" + - "By specifying 2 radii, separated by a comma,\n" + - "you can generate elliptical cylinders.\n" + - "The 1st radius is north/south, the 2nd radius is east/west.", - min = 2, - max = 3 + aliases = { "/cyl" }, + usage = " [,] [height]", + flags = "h", + desc = "Generates a cylinder.", + help = + "Generates a cylinder.\n" + + "By specifying 2 radii, separated by a comma,\n" + + "you can generate elliptical cylinders.\n" + + "The 1st radius is north/south, the 2nd radius is east/west.", + min = 2, + max = 3 ) @CommandPermissions("worldedit.generation.cylinder") @Logging(PLACEMENT) - public void cyl(FawePlayer fp, Player player, LocalSession session, EditSession editSession, Pattern pattern, BlockVector2 radius, @Optional("1") int height, @Switch('h') boolean hollow, CommandContext context) throws WorldEditException, ParameterException { - double max = MathMan.max(radius.getBlockX(), radius.getBlockZ()); + public void cyl(FawePlayer fp, Player player, LocalSession session, EditSession editSession, Pattern pattern, BlockVector2 radius, @Optional("1") int height, @Switch('h') boolean hollow, CommandContext context) throws WorldEditException { + double max = Math.max(radius.getBlockX(), radius.getBlockZ()); worldEdit.checkMaxRadius(max); BlockVector3 pos = session.getPlacementPosition(player); fp.checkConfirmationRadius(() -> { @@ -231,39 +231,39 @@ public class GenerationCommands extends MethodCommands { } @Command( - aliases = {"/hsphere"}, - usage = " [,,] [raised?]", - desc = "Generates a hollow sphere.", - help = - "Generates a hollow sphere.\n" + - "By specifying 3 radii, separated by commas,\n" + - "you can generate an ellipsoid. The order of the ellipsoid radii\n" + - "is north/south, up/down, east/west.", - min = 2, - max = 3 + aliases = { "/hsphere" }, + usage = " [,,] [raised?]", + desc = "Generates a hollow sphere.", + help = + "Generates a hollow sphere.\n" + + "By specifying 3 radii, separated by commas,\n" + + "you can generate an ellipsoid. The order of the ellipsoid radii\n" + + "is north/south, up/down, east/west.", + min = 2, + max = 3 ) @CommandPermissions("worldedit.generation.sphere") @Logging(PLACEMENT) - public void hsphere(FawePlayer fp, Player player, LocalSession session, EditSession editSession, Pattern pattern, BlockVector3 radius, @Optional("false") boolean raised, CommandContext context) throws WorldEditException, ParameterException { + public void hsphere(FawePlayer fp, Player player, LocalSession session, EditSession editSession, Pattern pattern, BlockVector3 radius, @Optional("false") boolean raised, CommandContext context) throws WorldEditException { sphere(fp, player, session, editSession, pattern, radius, raised, true, context); } @Command( - aliases = {"/sphere"}, - usage = " [,,] [raised?]", - flags = "h", - desc = "Generates a filled sphere.", - help = - "Generates a filled sphere.\n" + - "By specifying 3 radii, separated by commas,\n" + - "you can generate an ellipsoid. The order of the ellipsoid radii\n" + - "is north/south, up/down, east/west.", - min = 2, - max = 3 + aliases = { "/sphere" }, + usage = " [,,] [raised?]", + flags = "h", + desc = "Generates a filled sphere.", + help = + "Generates a filled sphere.\n" + + "By specifying 3 radii, separated by commas,\n" + + "you can generate an ellipsoid. The order of the ellipsoid radii\n" + + "is north/south, up/down, east/west.", + min = 2, + max = 3 ) @CommandPermissions("worldedit.generation.sphere") @Logging(PLACEMENT) - public void sphere(FawePlayer fp, Player player, LocalSession session, EditSession editSession, Pattern pattern, BlockVector3 radius, @Optional("false") boolean raised, @Switch('h') boolean hollow, CommandContext context) throws WorldEditException, ParameterException { + public void sphere(FawePlayer fp, Player player, LocalSession session, EditSession editSession, Pattern pattern, BlockVector3 radius, @Optional("false") boolean raised, @Switch('h') boolean hollow, CommandContext context) throws WorldEditException { double max = MathMan.max(radius.getBlockX(), radius.getBlockY(), radius.getBlockZ()); worldEdit.checkMaxRadius(max); BlockVector3 pos = session.getPlacementPosition(player); @@ -276,36 +276,37 @@ public class GenerationCommands extends MethodCommands { } @Command( - aliases = {"forestgen"}, - usage = "[size] [tree-type] [density]", - desc = "Generate a forest", - min = 0, - max = 3 + aliases = { "forestgen" }, + usage = "[size] [type] [density]", + desc = "Generate a forest", + min = 0, + max = 3 ) @CommandPermissions("worldedit.generation.forest") @Logging(POSITION) - @SuppressWarnings("deprecation") - public void forestGen(Player player, LocalSession session, EditSession editSession, @Optional("10") int size, @Optional("tree") TreeType type, @Optional("5") @Range(min = 0, max = 100) double density) throws WorldEditException, ParameterException { + public void forestGen(Player player, LocalSession session, EditSession editSession, @Optional("10") int size, + @Optional("tree") TreeType type, @Optional("5") @Range(min = 0, max = 100) double density) throws WorldEditException { density = density / 100; int affected = editSession.makeForest(session.getPlacementPosition(player), size, density, type); - player.print(BBC.getPrefix() + affected + " trees created."); + player.print(affected + " trees created."); } @Command( - aliases = {"pumpkins"}, - usage = "[size=10]", - desc = "Generate pumpkin patches", - max = 2 + aliases = { "pumpkins" }, + usage = "[size]", + desc = "Generate pumpkin patches", + min = 0, + max = 2 ) @CommandPermissions("worldedit.generation.pumpkins") @Logging(POSITION) - public void pumpkins(Player player, LocalSession session, EditSession editSession, @Optional("10") int apothem) throws WorldEditException, ParameterException { + public void pumpkins(Player player, LocalSession session, EditSession editSession, @Optional("10") int apothem) throws WorldEditException { int affected = editSession.makePumpkinPatches(session.getPlacementPosition(player), apothem); BBC.COMMAND_PUMPKIN.send(player, affected); } @Command( - aliases = {"/hpyramid"}, + aliases = { "/hpyramid" }, usage = " ", desc = "Generate a hollow pyramid", min = 2, @@ -313,21 +314,21 @@ public class GenerationCommands extends MethodCommands { ) @CommandPermissions("worldedit.generation.pyramid") @Logging(PLACEMENT) - public void hollowPyramid(FawePlayer fp, Player player, LocalSession session, EditSession editSession, Pattern pattern, @Range(min = 1) int size, CommandContext context) throws WorldEditException, ParameterException { + public void hollowPyramid(FawePlayer fp, Player player, LocalSession session, EditSession editSession, Pattern pattern, @Range(min = 1) int size, CommandContext context) throws WorldEditException { pyramid(fp, player, session, editSession, pattern, size, true, context); } @Command( - aliases = {"/pyramid"}, - usage = " ", - flags = "h", - desc = "Generate a filled pyramid", - min = 2, - max = 2 + aliases = { "/pyramid" }, + usage = " ", + flags = "h", + desc = "Generate a filled pyramid", + min = 2, + max = 2 ) @CommandPermissions("worldedit.generation.pyramid") @Logging(PLACEMENT) - public void pyramid(FawePlayer fp, Player player, LocalSession session, EditSession editSession, Pattern pattern, @Range(min = 1) int size, @Switch('h') boolean hollow, CommandContext context) throws WorldEditException, ParameterException { + public void pyramid(FawePlayer fp, Player player, LocalSession session, EditSession editSession, Pattern pattern, @Range(min = 1) int size, @Switch('h') boolean hollow, CommandContext context) throws WorldEditException { BlockVector3 pos = session.getPlacementPosition(player); worldEdit.checkMaxRadius(size); fp.checkConfirmationRadius(() -> { @@ -336,26 +337,26 @@ public class GenerationCommands extends MethodCommands { BBC.VISITOR_BLOCK.send(fp, affected); }, getArguments(context), size, context); } - + @Command( - aliases = {"/generate", "/gen", "/g"}, - usage = " ", - desc = "Generates a shape according to a formula.", - help = - "Generates a shape according to a formula that is expected to\n" + - "return positive numbers (true) if the point is inside the shape\n" + - "Optionally set type/data to the desired block.\n" + - "Flags:\n" + - " -h to generate a hollow shape\n" + - " -r to use raw minecraft coordinates\n" + - " -o is like -r, except offset from placement.\n" + - " -c is like -r, except offset selection center.\n" + - "If neither -r nor -o is given, the selection is mapped to -1..1\n" + - "See also tinyurl.com/wesyntax.", - flags = "hroc", - min = 2, - max = -1 + aliases = { "/generate", "/gen", "/g" }, + usage = " ", + desc = "Generates a shape according to a formula.", + help = + "Generates a shape according to a formula that is expected to\n" + + "return positive numbers (true) if the point is inside the shape\n" + + "Optionally set type/data to the desired block.\n" + + "Flags:\n" + + " -h to generate a hollow shape\n" + + " -r to use raw minecraft coordinates\n" + + " -o is like -r, except offset from placement.\n" + + " -c is like -r, except offset selection center.\n" + + "If neither -r nor -o is given, the selection is mapped to -1..1\n" + + "See also tinyurl.com/wesyntax.", + flags = "hroc", + min = 2, + max = -1 ) @CommandPermissions("worldedit.generation.shape") @Logging(ALL) @@ -394,7 +395,7 @@ public class GenerationCommands extends MethodCommands { if (unit.getY() == 0) unit = unit.withY(1.0); if (unit.getZ() == 0) unit = unit.withZ(1.0); } - + final Vector3 unit1 = unit; fp.checkConfirmationRegion(() -> { @@ -403,29 +404,29 @@ public class GenerationCommands extends MethodCommands { player.findFreePosition(); BBC.VISITOR_BLOCK.send(fp, affected); } catch (ExpressionException e) { - fp.sendMessage(BBC.getPrefix() + e.getMessage()); + fp.sendMessage(e.getMessage()); } }, getArguments(context), region, context); } @Command( - aliases = {"/generatebiome", "/genbiome", "/gb"}, - usage = " ", - desc = "Sets biome according to a formula.", - help = - "Generates a shape according to a formula that is expected to\n" + - "return positive numbers (true) if the point is inside the shape\n" + - "Sets the biome of blocks in that shape.\n" + - "Flags:\n" + - " -h to generate a hollow shape\n" + - " -r to use raw minecraft coordinates\n" + - " -o is like -r, except offset from placement.\n" + - " -c is like -r, except offset selection center.\n" + - "If neither -r nor -o is given, the selection is mapped to -1..1\n" + - "See also tinyurl.com/wesyntax.", - flags = "hroc", - min = 2, - max = -1 + aliases = { "/generatebiome", "/genbiome", "/gb" }, + usage = " ", + desc = "Sets biome according to a formula.", + help = + "Generates a shape according to a formula that is expected to\n" + + "return positive numbers (true) if the point is inside the shape\n" + + "Sets the biome of blocks in that shape.\n" + + "Flags:\n" + + " -h to generate a hollow shape\n" + + " -r to use raw minecraft coordinates\n" + + " -o is like -r, except offset from placement.\n" + + " -c is like -r, except offset selection center.\n" + + "If neither -r nor -o is given, the selection is mapped to -1..1\n" + + "See also tinyurl.com/wesyntax.", + flags = "hroc", + min = 2, + max = -1 ) @CommandPermissions("worldedit.generation.shape.biome") @Logging(ALL) @@ -464,17 +465,18 @@ public class GenerationCommands extends MethodCommands { if (unit.getY() == 0) unit = unit.withY(1.0); if (unit.getZ() == 0) unit = unit.withZ(1.0); } - + final Vector3 unit1 = unit; - + fp.checkConfirmationRegion(() -> { try { final int affected = editSession.makeBiomeShape(region, zero, unit1, target, expression, hollow); player.findFreePosition(); BBC.VISITOR_FLAT.send(fp, affected); } catch (ExpressionException e) { - fp.sendMessage(BBC.getPrefix() + e.getMessage()); + fp.toWorldEditPlayer().printError(e.getMessage()); } }, getArguments(context), region, context); } + } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/HistoryCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/HistoryCommands.java index 072a957c4..cffd21cc1 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/HistoryCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/HistoryCommands.java @@ -117,7 +117,7 @@ public class HistoryCommands extends MethodCommands { rollback.setTime(historyFile.lastModified()); RollbackDatabase db = DBHandler.IMP.getDatabase(world); db.logEdit(rollback); - player.print(BBC.getPrefix() + "Logging: " + historyFile); + player.print("Logging: " + historyFile); } } } catch (IllegalArgumentException e) { @@ -127,7 +127,7 @@ public class HistoryCommands extends MethodCommands { } } } - player.print(BBC.getPrefix() + "Done import!"); + player.print("Done import!"); return; } String toParse = user.substring(1); @@ -311,4 +311,4 @@ public class HistoryCommands extends MethodCommands { } -} \ No newline at end of file +} 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 a538527ee..2a91c05fc 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 @@ -42,7 +42,6 @@ import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.extension.platform.Capability; import com.sk89q.worldedit.function.GroundFunction; import com.sk89q.worldedit.function.generator.FloraGenerator; -import com.sk89q.worldedit.function.generator.ForestGenerator; import com.sk89q.worldedit.function.mask.ExistingBlockMask; import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.function.mask.NoiseFilter2D; @@ -136,7 +135,7 @@ public class RegionCommands extends MethodCommands { FawePlayer fp = FawePlayer.wrap(player); final Location loc = player.getLocation(); FaweQueue queue = fp.getFaweQueue(false); - fp.sendMessage(BBC.getPrefix() + "Light: " + queue.getEmmittedLight(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()) + " | " + queue.getSkyLight(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ())); + fp.sendMessage("Light: " + queue.getEmmittedLight(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()) + " | " + queue.getSkyLight(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ())); } @Command( @@ -220,14 +219,14 @@ public class RegionCommands extends MethodCommands { } @Command( - aliases = {"/line"}, + aliases = { "/line" }, usage = " [thickness]", desc = "Draws a line segment between cuboid selection corners", help = - "Draws a line segment between cuboid selection corners.\n" + - "Can only be used with cuboid selections.\n" + - "Flags:\n" + - " -h generates only a shell", + "Draws a line segment between cuboid selection corners.\n" + + "Can only be used with cuboid selections.\n" + + "Flags:\n" + + " -h generates only a shell", flags = "h", min = 1, max = 2 @@ -241,7 +240,7 @@ public class RegionCommands extends MethodCommands { @Switch('h') boolean shell) throws WorldEditException { if (!(region instanceof CuboidRegion)) { - player.printError(BBC.getPrefix() + "//line only works with cuboid selections"); + player.printError("//line only works with cuboid selections"); return; } @@ -258,10 +257,10 @@ public class RegionCommands extends MethodCommands { usage = " [thickness]", desc = "Draws a spline through selected points", help = - "Draws a spline through selected points.\n" + - "Can only be used with convex polyhedral selections.\n" + - "Flags:\n" + - " -h generates only a shell", + "Draws a spline through selected points.\n" + + "Can only be used with convex polyhedral selections.\n" + + "Flags:\n" + + " -h generates only a shell", flags = "h", min = 1, max = 2 @@ -275,7 +274,7 @@ public class RegionCommands extends MethodCommands { @Switch('h') boolean shell, CommandContext context) throws WorldEditException { if (!(region instanceof ConvexPolyhedralRegion)) { - player.sendMessage(BBC.getPrefix() + "//curve only works with convex polyhedral selections"); + player.sendMessage("//curve only works with convex polyhedral selections"); return; } worldEdit.checkMaxRadius(thickness); @@ -293,10 +292,10 @@ public class RegionCommands extends MethodCommands { @Command( aliases = { "/replace", "/re", "/rep" }, usage = "[from-mask] ", - desc = "Replace all blocks in the selection with another", - flags = "f", - min = 1, - max = 2 + desc = "Replace all blocks in the selection with another", + flags = "f", + min = 1, + max = 2 ) @CommandPermissions("worldedit.region.replace") @Logging(REGION) @@ -316,7 +315,7 @@ public class RegionCommands extends MethodCommands { } @Command( - aliases = {"/set", "/s"}, + aliases = { "/set", "/s" }, usage = "[pattern]", desc = "Set all blocks within selection", min = 1, @@ -336,11 +335,11 @@ public class RegionCommands extends MethodCommands { } @Command( - aliases = {"/overlay"}, - usage = "", - desc = "Set a block on top of blocks in the region", - min = 1, - max = 1 + aliases = { "/overlay" }, + usage = "", + desc = "Set a block on top of blocks in the region", + min = 1, + max = 1 ) @CommandPermissions("worldedit.region.overlay") @Logging(REGION) @@ -386,11 +385,11 @@ public class RegionCommands extends MethodCommands { } @Command( - aliases = {"/center", "/middle"}, - usage = "", - desc = "Set the center block(s)", - min = 1, - max = 1 + aliases = { "/center", "/middle" }, + usage = "", + desc = "Set the center block(s)", + min = 1, + max = 1 ) @Logging(REGION) @CommandPermissions("worldedit.region.center") @@ -400,11 +399,11 @@ public class RegionCommands extends MethodCommands { } @Command( - aliases = {"/naturalize"}, - usage = "", - desc = "3 layers of dirt on top then rock below", - min = 0, - max = 0 + aliases = { "/naturalize" }, + usage = "", + desc = "3 layers of dirt on top then rock below", + min = 0, + max = 0 ) @CommandPermissions("worldedit.region.naturalize") @Logging(REGION) @@ -416,11 +415,11 @@ public class RegionCommands extends MethodCommands { } @Command( - aliases = {"/walls"}, - usage = "", - desc = "Build the four sides of the selection", - min = 1, - max = 1 + aliases = { "/walls" }, + usage = "", + desc = "Build the four sides of the selection", + min = 1, + max = 1 ) @CommandPermissions("worldedit.region.walls") @Logging(REGION) @@ -432,11 +431,11 @@ public class RegionCommands extends MethodCommands { } @Command( - aliases = {"/faces", "/outline"}, - usage = "", - desc = "Build the walls, ceiling, and floor of a selection", - min = 1, - max = 1 + aliases = { "/faces", "/outline" }, + usage = "", + desc = "Build the walls, ceiling, and floor of a selection", + min = 1, + max = 1 ) @CommandPermissions("worldedit.region.faces") @Logging(REGION) @@ -458,7 +457,7 @@ public class RegionCommands extends MethodCommands { min = 0, max = 2 ) - @CommandPermissions("worldedit.region.smoothsnow") + @CommandPermissions("worldedit.region.smooth") @Logging(REGION) public void smooth(FawePlayer player, EditSession editSession, @Selection Region region, @Optional("1") int iterations, @Optional Mask mask, @Switch('s') boolean snow, CommandContext context) throws WorldEditException { BlockVector3 min = region.getMinimumPoint(); @@ -514,16 +513,16 @@ public class RegionCommands extends MethodCommands { @Command( - aliases = {"/move"}, + aliases = { "/move" }, usage = "[count] [direction] [leave-id]", - flags = "sbea", + flags = "saeb", desc = "Move the contents of the selection", help = "Moves the contents of the selection.\n" + "The -s flag shifts the selection to the target location.\n" + - " -b also copies biomes\n" + - " -e ignores entities\n" + - " -a ignores air\n" + + "The -b also copies biomes\n" + + "The -e ignores entities\n" + + "The -a ignores air blocks.\n" + "Optionally fills the old location with .", min = 0, max = 3 @@ -550,7 +549,7 @@ public class RegionCommands extends MethodCommands { session.getRegionSelector(player.getWorld()).learnChanges(); session.getRegionSelector(player.getWorld()).explainRegionAdjust(player.getPlayer(), session); } catch (RegionOperationException e) { - player.sendMessage(BBC.getPrefix() + e.getMessage()); + player.sendMessage(e.getMessage()); } } @@ -559,7 +558,7 @@ public class RegionCommands extends MethodCommands { } @Command( - aliases = {"/fall"}, + aliases = { "/fall" }, usage = "[replace]", flags = "m", desc = "Have the blocks in the selection fall", @@ -583,21 +582,21 @@ public class RegionCommands extends MethodCommands { } @Command( - aliases = {"/stack"}, - usage = "[count] [direction]", - flags = "sam", - desc = "Repeat the contents of the selection", - help = - "Repeats the contents of the selection.\n" + - "Flags:\n" + - " -s shifts the selection to the last stacked copy\n" + - " -a skips air blocks", - min = 0, - max = 2 + aliases = { "/stack" }, + usage = "[count] [direction]", + flags = "sam", + desc = "Repeat the contents of the selection", + help = + "Repeats the contents of the selection.\n" + + "Flags:\n" + + " -s shifts the selection to the last stacked copy\n" + + " -a skips air blocks", + min = 0, + max = 2 ) @CommandPermissions("worldedit.region.stack") @Logging(ORIENTATION_REGION) - public void stack(FawePlayer player, LocalSession session, EditSession editSession, + public void stack(FawePlayer player, EditSession editSession, LocalSession session, @Selection Region region, @Optional("1") @Range(min = 1) int count, @Optional(Direction.AIM) @Direction(includeDiagonals = true) BlockVector3 direction, @@ -620,7 +619,7 @@ public class RegionCommands extends MethodCommands { session.getRegionSelector(player.getWorld()).learnChanges(); session.getRegionSelector(player.getWorld()).explainRegionAdjust(player.getPlayer(), session); } catch (RegionOperationException e) { - player.sendMessage(BBC.getPrefix() + e.getMessage()); + player.sendMessage(e.getMessage()); } } @@ -629,14 +628,14 @@ public class RegionCommands extends MethodCommands { } @Command( - aliases = {"/deform"}, + aliases = { "/deform" }, usage = "", desc = "Deforms a selected region with an expression", help = - "Deforms a selected region with an expression\n" + - "The expression is executed for each block and is expected\n" + - "to modify the variables x, y and z to point to a new block\n" + - "to fetch. See also tinyurl.com/wesyntax.", + "Deforms a selected region with an expression\n" + + "The expression is executed for each block and is expected\n" + + "to modify the variables x, y and z to point to a new block\n" + + "to fetch. See also tinyurl.com/wesyntax.", flags = "ro", min = 1, max = -1 @@ -651,6 +650,7 @@ public class RegionCommands extends MethodCommands { CommandContext context) throws WorldEditException { final Vector3 zero; Vector3 unit; + if (useRawCoords) { zero = Vector3.ZERO; unit = Vector3.ONE; @@ -676,13 +676,13 @@ public class RegionCommands extends MethodCommands { player.findFreePosition(); BBC.VISITOR_BLOCK.send(fp, affected); } catch (ExpressionException e) { - fp.sendMessage(BBC.getPrefix() + e.getMessage()); + fp.sendMessage(e.getMessage()); } }, getArguments(context), region, context); } @Command( - aliases = {"/regen"}, + aliases = { "/regen" }, usage = "[biome] [seed]", desc = "Regenerates the contents of the selection", help = @@ -727,15 +727,15 @@ public class RegionCommands extends MethodCommands { } @Command( - aliases = {"/hollow"}, - usage = "[[ ]]", - desc = "Hollows out the object contained in this selection", - help = - "Hollows out the object contained in this selection.\n" + - "Optionally fills the hollowed out part with the given block.\n" + - "Thickness is measured in manhattan distance.", - min = 0, - max = 2 + aliases = { "/hollow" }, + usage = "[[ ]]", + desc = "Hollows out the object contained in this selection", + help = + "Hollows out the object contained in this selection.\n" + + "Optionally fills the hollowed out part with the given block.\n" + + "Thickness is measured in manhattan distance.", + min = 0, + max = 2 ) @CommandPermissions("worldedit.region.hollow") @Logging(REGION) @@ -751,7 +751,7 @@ public class RegionCommands extends MethodCommands { } @Command( - aliases = {"/forest"}, + aliases = { "/forest" }, usage = "[type] [density]", desc = "Make a forest within the region", min = 0, @@ -766,7 +766,7 @@ public class RegionCommands extends MethodCommands { } @Command( - aliases = {"/flora"}, + aliases = { "/flora" }, usage = "[density]", desc = "Make flora within the region", min = 0, @@ -786,5 +786,4 @@ public class RegionCommands extends MethodCommands { }, getArguments(context), region, context); } - } 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 123f34c1a..13f766d03 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 @@ -183,7 +183,7 @@ public class SchematicCommands extends MethodCommands { for (Clipboard clip : session.getClipboard().getClipboards()) { remapper.apply(clip); } - player.print(BBC.getPrefix() + "Remapped schematic"); + player.print("Remapped schematic"); } @Command( @@ -227,7 +227,7 @@ public class SchematicCommands extends MethodCommands { } f = player.openFileOpenDialog(extensions); if (f == null || !f.exists()) { - player.printError(BBC.getPrefix() + "Schematic " + filename + " does not exist! (" + f + ")"); + player.printError("Schematic " + filename + " does not exist! (" + f + ")"); return; } } else { @@ -248,7 +248,7 @@ public class SchematicCommands extends MethodCommands { } } if (f == null || !f.exists() || !MainUtil.isInSubDirectory(working, f)) { - player.printError(BBC.getPrefix() + "Schematic " + filename + " does not exist! (" + ((f != null) && f.exists()) + "|" + f + "|" + (f != null && !MainUtil.isInSubDirectory(working, f)) + ")"); + player.printError("Schematic " + filename + " does not exist! (" + ((f != null) && f.exists()) + "|" + f + "|" + (f != null && !MainUtil.isInSubDirectory(working, f)) + ")"); return; } if (format == null) { @@ -264,9 +264,9 @@ public class SchematicCommands extends MethodCommands { format.hold(player, uri, in); BBC.SCHEMATIC_LOADED.send(player, filename); } catch (IllegalArgumentException e) { - player.printError(BBC.getPrefix() + "Unknown filename: " + filename); + player.printError("Unknown filename: " + filename); } catch (URISyntaxException | IOException e) { - player.printError(BBC.getPrefix() + "File could not be read or it does not exist: " + e.getMessage()); + player.printError("File could not be read or it does not exist: " + e.getMessage()); log.warn("Failed to load a saved clipboard", e); } finally { if (in != null) { @@ -290,7 +290,7 @@ public class SchematicCommands extends MethodCommands { LocalConfiguration config = worldEdit.getConfiguration(); ClipboardFormat format = ClipboardFormats.findByAlias(formatName); if (format == null) { - player.printError(BBC.getPrefix() + "Unknown schematic format: " + formatName); + player.printError("Unknown schematic format: " + formatName); return; } File working = worldEdit.getWorkingDirectoryFile(config.saveDir); @@ -322,7 +322,7 @@ public class SchematicCommands extends MethodCommands { Files.createDirectories(parent.toPath()); } catch (IOException e) { e.printStackTrace(); - log.info(BBC.getPrefix() + "Could not create folder for schematics!"); + log.info("Could not create folder for schematics!"); return; } } @@ -367,11 +367,11 @@ public class SchematicCommands extends MethodCommands { } } catch (IllegalArgumentException e) { e.printStackTrace(); - player.printError(BBC.getPrefix() + "Unknown filename: " + filename); + player.printError("Unknown filename: " + filename); } catch (IOException e) { e.printStackTrace(); - player.printError(BBC.getPrefix() + "Schematic could not written: " + e.getMessage()); - log.warn(BBC.getPrefix() + "Failed to write a saved clipboard", e); + player.printError("Schematic could not written: " + e.getMessage()); + log.warn("Failed to write a saved clipboard", e); } } @@ -390,7 +390,7 @@ public class SchematicCommands extends MethodCommands { File dir = Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS ? new File(working, player.getUniqueId().toString()) : working; File destDir = new File(dir, directory); if (!MainUtil.isInSubDirectory(working, destDir)) { - player.printError(BBC.getPrefix() + "Directory " + destDir + " does not exist!"); + player.printError("Directory " + destDir + " does not exist!"); return; } if (Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS && !MainUtil.isInSubDirectory(dir, destDir) && !player.hasPermission("worldedit.schematic.move.other")) { @@ -404,7 +404,7 @@ public class SchematicCommands extends MethodCommands { return; } if (!destDir.exists() && !destDir.mkdirs()) { - player.printError(BBC.getPrefix() + "Creation of " + destDir + " failed! (check file permissions)"); + player.printError("Creation of " + destDir + " failed! (check file permissions)"); return; } for (File source : sources) { @@ -457,7 +457,7 @@ public class SchematicCommands extends MethodCommands { } for (File f : files) { if (!MainUtil.isInSubDirectory(working, f) || !f.exists()) { - player.printError(BBC.getPrefix() + "Schematic " + filename + " does not exist! (" + f.exists() + "|" + f + "|" + (!MainUtil.isInSubDirectory(working, f)) + ")"); + player.printError("Schematic " + filename + " does not exist! (" + f.exists() + "|" + f + "|" + (!MainUtil.isInSubDirectory(working, f)) + ")"); continue; } if (Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS && !MainUtil.isInSubDirectory(dir, f) && !player.hasPermission("worldedit.schematic.delete.other")) { @@ -465,7 +465,7 @@ public class SchematicCommands extends MethodCommands { continue; } if (!delete(f)) { - player.printError(BBC.getPrefix() + "Deletion of " + filename + " failed! Maybe it is read-only."); + player.printError("Deletion of " + filename + " failed! Maybe it is read-only."); continue; } BBC.FILE_DELETED.send(player, filename); 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 dd26d49f8..3250ed82e 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 @@ -87,7 +87,7 @@ public class ScriptingCommands { String ext = filename.substring(index + 1, filename.length()); if (!ext.equalsIgnoreCase("js")) { - actor.printError(BBC.getPrefix() + "Only .js scripts are currently supported"); + actor.printError("Only .js scripts are currently supported"); return null; } @@ -100,7 +100,7 @@ public class ScriptingCommands { file = WorldEdit.class.getResourceAsStream("craftscripts/" + filename); if (file == null) { - actor.printError(BBC.getPrefix() + "Script does not exist: " + filename); + actor.printError("Script does not exist: " + filename); return null; } } else { @@ -113,7 +113,7 @@ public class ScriptingCommands { in.close(); script = new String(data, 0, data.length, "utf-8"); } catch (IOException e) { - actor.printError(BBC.getPrefix() + "Script read error: " + e.getMessage()); + actor.printError("Script read error: " + e.getMessage()); return null; } @@ -154,14 +154,14 @@ public class ScriptingCommands { result = engine.evaluate(script, filename, vars); } catch (ScriptException e) { e.printStackTrace(); - actor.printError(BBC.getPrefix() + "Failed to execute:"); + actor.printError("Failed to execute:"); actor.printRaw(e.getMessage()); } catch (NumberFormatException e) { throw e; } catch (WorldEditException e) { throw e; } catch (Throwable e) { - actor.printError(BBC.getPrefix() + "Failed to execute (see console):"); + actor.printError("Failed to execute (see console):"); actor.printRaw(e.getClass().getCanonicalName()); e.printStackTrace(); } @@ -203,7 +203,7 @@ public class ScriptingCommands { @CommandPermissions("worldedit.scripting.execute") @Logging(ALL) public void executeLast(Player player, LocalSession session, CommandContext args) throws WorldEditException { - + String lastScript = session.getLastScript(); if (!player.hasPermission("worldedit.scripting.execute." + lastScript)) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/SnapshotCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/SnapshotCommands.java index 178811dfa..b8028725f 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/SnapshotCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/SnapshotCommands.java @@ -81,7 +81,7 @@ public class SnapshotCommands { BBC.SNAPSHOT_LIST_HEADER.send(player, player.getWorld().getName()); for (byte i = 0; i < Math.min(num, snapshots.size()); i++) { - player.print(BBC.getPrefix() + (i + 1) + ". " + snapshots.get(i).getName()); + player.print((i + 1) + ". " + snapshots.get(i).getName()); } BBC.SNAPSHOT_LIST_FOOTER.send(player); @@ -92,10 +92,9 @@ public class SnapshotCommands { File dir = config.snapshotRepo.getDirectory(); try { - WorldEdit.logger.info(BBC.getPrefix() + "WorldEdit found no snapshots: looked in: " - + dir.getCanonicalPath()); + WorldEdit.logger.info("WorldEdit found no snapshots: looked in: " + dir.getCanonicalPath()); } catch (IOException e) { - WorldEdit.logger.info(BBC.getPrefix() + "WorldEdit found no snapshots: looked in " + WorldEdit.logger.info("WorldEdit found no snapshots: looked in " + "(NON-RESOLVABLE PATH - does it exist?): " + dir.getPath()); } @@ -168,7 +167,7 @@ public class SnapshotCommands { try { index = Integer.parseInt(args.getString(0)); } catch (NumberFormatException e) { - player.printError(BBC.getPrefix() + "Invalid index, " + args.getString(0) + " is not a valid integer."); + player.printError("Invalid index, " + args.getString(0) + " is not a valid integer."); return; } @@ -180,7 +179,7 @@ public class SnapshotCommands { try { List snapshots = config.snapshotRepo.getSnapshots(true, player.getWorld().getName()); if (snapshots.size() < index) { - player.printError(BBC.getPrefix() + "Invalid index, must be between 1 and " + snapshots.size() + "."); + player.printError("Invalid index, must be between 1 and " + snapshots.size() + "."); return; } Snapshot snapshot = snapshots.get(index - 1); @@ -222,7 +221,7 @@ public class SnapshotCommands { if (snapshot == null) { dateFormat.setTimeZone(session.getTimeZone()); - player.printError(BBC.getPrefix() + "Couldn't find a snapshot before " + player.printError("Couldn't find a snapshot before " + dateFormat.format(date.getTime()) + "."); } else { session.setSnapshot(snapshot); @@ -260,7 +259,7 @@ public class SnapshotCommands { Snapshot snapshot = config.snapshotRepo.getSnapshotAfter(date, player.getWorld().getName()); if (snapshot == null) { dateFormat.setTimeZone(session.getTimeZone()); - player.printError(BBC.getPrefix() + "Couldn't find a snapshot after " + player.printError("Couldn't find a snapshot after " + dateFormat.format(date.getTime()) + "."); } else { session.setSnapshot(snapshot); 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 4d2258064..1a3df1ab0 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 @@ -56,7 +56,7 @@ public class ToolUtilCommands { String newState = args.getString(0, null); if (session.hasSuperPickAxe()) { if ("on".equals(newState)) { - player.printError(BBC.getPrefix() + "Super pick axe already enabled."); + player.printError("Super pick axe already enabled."); return; } @@ -64,7 +64,7 @@ public class ToolUtilCommands { player.print("Super pick axe disabled."); } else { if ("off".equals(newState)) { - player.printError(BBC.getPrefix() + "Super pick axe already disabled."); + player.printError("Super pick axe already disabled."); return; } session.enableSuperPickAxe(); 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 3e1be3564..0a2bd2f2e 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 @@ -102,6 +102,7 @@ import java.util.function.Consumer; */ @Command(aliases = {}, desc = "Various utility commands: [More Info](http://wiki.sk89q.com/wiki/WorldEdit/Utilities)") public class UtilityCommands extends MethodCommands { + private final WorldEdit we; public UtilityCommands(WorldEdit we) { @@ -173,7 +174,7 @@ public class UtilityCommands extends MethodCommands { } }.send(player); } else { - UtilityCommands.help(args, worldEdit, player, getCommand().aliases()[0] + " ", parser.getDispatcher()); + UtilityCommands.help(args, player, getCommand().aliases()[0] + " ", parser.getDispatcher()); } } } @@ -248,163 +249,175 @@ public class UtilityCommands extends MethodCommands { } @Command( - aliases = {"/fill"}, - usage = " [depth] [direction]", - desc = "Fill a hole", - min = 2, - max = 4 + aliases = { "/fill" }, + usage = " [depth] [direction]", + desc = "Fill a hole", + min = 2, + max = 4 ) @CommandPermissions("worldedit.fill") @Logging(PLACEMENT) public void fill(Player player, LocalSession session, EditSession editSession, Pattern pattern, double radius, @Optional("1") double depth, @Optional("down") @Direction BlockVector3 direction) throws WorldEditException { - worldEdit.checkMaxRadius(radius); + we.checkMaxRadius(radius); BlockVector3 pos = session.getPlacementPosition(player); - int affected; - affected = editSession.fillDirection(pos, pattern, radius, (int) depth, direction); - player.print(BBC.getPrefix() + affected + " block(s) have been created."); + int affected = editSession.fillDirection(pos, pattern, radius, (int) depth, direction); + player.print(affected + " block(s) have been created."); } @Command( - aliases = {"/fillr"}, - usage = " [depth]", - desc = "Fill a hole recursively", - min = 2, - max = 3 + aliases = { "/fillr" }, + usage = " [depth]", + desc = "Fill a hole recursively", + min = 2, + max = 3 ) @CommandPermissions("worldedit.fill.recursive") @Logging(PLACEMENT) public void fillr(Player player, LocalSession session, EditSession editSession, Pattern pattern, double radius, @Optional("-1") double depth) throws WorldEditException { - worldEdit.checkMaxRadius(radius); + we.checkMaxRadius(radius); BlockVector3 pos = session.getPlacementPosition(player); if (depth == -1) depth = Integer.MAX_VALUE; int affected = editSession.fillXZ(pos, pattern, radius, (int) depth, true); - player.print(BBC.getPrefix() + affected + " block(s) have been created."); + player.print(affected + " block(s) have been created."); } @Command( - aliases = {"/drain"}, - usage = "", - desc = "Drain a pool", - min = 1, - max = 1 + aliases = { "/drain" }, + usage = "", + flags = "w", + desc = "Drain a pool", + help = "Removes all connected water sources.\n" + + " If -w is specified, also makes waterlogged blocks non-waterlogged.", + min = 1, + max = 1 ) @CommandPermissions("worldedit.drain") @Logging(PLACEMENT) - public void drain(Player player, LocalSession session, EditSession editSession, double radius) throws WorldEditException { - worldEdit.checkMaxRadius(radius); + public void drain(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { + + double radius = Math.max(0, args.getDouble(0)); + boolean waterlogged = args.hasFlag('w'); + we.checkMaxRadius(radius); int affected = editSession.drainArea( - session.getPlacementPosition(player), radius); - player.print(BBC.getPrefix() + affected + " block(s) have been changed."); + session.getPlacementPosition(player), radius, waterlogged); + player.print(affected + " block(s) have been changed."); } @Command( - aliases = {"/fixlava", "fixlava"}, - usage = "", - desc = "Fix lava to be stationary", - min = 1, - max = 1 + aliases = { "/fixlava", "fixlava" }, + usage = "", + desc = "Fix lava to be stationary", + min = 1, + max = 1 ) @CommandPermissions("worldedit.fixlava") @Logging(PLACEMENT) - public void fixLava(Player player, LocalSession session, EditSession editSession, @Range(min = 0) double radius) throws WorldEditException { - worldEdit.checkMaxRadius(radius); - int affected = editSession.fixLiquid( - session.getPlacementPosition(player), radius, BlockTypes.LAVA); - player.print(BBC.getPrefix() + affected + " block(s) have been changed."); + public void fixLava(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { + + double radius = Math.max(0, args.getDouble(0)); + we.checkMaxRadius(radius); + int affected = editSession.fixLiquid(session.getPlacementPosition(player), radius, BlockTypes.LAVA); + player.print(affected + " block(s) have been changed."); } @Command( - aliases = {"/fixwater", "fixwater"}, - usage = "", - desc = "Fix water to be stationary", - min = 1, - max = 1 + aliases = { "/fixwater", "fixwater" }, + usage = "", + desc = "Fix water to be stationary", + min = 1, + max = 1 ) @CommandPermissions("worldedit.fixwater") @Logging(PLACEMENT) - public void fixWater(Player player, LocalSession session, EditSession editSession, @Range(min = 0) double radius) throws WorldEditException { - worldEdit.checkMaxRadius(radius); - int affected = editSession.fixLiquid( - session.getPlacementPosition(player), radius, BlockTypes.WATER); + public void fixWater(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { + + double radius = Math.max(0, args.getDouble(0)); + we.checkMaxRadius(radius); + int affected = editSession.fixLiquid(session.getPlacementPosition(player), radius, BlockTypes.WATER); BBC.VISITOR_BLOCK.send(player, affected); } @Command( - aliases = {"/removeabove", "removeabove"}, - usage = "[size] [height]", - desc = "Remove blocks above your head.", - min = 0, - max = 2 + aliases = { "/removeabove", "removeabove" }, + usage = "[size] [height]", + desc = "Remove blocks above your head.", + min = 0, + max = 2 ) @CommandPermissions("worldedit.removeabove") @Logging(PLACEMENT) public void removeAbove(Player player, LocalSession session, EditSession editSession, @Optional("1") double size, @Optional("256") double height) throws WorldEditException { - worldEdit.checkMaxRadius(size); + + we.checkMaxRadius(size); int affected = editSession.removeAbove(session.getPlacementPosition(player), (int) size, (int) height); BBC.VISITOR_BLOCK.send(player, affected); } @Command( - aliases = {"/removebelow", "removebelow"}, - usage = "[size] [height]", - desc = "Remove blocks below you.", - min = 0, - max = 2 + aliases = { "/removebelow", "removebelow" }, + usage = "[size] [height]", + desc = "Remove blocks below you.", + min = 0, + max = 2 ) @CommandPermissions("worldedit.removebelow") @Logging(PLACEMENT) public void removeBelow(Player player, LocalSession session, EditSession editSession, @Optional("1") double size, @Optional("256") double height) throws WorldEditException { - worldEdit.checkMaxRadius(size); + + we.checkMaxRadius(size); int affected = editSession.removeBelow(session.getPlacementPosition(player), (int) size, (int) height); BBC.VISITOR_BLOCK.send(player, affected); } @Command( - aliases = {"/removenear", "removenear"}, - usage = " [size]", - desc = "Remove blocks near you.", - min = 1, - max = 2 + aliases = { "/removenear", "removenear" }, + usage = " [size]", + desc = "Remove blocks near you.", + min = 1, + max = 2 ) @CommandPermissions("worldedit.removenear") @Logging(PLACEMENT) public void removeNear(Player player, LocalSession session, EditSession editSession, Mask mask, @Optional("50") double size) throws WorldEditException { - worldEdit.checkMaxRadius(size); + + we.checkMaxRadius(size); size = Math.max(1, size); int affected = editSession.removeNear(session.getPlacementPosition(player), mask, (int) size); BBC.VISITOR_BLOCK.send(player, affected); } @Command( - aliases = {"/replacenear", "replacenear"}, - usage = " ", - desc = "Replace nearby blocks", - flags = "f", - min = 3, - max = 3 + aliases = { "/replacenear", "replacenear" }, + usage = " ", + desc = "Replace nearby blocks", + flags = "f", + min = 3, + max = 3 ) @CommandPermissions("worldedit.replacenear") @Logging(PLACEMENT) public void replaceNear(Player player, LocalSession session, EditSession editSession, double size, @Optional Mask from, Pattern to) throws WorldEditException { + if (from == null) { from = new ExistingBlockMask(editSession); } + int affected; BlockVector3 base = session.getPlacementPosition(player); BlockVector3 min = base.subtract((int)size, (int)size, (int)size); BlockVector3 max = base.add((int)size, (int)size, (int)size); Region region = new CuboidRegion(player.getWorld(), min, max); - int affected = editSession.replaceBlocks(region, from, to); + affected = editSession.replaceBlocks(region, from, to); BBC.VISITOR_BLOCK.send(player, affected); } @Command( - aliases = {"/snow", "snow"}, - usage = "[radius]", - desc = "Simulates snow", - min = 0, - max = 1 + aliases = { "/snow", "snow" }, + usage = "[radius]", + desc = "Simulates snow", + min = 0, + max = 1 ) @CommandPermissions("worldedit.snow") @Logging(PLACEMENT) @@ -413,15 +426,15 @@ public class UtilityCommands extends MethodCommands { we.checkMaxRadius(size); int affected = editSession.simulateSnow(session.getPlacementPosition(player), size); - player.print(BBC.getPrefix() + affected + " surfaces covered. Let it snow~"); + player.print(affected + " surfaces covered. Let it snow~"); } @Command( - aliases = {"/thaw", "thaw"}, - usage = "[radius]", - desc = "Thaws the area", - min = 0, - max = 1 + aliases = {"/thaw", "thaw"}, + usage = "[radius]", + desc = "Thaws the area", + min = 0, + max = 1 ) @CommandPermissions("worldedit.thaw") @Logging(PLACEMENT) @@ -430,17 +443,17 @@ public class UtilityCommands extends MethodCommands { we.checkMaxRadius(size); int affected = editSession.thaw(session.getPlacementPosition(player), size); - player.print(BBC.getPrefix() + affected + " surfaces thawed."); + player.print(affected + " surfaces thawed."); } @Command( - aliases = {"/green", "green"}, - usage = "[radius]", - desc = "Greens the area", - help = "Converts dirt to grass blocks. -f also converts coarse dirt.", - flags = "f", - min = 0, - max = 1 + aliases = { "/green", "green" }, + usage = "[radius]", + desc = "Greens the area", + help = "Converts dirt to grass blocks. -f also converts coarse dirt.", + flags = "f", + min = 0, + max = 1 ) @CommandPermissions("worldedit.green") @Logging(PLACEMENT) @@ -454,51 +467,51 @@ public class UtilityCommands extends MethodCommands { } @Command( - aliases = {"/ex", "/ext", "/extinguish", "ex", "ext", "extinguish"}, + aliases = { "/ex", "/ext", "/extinguish", "ex", "ext", "extinguish" }, usage = "[radius]", desc = "Extinguish nearby fire", min = 0, max = 1 - ) + ) @CommandPermissions("worldedit.extinguish") @Logging(PLACEMENT) public void extinguish(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { - LocalConfiguration config = worldEdit.getConfiguration(); + LocalConfiguration config = we.getConfiguration(); int defaultRadius = config.maxRadius != -1 ? Math.min(40, config.maxRadius) : 40; int size = args.argsLength() > 0 ? Math.max(1, args.getInteger(0)) : defaultRadius; - worldEdit.checkMaxRadius(size); + we.checkMaxRadius(size); int affected = editSession.removeNear(session.getPlacementPosition(player), BlockTypes.FIRE.toMask(editSession), size); BBC.VISITOR_BLOCK.send(player, affected); } @Command( - aliases = {"butcher"}, - usage = "[radius]", - flags = "plangbtfr", - desc = "Kill all or nearby mobs", - help = - "Kills nearby mobs, based on radius, if none is given uses default in configuration.\n" + - "Flags:\n" + - " -p also kills pets.\n" + - " -n also kills NPCs.\n" + - " -g also kills Golems.\n" + - " -a also kills animals.\n" + - " -b also kills ambient mobs.\n" + - " -t also kills mobs with name tags.\n" + - " -f compounds all previous flags.\n" + - " -r also destroys armor stands.\n" + - " -l currently does nothing.", - min = 0, - max = 1 + aliases = { "butcher" }, + usage = "[radius]", + flags = "plangbtfr", + desc = "Kill all or nearby mobs", + help = + "Kills nearby mobs, based on radius, if none is given uses default in configuration.\n" + + "Flags:\n" + + " -p also kills pets.\n" + + " -n also kills NPCs.\n" + + " -g also kills Golems.\n" + + " -a also kills animals.\n" + + " -b also kills ambient mobs.\n" + + " -t also kills mobs with name tags.\n" + + " -f compounds all previous flags.\n" + + " -r also destroys armor stands.\n" + + " -l currently does nothing.", + min = 0, + max = 1 ) @CommandPermissions("worldedit.butcher") @Logging(PLACEMENT) public void butcher(Actor actor, CommandContext args) throws WorldEditException { - LocalConfiguration config = worldEdit.getConfiguration(); + LocalConfiguration config = we.getConfiguration(); Player player = actor instanceof Player ? (Player) actor : null; // technically the default can be larger than the max, but that's not my problem @@ -562,11 +575,11 @@ public class UtilityCommands extends MethodCommands { } @Command( - aliases = {"remove", "rem", "rement"}, - usage = " ", - desc = "Remove all entities of a type", - min = 2, - max = 2 + aliases = { "remove", "rem", "rement" }, + usage = " ", + desc = "Remove all entities of a type", + min = 2, + max = 2 ) @CommandPermissions("worldedit.remove") @Logging(PLACEMENT) @@ -588,7 +601,7 @@ public class UtilityCommands extends MethodCommands { EditSession editSession = null; if (player != null) { - session = worldEdit.getSessionManager().get(player); + session = we.getSessionManager().get(player); BlockVector3 center = session.getPlacementPosition(player); editSession = session.createEditSession(player); List entities; @@ -600,7 +613,7 @@ public class UtilityCommands extends MethodCommands { } visitors.add(new EntityVisitor(entities.iterator(), remover.createFunction())); } else { - Platform platform = worldEdit.getPlatformManager().queryCapability(Capability.WORLD_EDITING); + Platform platform = we.getPlatformManager().queryCapability(Capability.WORLD_EDITING); for (World world : platform.getWorlds()) { List entities = world.getEntities(); visitors.add(new EntityVisitor(entities.iterator(), remover.createFunction())); @@ -622,9 +635,9 @@ public class UtilityCommands extends MethodCommands { } @Command( - aliases = {"/calc", "/calculate", "/eval", "/evaluate", "/solve"}, - usage = "", - desc = "Evaluate a mathematical expression" + aliases = { "/calc", "/calculate", "/eval", "/evaluate", "/solve" }, + usage = "", + desc = "Evaluate a mathematical expression" ) @CommandPermissions("worldedit.calc") public void calc(final Actor actor, @Text String input) throws CommandException { @@ -646,7 +659,7 @@ public class UtilityCommands extends MethodCommands { } executor.shutdownNow(); - actor.print(BBC.getPrefix() + "= " + result); + actor.print("= " + result); } catch (EvaluationException e) { actor.printError(String.format( "'%s' could not be evaluated (error: %s)", input, e.getMessage())); @@ -667,15 +680,16 @@ public class UtilityCommands extends MethodCommands { } @Command( - aliases = {"/help"}, - usage = "[]", - desc = "Displays help for WorldEdit commands", - min = 0, - max = -1, - queued = false + aliases = { "/help" }, + usage = "[]", + desc = "Displays help for WorldEdit commands", + min = 0, + max = -1, + queued = false ) + @CommandPermissions("worldedit.help") public void help(Actor actor, CommandContext args) throws WorldEditException { - help(args, worldEdit, actor); + help(args, we, actor); } protected static CommandMapping detectCommand(Dispatcher dispatcher, String command, boolean isRootLevel) { @@ -720,7 +734,7 @@ public class UtilityCommands extends MethodCommands { AtomicInteger pageInt = new AtomicInteger(page); List fileList = new ArrayList<>(); if (perPage == -1) perPage = actor instanceof Player ? 12 : 20; // More pages for console - page = getFiles(dir, actor, args, page, perPage, formatName, playerFolder, file -> fileList.add(file)); + page = getFiles(dir, actor, args, page, perPage, formatName, playerFolder, fileList::add); if (fileList.isEmpty()) { BBC.SCHEMATIC_NONE.send(actor); @@ -843,16 +857,6 @@ public class UtilityCommands extends MethodCommands { listMine = true; } - FileFilter ignoreUUIDs = f -> { - try { - if (f.isDirectory()) { - UUID uuid = UUID.fromString(f.getName()); - return false; - } - } catch (IllegalArgumentException ignored) {} - return true; - }; - List toFilter = new ArrayList<>(); if (!filters.isEmpty()) { forEachFile = new DelegateConsumer(forEachFile) { @@ -986,10 +990,10 @@ public class UtilityCommands extends MethodCommands { } public static void help(CommandContext args, WorldEdit we, Actor actor) { - help(args, we, actor, "/", we.getPlatformManager().getCommandManager().getDispatcher()); + help(args, actor, "/", we.getPlatformManager().getCommandManager().getDispatcher()); } - public static void help(CommandContext args, WorldEdit we, Actor actor, String prefix, CommandCallable callable) { + public static void help(CommandContext args, Actor actor, String prefix, CommandCallable callable) { final int perPage = actor instanceof Player ? 12 : 20; // More pages for console HelpBuilder builder = new HelpBuilder(callable, args, perPage) { @@ -1007,7 +1011,6 @@ public class UtilityCommands extends MethodCommands { public void displayCategories(Map> categories) { Message msg = new Message(); msg.prefix().text(BBC.HELP_HEADER_CATEGORIES).newline(); - boolean first = true; for (Map.Entry> entry : categories.entrySet()) { String s1 = Commands.getAlias(UtilityCommands.class, "/help") + " " + entry.getKey(); String s2 = entry.getValue().size() + ""; 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 5591d341d..d4405fe55 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 @@ -71,12 +71,12 @@ public class BlockDataCyler implements DoubleActionBlockTool { BBC.BLOCK_CYCLER_CANNOT_CYCLE.send(player); } else { Property currentProperty = selectedProperties.get(player.getUniqueId()); - + if (currentProperty == null || (forward && block.getState(currentProperty) == null)) { currentProperty = block.getStates().keySet().stream().findFirst().get(); selectedProperties.put(player.getUniqueId(), currentProperty); } - + if (forward) { block.getState(currentProperty); int index = currentProperty.getValues().indexOf(block.getState(currentProperty)); @@ -84,12 +84,12 @@ public class BlockDataCyler implements DoubleActionBlockTool { @SuppressWarnings("unchecked") Property objProp = (Property) currentProperty; BlockState newBlock = block.with(objProp, currentProperty.getValues().get(index)); - + try { EditSession editSession = session.createEditSession(player); try { editSession.setBlock(blockPoint, newBlock); - player.print(BBC.getPrefix() + "Value of " + currentProperty.getName() + " is now " + currentProperty.getValues().get(index).toString()); + player.print("Value of " + currentProperty.getName() + " is now " + currentProperty.getValues().get(index).toString()); } catch (MaxChangedBlocksException e) { BBC.BLOCK_CYCLER_LIMIT.send(player); } finally { @@ -102,7 +102,7 @@ public class BlockDataCyler implements DoubleActionBlockTool { index = (index + 1) % properties.size(); currentProperty = properties.get(index); selectedProperties.put(player.getUniqueId(), currentProperty); - player.print(BBC.getPrefix() + "Now cycling " + currentProperty.getName()); + player.print("Now cycling " + currentProperty.getName()); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/BlockReplacer.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/BlockReplacer.java index fe6589777..0375729e8 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/BlockReplacer.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/BlockReplacer.java @@ -80,7 +80,7 @@ public class BlockReplacer implements DoubleActionBlockTool { if (type != null) { this.pattern = targetBlock; - player.print(BBC.getPrefix() + "Replacer tool switched to: " + type.getName()); + player.print("Replacer tool switched to: " + type.getName()); } return true; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/CommandManager.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/CommandManager.java index b589bed78..af8a13050 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/CommandManager.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/CommandManager.java @@ -483,9 +483,9 @@ public final class CommandManager { } catch (CommandException e) { String message = e.getMessage(); if (message != null) { - actor.printError(BBC.getPrefix() + e.getMessage()); + actor.printError(e.getMessage()); } else { - actor.printError(BBC.getPrefix() + "An unknown FAWE error has occurred! Please see console."); + actor.printError("An unknown FAWE error has occurred! Please see console."); log.error("An unknown FAWE error occurred", e); } } catch (Throwable e) { @@ -493,7 +493,7 @@ public final class CommandManager { if (faweException != null) { BBC.WORLDEDIT_CANCEL_REASON.send(actor, faweException.getMessage()); } else { - actor.printError(BBC.getPrefix() + "There was an error handling a FAWE command: [See console]"); + actor.printError("There was an error handling a FAWE command: [See console]"); actor.printRaw(e.getClass().getName() + ": " + e.getMessage()); log.error("An unexpected error occurred while handling a FAWE command", e); } 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 4bdd72c74..5894b3bed 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 @@ -516,7 +516,7 @@ public class PlatformManager { if (faweException != null) { BBC.WORLDEDIT_CANCEL_REASON.send(player, faweException.getMessage()); } else { - player.printError(BBC.getPrefix() + "Please report this error: [See console]"); + player.printError("Please report this error: [See console]"); player.printRaw(e.getClass().getName() + ": " + e.getMessage()); MainUtil.handleError(e); } 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 ae1f2c15b..70cd9045b 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 @@ -124,17 +124,16 @@ public class ClipboardFormats { return null; } - + /** * Detect the format using the given extension - * @param string - * the extension + * @param extension the extension * @return the format, otherwise null if one cannot be detected */ @Nullable public static ClipboardFormat findByExtension(String extension) { checkNotNull(extension); - + Collection> entries = getFileExtensionMap().entries(); for(Map.Entry entry : entries) { if(entry.getKey().equalsIgnoreCase(extension)) { @@ -142,7 +141,7 @@ public class ClipboardFormats { } } return null; - + } /** @@ -210,7 +209,7 @@ public class ClipboardFormats { } f = player.openFileOpenDialog(extensions); if (f == null || !f.exists()) { - if (message) player.printError(BBC.getPrefix() + "Schematic " + input + " does not exist! (" + f + ")"); + if (message) player.printError("Schematic " + input + " does not exist! (" + f + ")"); return null; } } else { @@ -231,7 +230,7 @@ public class ClipboardFormats { } } if (f == null || !f.exists() || !MainUtil.isInSubDirectory(working, f)) { - if (message) player.printError(BBC.getPrefix() + "Schematic " + input + " does not exist! (" + ((f == null) ? false : f.exists()) + "|" + f + "|" + (f == null ? false : !MainUtil.isInSubDirectory(working, f)) + ")"); + if (message) player.printError("Schematic " + input + " does not exist! (" + ((f == null) ? false : f.exists()) + "|" + f + "|" + (f == null ? false : !MainUtil.isInSubDirectory(working, f)) + ")"); return null; } if (format == null && f.isFile()) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/EllipsoidRegion.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/EllipsoidRegion.java index 9cef04a0e..57348c6a6 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/EllipsoidRegion.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/EllipsoidRegion.java @@ -19,13 +19,12 @@ package com.sk89q.worldedit.regions; - -import com.sk89q.worldedit.math.MutableBlockVector3; import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.storage.ChunkStore; + import java.util.HashSet; import java.util.Set; @@ -43,9 +42,6 @@ public class EllipsoidRegion extends AbstractRegion { * Stores the radii plus 0.5 on each axis. */ private Vector3 radius; - private Vector3 radiusSqr; - private int radiusLengthSqr; - private boolean sphere; /** * Construct a new instance of this ellipsoid region. @@ -57,11 +53,10 @@ public class EllipsoidRegion extends AbstractRegion { this(null, pos1, pos2); } - /** * Construct a new instance of this ellipsoid region. * - * @param world the world + * @param world the world * @param center the center * @param radius the radius */ @@ -87,7 +82,6 @@ public class EllipsoidRegion extends AbstractRegion { @Override public int getArea() { - if (radius == null) return 0; return (int) Math.floor((4.0 / 3.0) * Math.PI * radius.getX() * radius.getY() * radius.getZ()); } @@ -98,7 +92,7 @@ public class EllipsoidRegion extends AbstractRegion { @Override public int getHeight() { - return Math.max((int) (2 * radius.getY()), 256); + return (int) (2 * radius.getY()); } @Override @@ -129,7 +123,7 @@ public class EllipsoidRegion extends AbstractRegion { @Override public void expand(BlockVector3... changes) throws RegionOperationException { center = center.add(calculateDiff(changes)); - setRadius(radius.add(calculateChanges(changes))); + radius = radius.add(calculateChanges(changes)); } @Override @@ -169,7 +163,6 @@ public class EllipsoidRegion extends AbstractRegion { * @return radii */ public Vector3 getRadius() { - if (radius == null) return null; return radius.subtract(0.5, 0.5, 0.5); } @@ -179,14 +172,7 @@ public class EllipsoidRegion extends AbstractRegion { * @param radius the radius */ public void setRadius(Vector3 radius) { - this.radius = radius; - radiusSqr = radius.multiply(radius); - radiusLengthSqr = (int) radiusSqr.getX(); - if (radius.getY() == radius.getX() && radius.getX() == radius.getZ()) { - this.sphere = true; - } else { - this.sphere = false; - } + this.radius = radius.add(0.5, 0.5, 0.5); } @Override @@ -214,29 +200,8 @@ public class EllipsoidRegion extends AbstractRegion { } @Override - public boolean contains(BlockVector3 position) { - int cx = position.getBlockX() - center.getBlockX(); - int cx2 = cx * cx; - if (cx2 > radiusSqr.getBlockX()) { - return false; - } - int cz = position.getBlockZ() - center.getBlockZ(); - int cz2 = cz * cz; - if (cz2 > radiusSqr.getBlockZ()) { - return false; - } - int cy = position.getBlockY() - center.getBlockY(); - int cy2 = cy * cy; - if (radiusSqr.getBlockY() < 255 && cy2 > radiusSqr.getBlockY()) { - return false; - } - if (sphere) { - return cx2 + cy2 + cz2 <= radiusLengthSqr; - } - double cxd = (double) cx / radius.getBlockX(); - double cyd = (double) cy / radius.getBlockY(); - double czd = (double) cz / radius.getBlockZ(); - return cxd * cxd + cyd * cyd + czd * czd <= 1; + public boolean contains(BlockVector3 position) { + return position.subtract(center).toVector3().divide(radius).lengthSq() <= 1; } /** @@ -258,4 +223,5 @@ public class EllipsoidRegion extends AbstractRegion { public EllipsoidRegion clone() { return (EllipsoidRegion) super.clone(); } + } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/command/SimpleDispatcher.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/command/SimpleDispatcher.java index ca1273c30..6f6c32048 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/command/SimpleDispatcher.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/command/SimpleDispatcher.java @@ -142,7 +142,7 @@ public class SimpleDispatcher implements Dispatcher { } - throw new InvalidUsageException(BBC.getPrefix() + "Please choose a sub-command.", this, true); + throw new InvalidUsageException("Please choose a sub-command.", this, true); } @Override diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/command/parametric/FunctionParametricCallable.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/command/parametric/FunctionParametricCallable.java index f092117c6..dff7acf2d 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/command/parametric/FunctionParametricCallable.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/command/parametric/FunctionParametricCallable.java @@ -275,14 +275,14 @@ public class FunctionParametricCallable extends AParametricCallable { } return result; } catch (MissingParameterException e) { - throw new InvalidUsageException(BBC.getPrefix() + "Too few parameters!", this, true); + throw new InvalidUsageException("Too few parameters!", this, true); } catch (UnconsumedParameterException e) { - throw new InvalidUsageException(BBC.getPrefix() + "Too many parameters! Unused parameters: " + e.getUnconsumed(), this, true); + throw new InvalidUsageException("Too many parameters! Unused parameters: " + e.getUnconsumed(), this, true); } catch (ParameterException e) { assert parameter != null; String name = parameter.getName(); - throw new InvalidUsageException(BBC.getPrefix() + "For parameter '" + name + "': " + e.getMessage(), this, true); + throw new InvalidUsageException("For parameter '" + name + "': " + e.getMessage(), this, true); } catch (InvocationTargetException e) { if (e.getCause() instanceof CommandException) { throw (CommandException) e.getCause(); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/command/parametric/ParametricCallable.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/command/parametric/ParametricCallable.java index 9c0c26926..493d5f1d8 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/command/parametric/ParametricCallable.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/command/parametric/ParametricCallable.java @@ -271,9 +271,9 @@ public class ParametricCallable extends AParametricCallable { } return result; } catch (MissingParameterException e) { - throw new InvalidUsageException(BBC.getPrefix() + "Too few parameters!", this, true); + throw new InvalidUsageException("Too few parameters!", this, true); } catch (UnconsumedParameterException e) { - throw new InvalidUsageException(BBC.getPrefix() + "Too many parameters! Unused parameters: " + e.getUnconsumed(), this, true); + throw new InvalidUsageException("Too many parameters! Unused parameters: " + e.getUnconsumed(), this, true); } catch (ParameterException e) { assert parameter != null; String name = parameter.getName(); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/AbstractWorld.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/AbstractWorld.java index cc5b4be68..cd18a3489 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/AbstractWorld.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/AbstractWorld.java @@ -20,8 +20,6 @@ package com.sk89q.worldedit.world; import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.world.block.BaseBlock; -import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.blocks.BaseItem; import com.sk89q.worldedit.blocks.BaseItemStack; import com.sk89q.worldedit.extension.platform.Platform; @@ -32,6 +30,7 @@ import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.util.Direction; +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; @@ -144,7 +143,6 @@ public abstract class AbstractWorld implements World { this.priority = priority; } - @SuppressWarnings("deprecation") public void play() { playEffect(position, 2001, blockType.getLegacyCombinedId() >> 4); } @@ -154,4 +152,5 @@ public abstract class AbstractWorld implements World { return Double.compare(priority, other != null ? other.priority : 0); } } -} \ No newline at end of file + +}