- * This class follows the builder pattern, allowing for method chaining. It is set up such that
- * invocations of property-setting methods will affect the current editing component, and a call to
- * {@link #then()} or {@link #then(String)} will append a new editing component to the end of the
- * message, optionally initializing it with text. Further property-setting method calls will affect
- * that editing component.
- *
- */
-public class FancyMessage implements JsonRepresentedObject, Cloneable, Iterable,
- ConfigurationSerializable {
-
- static {
- ConfigurationSerialization.registerClass(FancyMessage.class);
- }
-
- private List messageParts;
- private int index;
- private String jsonString;
- private boolean dirty;
-
- private static Constructor> nmsPacketPlayOutChatConstructor;
-
- @Override
- public FancyMessage clone() throws CloneNotSupportedException {
- FancyMessage instance = (FancyMessage) super.clone();
- instance.messageParts = new ArrayList<>(messageParts.size());
- for (int i = 0; i < messageParts.size(); i++) {
- instance.messageParts.add(i, messageParts.get(i).clone());
- }
- instance.index = index;
- instance.dirty = false;
- instance.jsonString = null;
- return instance;
- }
-
- /**
- * Creates a JSON message with text.
- *
- * @param firstPartText The existing text in the message.
- */
- public FancyMessage(String firstPartText) {
- this(rawText(firstPartText));
- }
-
- private FancyMessage(TextualComponent firstPartText) {
- messageParts = new ArrayList<>();
- messageParts.add(new MessagePart(firstPartText));
- index = messageParts.size();
- jsonString = null;
- dirty = false;
- if (nmsPacketPlayOutChatConstructor == null) {
- try {
- nmsPacketPlayOutChatConstructor = Reflection.getNMSClass("PacketPlayOutChat")
- .getDeclaredConstructor(Reflection.getNMSClass("IChatBaseComponent"));
- nmsPacketPlayOutChatConstructor.setAccessible(true);
- } catch (NoSuchMethodException e) {
- Bukkit.getLogger()
- .log(Level.SEVERE, "Could not find Minecraft method or constructor.", e);
- } catch (SecurityException e) {
- Bukkit.getLogger().log(Level.WARNING, "Could not access constructor.", e);
- }
- }
- }
-
- /**
- * Creates a JSON message without text.
- */
- public FancyMessage() {
- this((TextualComponent) null);
- }
-
- /**
- * Sets the text of the current editing component to a value.
- *
- * @param text The new text of the current editing component.
- * @return This builder instance.
- */
- public FancyMessage text(String text) {
- MessagePart latest = latest();
- latest.text = rawText(text);
- dirty = true;
- return this;
- }
-
- /**
- * Sets the text of the current editing component to a value.
- *
- * @param text The new text of the current editing component.
- * @return This builder instance.
- */
- public FancyMessage text(TextualComponent text) {
- MessagePart latest = latest();
- latest.text = text;
- dirty = true;
- return this;
- }
-
- /**
- * @param text Text with coloring
- * @return This builder instance.
- * @throws IllegalArgumentException If the specified {@code ChatColor} enumeration value is not
- * a color (but a format value).
- */
- public FancyMessage color(String text) {
- index = messageParts.size();
- boolean color = false;
- ArrayDeque colors = new ArrayDeque<>();
- int last = 0;
- for (int i = 0; i < text.length(); i++) {
- char c = text.charAt(i);
- if (color != (color = false)) {
- ChatColor chatColor = ChatColor.getByChar(c);
- if (chatColor != null) {
- if (i - last > 1) {
- append(text.substring(last, i - 1));
- colors.forEach(this::color);
- colors.clear();
- }
- colors.add(chatColor);
- last = i + 1;
- }
- }
- if (c == '\u00A7') {
- color = true;
- }
- }
- if (text.length() - last > 0) {
- append(text.substring(last));
- colors.forEach(this::color);
- }
- index++;
- return this;
- }
-
- /**
- * Sets the color of the current editing component to a value. Setting the color will
- * clear current styles
- *
- * @param color The new color of the current editing component.
- * @return This builder instance.
- * @throws IllegalArgumentException If the specified {@code ChatColor} enumeration value is not
- * a color (but a format value).
- */
- public FancyMessage color(ChatColor color) {
- if (!color.isColor()) {
- if (color.isFormat()) {
- return style(color);
- }
- if (color == ChatColor.RESET) {
- color = ChatColor.WHITE;
- }
- } else {
- latest().styles.clear();
- }
- latest().color = color;
- dirty = true;
- return this;
- }
-
- /**
- * Sets the stylization of the current editing component.
- *
- * @param styles The array of styles to apply to the editing component.
- * @return This builder instance.
- * @throws IllegalArgumentException If any of the enumeration values in the array do not
- * represent formatters.
- */
- public FancyMessage style(ChatColor... styles) {
- for (ChatColor style : styles) {
- if (!style.isFormat()) {
- color(style);
- }
- }
- latest().styles.addAll(Arrays.asList(styles));
- dirty = true;
- return this;
- }
-
- /**
- * Set the behavior of the current editing component to instruct the client to open a file on
- * the client side filesystem when the currently edited part of the {@code FancyMessage} is
- * clicked.
- *
- * @param path The path of the file on the client filesystem.
- * @return This builder instance.
- */
- public FancyMessage file(String path) {
- onClick("open_file", path);
- return this;
- }
-
- /**
- * Set the behavior of the current editing component to instruct the client to open a webpage in
- * the client's web browser when the currently edited part of the {@code FancyMessage} is
- * clicked.
- *
- * @param url The URL of the page to open when the link is clicked.
- * @return This builder instance.
- */
- public FancyMessage link(String url) {
- onClick("open_url", url);
- return this;
- }
-
- /**
- * Set the behavior of the current editing component to instruct the client to replace the chat
- * input box content with the specified string when the currently edited part of the {@code
- * FancyMessage} is clicked. The client will not immediately send the command to the server to
- * be executed unless the client player submits the command/chat message, usually with the enter
- * key.
- *
- * @param command The text to display in the chat bar of the client.
- * @return This builder instance.
- */
- public FancyMessage suggest(String command) {
- onClick("suggest_command", command);
- return this;
- }
-
- /**
- * Set the behavior of the current editing component to instruct the client to append the chat
- * input box content with the specified string when the currently edited part of the {@code
- * FancyMessage} is SHIFT-CLICKED. The client will not immediately send the command to the
- * server to be executed unless the client player submits the command/chat message, usually with
- * the enter key.
- *
- * @param command The text to append to the chat bar of the client.
- * @return This builder instance.
- */
- public FancyMessage insert(String command) {
- onCurrent(m -> m.insertionData = command);
- dirty = true;
- return this;
- }
-
- /**
- * Set the behavior of the current editing component to instruct the client to send the
- * specified string to the server as a chat message when the currently edited part of the {@code
- * FancyMessage} is clicked. The client will immediately send the command to the server
- * to be executed when the editing component is clicked.
- *
- * @param command The text to display in the chat bar of the client.
- * @return This builder instance.
- */
- public FancyMessage command(String command) {
- onClick("run_command", command);
- return this;
- }
-
- /**
- * Set the behavior of the current editing component to display raw text when the client hovers
- * over the text.
- *
Tooltips do not inherit display characteristics, such as color and styles, from the
- * message component on which they are applied.
- *
- * @param text The text, which supports newlines, which will be displayed to the client upon
- * hovering.
- * @return This builder instance.
- */
- public FancyMessage tooltip(String text) {
- onHover("show_text", new JsonString(text));
- return this;
- }
-
- /**
- * Set the behavior of the current editing component to display raw text when the client hovers
- * over the text.
- *
Tooltips do not inherit display characteristics, such as color and styles, from the
- * message component on which they are applied.
- *
- * @param lines The lines of text which will be displayed to the client upon hovering. The
- * iteration order of this object will be the order in which the lines of the
- * tooltip are created.
- * @return This builder instance.
- */
- public FancyMessage tooltip(Iterable lines) {
- tooltip(ArrayWrapper.toArray(lines, String.class));
- return this;
- }
-
- /**
- * Set the behavior of the current editing component to display raw text when the client hovers
- * over the text.
- *
Tooltips do not inherit display characteristics, such as color and styles, from the
- * message component on which they are applied.
- *
- * @param lines The lines of text which will be displayed to the client upon hovering.
- * @return This builder instance.
- */
- public FancyMessage tooltip(String... lines) {
- StringBuilder builder = new StringBuilder();
- for (int i = 0; i < lines.length; i++) {
- builder.append(lines[i]);
- if (i != lines.length - 1) {
- builder.append('\n');
- }
- }
- tooltip(builder.toString());
- return this;
- }
-
- /**
- * Set the behavior of the current editing component to display formatted text when the client
- * hovers over the text.
- *
Tooltips do not inherit display characteristics, such as color and styles, from the
- * message component on which they are applied.
- *
- * @param text The formatted text which will be displayed to the client upon hovering.
- * @return This builder instance.
- */
- public FancyMessage formattedTooltip(FancyMessage text) {
- for (MessagePart component : text.messageParts) {
- if (component.clickActionData != null && component.clickActionName != null) {
- throw new IllegalArgumentException("The tooltip text cannot have click data.");
- } else if (component.hoverActionData != null && component.hoverActionName != null) {
- throw new IllegalArgumentException("The tooltip text cannot have a tooltip.");
- }
- }
- onHover("show_text", text);
- return this;
- }
-
- /**
- * Set the behavior of the current editing component to display the specified lines of formatted
- * text when the client hovers over the text.
- *
Tooltips do not inherit display characteristics, such as color and styles, from the
- * message component on which they are applied.
- *
- * @param lines The lines of formatted text which will be displayed to the client upon
- * hovering.
- * @return This builder instance.
- */
- public FancyMessage formattedTooltip(FancyMessage... lines) {
- if (lines.length < 1) {
- onHover(null, null); // Clear tooltip
- return this;
- }
-
- FancyMessage result = new FancyMessage();
- result.messageParts
- .clear(); // Remove the one existing text component that exists by default, which destabilizes the object
-
- for (int i = 0; i < lines.length; i++) {
- try {
- for (MessagePart component : lines[i]) {
- if (component.clickActionData != null && component.clickActionName != null) {
- throw new IllegalArgumentException(
- "The tooltip text cannot have click data.");
- } else if (component.hoverActionData != null
- && component.hoverActionName != null) {
- throw new IllegalArgumentException(
- "The tooltip text cannot have a tooltip.");
- }
- if (component.hasText()) {
- result.messageParts.add(component.clone());
- result.index = result.messageParts.size();
- }
- }
- if (i != lines.length - 1) {
- result.messageParts.add(new MessagePart(rawText("\n")));
- result.index = result.messageParts.size();
- }
- } catch (CloneNotSupportedException e) {
- Bukkit.getLogger().log(Level.WARNING, "Failed to clone object", e);
- return this;
- }
- }
- return formattedTooltip(
- result.messageParts.isEmpty() ? null : result); // Throws NPE if size is 0, intended
- }
-
- /**
- * Set the behavior of the current editing component to display the specified lines of formatted
- * text when the client hovers over the text.
- *
Tooltips do not inherit display characteristics, such as color and styles, from the
- * message component on which they are applied.
- *
- * @param lines The lines of text which will be displayed to the client upon hovering. The
- * iteration order of this object will be the order in which the lines of the
- * tooltip are created.
- * @return This builder instance.
- */
- public FancyMessage formattedTooltip(Iterable lines) {
- return formattedTooltip(ArrayWrapper.toArray(lines, FancyMessage.class));
- }
-
- /**
- * If the text is a translatable key, and it has replaceable values, this function can be used
- * to set the replacements that will be used in the message.
- *
- * @param replacements The replacements, in order, that will be used in the language-specific
- * message.
- * @return This builder instance.
- */
- public FancyMessage translationReplacements(String... replacements) {
- for (String str : replacements) {
- latest().translationReplacements.add(new JsonString(str));
- }
- dirty = true;
-
- return this;
- }
- /*
-
- /**
- * If the text is a translatable key, and it has replaceable values, this function can be used to set the replacements that will be used in the message.
- * @param replacements The replacements, in order, that will be used in the language-specific message.
- * @return This builder instance.
- */ /* ------------
- public FancyMessage translationReplacements(final Iterable extends CharSequence> replacements){
- for(CharSequence str : replacements){
- latest().translationReplacements.add(new JsonString(str));
- }
-
- return this;
- }
-
- */
-
- /**
- * If the text is a translatable key, and it has replaceable values, this function can be used
- * to set the replacements that will be used in the message.
- *
- * @param replacements The replacements, in order, that will be used in the language-specific
- * message.
- * @return This builder instance.
- */
- public FancyMessage translationReplacements(FancyMessage... replacements) {
- Collections.addAll(latest().translationReplacements, replacements);
-
- dirty = true;
-
- return this;
- }
-
- /**
- * If the text is a translatable key, and it has replaceable values, this function can be used
- * to set the replacements that will be used in the message.
- *
- * @param replacements The replacements, in order, that will be used in the language-specific
- * message.
- * @return This builder instance.
- */
- public FancyMessage translationReplacements(Iterable replacements) {
- return translationReplacements(
- ArrayWrapper.toArray(replacements, FancyMessage.class));
- }
-
- /**
- * Terminate construction of the current editing component, and begin construction of a new
- * message component. After a successful call to this method, all setter methods will refer to a
- * new message component, created as a result of the call to this method.
- *
- * @param text The text which will populate the new message component.
- * @return This builder instance.
- */
- public FancyMessage then(String text) {
- return then(rawText(text));
- }
-
- private FancyMessage append(String text) {
- if (!latest().hasText()) {
- throw new IllegalStateException("previous message part has no text");
- }
- MessagePart latest = latest();
- messageParts.add(new MessagePart(rawText(text)));
- latest().color = latest.color;
- latest().styles.addAll(latest.styles);
- dirty = true;
- return this;
- }
-
- /**
- * Terminate construction of the current editing component, and begin construction of a new
- * message component. After a successful call to this method, all setter methods will refer to a
- * new message component, created as a result of the call to this method.
- *
- * @param text The text which will populate the new message component.
- * @return This builder instance.
- */
- public FancyMessage then(TextualComponent text) {
- if (!latest().hasText()) {
- throw new IllegalStateException("previous message part has no text");
- }
- messageParts.add(new MessagePart(text));
- index = messageParts.size();
- dirty = true;
- return this;
- }
-
- /**
- * Terminate construction of the current editing component, and begin construction of a new
- * message component. After a successful call to this method, all setter methods will refer to a
- * new message component, created as a result of the call to this method.
- *
- * @return This builder instance.
- */
- public FancyMessage then() {
- if (!latest().hasText()) {
- throw new IllegalStateException("previous message part has no text");
- }
- messageParts.add(new MessagePart());
- index = messageParts.size();
- dirty = true;
- return this;
- }
-
- @Override
- public void writeJson(JsonWriter writer) throws IOException {
- if (messageParts.size() == 1) {
- latest().writeJson(writer);
- } else {
- writer.beginObject().name("text").value("").name("extra").beginArray();
- for (MessagePart part : this) {
- part.writeJson(writer);
- }
- writer.endArray().endObject();
- }
- }
-
- /**
- * Serialize this fancy message, converting it into syntactically-valid JSON using a {@link
- * JsonWriter}. This JSON should be compatible with vanilla formatter commands such as {@code
- * /tellraw}.
- *
- * @return The JSON string representing this object.
- */
- public String toJSONString() {
- if (!dirty && jsonString != null) {
- return jsonString;
- }
- StringWriter string = new StringWriter();
- JsonWriter json = new JsonWriter(string);
- try {
- writeJson(json);
- json.close();
- } catch (IOException e) {
- throw new RuntimeException("invalid message");
- }
- jsonString = string.toString();
- dirty = false;
- return jsonString;
- }
-
- /**
- * Sends this message to a player. The player will receive the fully-fledged formatted display
- * of this message.
- *
- * @param player The player who will receive the message.
- */
- public void send(Player player) {
- send(player, toJSONString());
- }
-
- private void send(CommandSender sender, String jsonString) {
- if (!(sender instanceof Player)) {
- sender.sendMessage(toOldMessageFormat());
- return;
- }
- Player player = (Player) sender;
- try {
- Object handle = Reflection.getHandle(player);
- Object connection = Reflection.getField(handle.getClass(), "playerConnection")
- .get(handle);
- Reflection
- .getMethod(connection.getClass(), "sendPacket", Reflection.getNMSClass("Packet"))
- .invoke(connection, createChatPacket(jsonString));
- } catch (IllegalArgumentException e) {
- Bukkit.getLogger().log(Level.WARNING, "Argument could not be passed.", e);
- } catch (IllegalAccessException e) {
- Bukkit.getLogger().log(Level.WARNING, "Could not access method.", e);
- } catch (InstantiationException e) {
- Bukkit.getLogger().log(Level.WARNING, "Underlying class is abstract.", e);
- } catch (InvocationTargetException e) {
- Bukkit.getLogger()
- .log(Level.WARNING, "A error has occurred during invoking of method.", e);
- } catch (NoSuchMethodException e) {
- Bukkit.getLogger().log(Level.WARNING, "Could not find method.", e);
- } catch (ClassNotFoundException e) {
- Bukkit.getLogger().log(Level.WARNING, "Could not find class.", e);
- }
- }
-
- // The ChatSerializer's instance of Gson
- private static Object nmsChatSerializerGsonInstance;
- private static Method fromJsonMethod;
-
- private Object createChatPacket(String json)
- throws IllegalArgumentException, IllegalAccessException, InstantiationException, InvocationTargetException, NoSuchMethodException, ClassNotFoundException {
- if (nmsChatSerializerGsonInstance == null) {
- // Find the field and its value, completely bypassing obfuscation
- Class> chatSerializerClazz;
-
- // Get the three parts of the version string (major version is currently unused)
- // vX_Y_RZ
- // X = major
- // Y = minor
- // Z = revision
- final String version = Reflection.getVersion();
- String[] split = version.substring(1, version.length() - 1)
- .split("_"); // Remove trailing dot
- //int majorVersion = Integer.parseInt(split[0]);
- int minorVersion = Integer.parseInt(split[1]);
- int revisionVersion = Integer.parseInt(split[2].substring(1)); // Substring to ignore R
-
- if (minorVersion < 8 || minorVersion == 8 && revisionVersion == 1) {
- chatSerializerClazz = Reflection.getNMSClass("ChatSerializer");
- } else {
- chatSerializerClazz = Reflection.getNMSClass("IChatBaseComponent$ChatSerializer");
- }
-
- if (chatSerializerClazz == null) {
- throw new ClassNotFoundException("Can't find the ChatSerializer class");
- }
-
- for (Field declaredField : chatSerializerClazz.getDeclaredFields()) {
- if (Modifier.isFinal(declaredField.getModifiers()) && Modifier
- .isStatic(declaredField.getModifiers()) && declaredField.getType().getName()
- .endsWith("Gson")) {
- // We've found our field
- declaredField.setAccessible(true);
- nmsChatSerializerGsonInstance = declaredField.get(null);
- fromJsonMethod = nmsChatSerializerGsonInstance.getClass()
- .getMethod("fromJson", String.class, Class.class);
- break;
- }
- }
- }
-
- // Since the method is so simple, and all the obfuscated methods have the same name, it's easier to reimplement 'IChatBaseComponent a(String)' than to reflectively call it
- // Of course, the implementation may change, but fuzzy matches might break with signature changes
- Object serializedChatComponent = fromJsonMethod.invoke(nmsChatSerializerGsonInstance, json,
- Reflection.getNMSClass("IChatBaseComponent"));
-
- return nmsPacketPlayOutChatConstructor.newInstance(serializedChatComponent);
- }
-
- /**
- * Sends this message to a command sender. If the sender is a player, they will receive the
- * fully-fledged formatted display of this message. Otherwise, they will receive a version of
- * this message with less formatting.
- *
- * @param sender The command sender who will receive the message.
- * @see #toOldMessageFormat()
- */
- public void send(CommandSender sender) {
- send(sender, toJSONString());
- }
-
- /**
- * Sends this message to multiple command senders.
- *
- * @param senders The command senders who will receive the message.
- * @see #send(CommandSender)
- */
- public void send(Iterable extends CommandSender> senders) {
- String string = toJSONString();
- for (CommandSender sender : senders) {
- send(sender, string);
- }
- }
-
- /**
- * Convert this message to a human-readable string with limited formatting. This method is used
- * to send this message to clients without JSON formatting support.
- *
- * Serialization of this message by using this message will include (in this order for each
- * message part):
- *
- *
The color of each message part.
- *
The applicable stylizations for each message part.
- *
The core text of the message part.
- *
- * The primary omissions are tooltips and clickable actions. Consequently, this method should be used only as a last resort.
- *
- *
- * Color and formatting can be removed from the returned string by using {@link ChatColor#stripColor(String)}.
- *
- * @return A human-readable string representing limited formatting in addition to the core text
- * of this message.
- */
- public String toOldMessageFormat() {
- StringBuilder result = new StringBuilder();
- for (MessagePart part : this) {
- result.append(part.color == null ? "" : part.color);
- for (ChatColor formatSpecifier : part.styles) {
- result.append(formatSpecifier);
- }
- result.append(part.text);
- }
- return result.toString();
- }
-
- private void onCurrent(Consumer call) {
- for (int i = index - 1; i < messageParts.size(); i++) {
- call.accept(messageParts.get(i));
- }
- }
-
- private MessagePart latest() {
- return messageParts.get(messageParts.size() - 1);
- }
-
- private void onClick(String name, String data) {
- onCurrent(m -> {
- m.clickActionName = name;
- m.clickActionData = data;
- });
- dirty = true;
- }
-
- private void onHover(String name, JsonRepresentedObject data) {
- onCurrent(m -> {
- m.hoverActionName = name;
- m.hoverActionData = data;
- });
- dirty = true;
- }
-
- // Doc copied from interface
- @Override
- public Map serialize() {
- HashMap map = new HashMap<>();
- map.put("messageParts", messageParts);
-// map.put("JSON", toJSONString());
- return map;
- }
-
- /**
- * Deserializes a JSON-represented message from a mapping of key-value pairs. This is called by
- * the Bukkit serialization API. It is not intended for direct public API consumption.
- *
- * @param serialized The key-value mapping which represents a fancy message.
- */
- @SuppressWarnings("unchecked")
- public static FancyMessage deserialize(Map serialized) {
- FancyMessage msg = new FancyMessage();
- msg.messageParts = (List) serialized.get("messageParts");
- msg.jsonString = serialized.containsKey("JSON") ? serialized.get("JSON").toString() : null;
- msg.dirty = !serialized.containsKey("JSON");
- return msg;
- }
-
- /**
- * Internally called method. Not for API consumption.
- */
- @Override
- @NotNull
- public Iterator iterator() {
- return messageParts.iterator();
- }
-
- private static JsonParser _stringParser = new JsonParser();
-
- /**
- * Deserializes a fancy message from its JSON representation. This JSON representation is of the
- * format of that returned by {@link #toJSONString()}, and is compatible with vanilla inputs.
- *
- * @param json The JSON string which represents a fancy message.
- * @return A {@code FancyMessage} representing the parameterized JSON message.
- */
- public static FancyMessage deserialize(String json) {
- JsonObject serialized = _stringParser.parse(json).getAsJsonObject();
- JsonArray extra = serialized.getAsJsonArray("extra"); // Get the extra component
- FancyMessage returnVal = new FancyMessage();
- returnVal.messageParts.clear();
- for (JsonElement mPrt : extra) {
- MessagePart component = new MessagePart();
- JsonObject messagePart = mPrt.getAsJsonObject();
- for (Map.Entry entry : messagePart.entrySet()) {
- // Deserialize text
- if (TextualComponent.isTextKey(entry.getKey())) {
- // The map mimics the YAML serialization, which has a "key" field and one or more "value" fields
- Map serializedMapForm = new HashMap<>(); // Must be object due to Bukkit serializer API compliance
- serializedMapForm.put("key", entry.getKey());
- if (entry.getValue().isJsonPrimitive()) {
- // Assume string
- serializedMapForm.put("value", entry.getValue().getAsString());
- } else {
- // Composite object, but we assume each element is a string
- for (Map.Entry compositeNestedElement : entry
- .getValue().getAsJsonObject().entrySet()) {
- serializedMapForm.put("value." + compositeNestedElement.getKey(),
- compositeNestedElement.getValue().getAsString());
- }
- }
- component.text = TextualComponent.deserialize(serializedMapForm);
- } else if (MessagePart.stylesToNames.inverse().containsKey(entry.getKey())) {
- if (entry.getValue().getAsBoolean()) {
- component.styles
- .add(MessagePart.stylesToNames.inverse().get(entry.getKey()));
- }
- } else if (entry.getKey().equals("color")) {
- component.color = ChatColor.valueOf(entry.getValue().getAsString().toUpperCase());
- } else if (entry.getKey().equals("clickEvent")) {
- JsonObject object = entry.getValue().getAsJsonObject();
- component.clickActionName = object.get("action").getAsString();
- component.clickActionData = object.get("value").getAsString();
- } else if (entry.getKey().equals("hoverEvent")) {
- JsonObject object = entry.getValue().getAsJsonObject();
- component.hoverActionName = object.get("action").getAsString();
- if (object.get("value").isJsonPrimitive()) {
- // Assume string
- component.hoverActionData = new JsonString(
- object.get("value").getAsString());
- } else {
- // Assume composite type
- // The only composite type we currently store is another FancyMessage
- // Therefore, recursion time!
- component.hoverActionData = deserialize(object.get("value")
- .toString() /* This should properly serialize the JSON object as a JSON string */);
- }
- } else if (entry.getKey().equals("insertion")) {
- component.insertionData = entry.getValue().getAsString();
- } else if (entry.getKey().equals("with")) {
- for (JsonElement object : entry.getValue().getAsJsonArray()) {
- if (object.isJsonPrimitive()) {
- component.translationReplacements
- .add(new JsonString(object.getAsString()));
- } else {
- // Only composite type stored in this array is - again - FancyMessages
- // Recurse within this function to parse this as a translation replacement
- component.translationReplacements.add(deserialize(object.toString()));
- }
- }
- }
- }
- returnVal.messageParts.add(component);
- returnVal.index = returnVal.messageParts.size();
- }
- return returnVal;
- }
-
-}
diff --git a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/chat/MessagePart.java b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/chat/MessagePart.java
deleted file mode 100644
index 805ad0b9d..000000000
--- a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/chat/MessagePart.java
+++ /dev/null
@@ -1,156 +0,0 @@
-package com.boydti.fawe.bukkit.chat;
-
-import com.google.common.collect.BiMap;
-import com.google.common.collect.ImmutableBiMap;
-import com.google.gson.stream.JsonWriter;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.logging.Level;
-import org.bukkit.Bukkit;
-import org.bukkit.ChatColor;
-import org.bukkit.configuration.serialization.ConfigurationSerializable;
-import org.bukkit.configuration.serialization.ConfigurationSerialization;
-
-/**
- * Internal class: Represents a component of a JSON-serializable {@link FancyMessage}.
- */
-final class MessagePart implements JsonRepresentedObject, ConfigurationSerializable, Cloneable {
-
- ChatColor color = ChatColor.WHITE;
- ArrayList styles = new ArrayList<>();
- String clickActionName = null;
- String clickActionData = null;
- String hoverActionName = null;
- JsonRepresentedObject hoverActionData = null;
- TextualComponent text = null;
- String insertionData = null;
- ArrayList translationReplacements = new ArrayList<>();
-
- MessagePart(final TextualComponent text) {
- this.text = text;
- }
-
- MessagePart() {
- this.text = null;
- }
-
- boolean hasText() {
- return text != null;
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public MessagePart clone() throws CloneNotSupportedException {
- MessagePart obj = (MessagePart) super.clone();
- obj.styles = (ArrayList) styles.clone();
- if (hoverActionData instanceof JsonString) {
- obj.hoverActionData = new JsonString(((JsonString) hoverActionData).getValue());
- } else if (hoverActionData instanceof FancyMessage) {
- obj.hoverActionData = ((FancyMessage) hoverActionData).clone();
- }
- obj.translationReplacements = (ArrayList) translationReplacements.clone();
- return obj;
-
- }
-
- static final BiMap stylesToNames;
-
- static {
- ImmutableBiMap.Builder builder = ImmutableBiMap.builder();
- for (final ChatColor style : ChatColor.values()) {
- if (!style.isFormat()) {
- continue;
- }
-
- String styleName;
- switch (style) {
- case MAGIC:
- styleName = "obfuscated";
- break;
- case UNDERLINE:
- styleName = "underlined";
- break;
- default:
- styleName = style.name().toLowerCase();
- break;
- }
-
- builder.put(style, styleName);
- }
- stylesToNames = builder.build();
- }
-
- public void writeJson(JsonWriter json) {
- try {
- json.beginObject();
- text.writeJson(json);
- json.name("color").value(color.name().toLowerCase());
- for (final ChatColor style : styles) {
- json.name(stylesToNames.get(style)).value(true);
- }
- if (clickActionName != null && clickActionData != null) {
- json.name("clickEvent")
- .beginObject()
- .name("action").value(clickActionName)
- .name("value").value(clickActionData)
- .endObject();
- }
- if (hoverActionName != null && hoverActionData != null) {
- json.name("hoverEvent")
- .beginObject()
- .name("action").value(hoverActionName)
- .name("value");
- hoverActionData.writeJson(json);
- json.endObject();
- }
- if (insertionData != null) {
- json.name("insertion").value(insertionData);
- }
- if (translationReplacements.size() > 0 && text != null && TextualComponent.isTranslatableText(text)) {
- json.name("with").beginArray();
- for (JsonRepresentedObject obj : translationReplacements) {
- obj.writeJson(json);
- }
- json.endArray();
- }
- json.endObject();
- } catch (IOException e) {
- Bukkit.getLogger().log(Level.WARNING, "A problem occured during writing of JSON string", e);
- }
- }
-
- public Map serialize() {
- HashMap map = new HashMap<>();
- map.put("text", text);
- map.put("styles", styles);
- map.put("color", color.getChar());
- map.put("hoverActionName", hoverActionName);
- map.put("hoverActionData", hoverActionData);
- map.put("clickActionName", clickActionName);
- map.put("clickActionData", clickActionData);
- map.put("insertion", insertionData);
- map.put("translationReplacements", translationReplacements);
- return map;
- }
-
- @SuppressWarnings("unchecked")
- public static MessagePart deserialize(Map serialized) {
- MessagePart part = new MessagePart((TextualComponent) serialized.get("text"));
- part.styles = (ArrayList) serialized.get("styles");
- part.color = ChatColor.getByChar(serialized.get("color").toString());
- part.hoverActionName = (String) serialized.get("hoverActionName");
- part.hoverActionData = (JsonRepresentedObject) serialized.get("hoverActionData");
- part.clickActionName = (String) serialized.get("clickActionName");
- part.clickActionData = (String) serialized.get("clickActionData");
- part.insertionData = (String) serialized.get("insertion");
- part.translationReplacements = (ArrayList) serialized.get("translationReplacements");
- return part;
- }
-
- static {
- ConfigurationSerialization.registerClass(MessagePart.class);
- }
-
-}
diff --git a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/listener/CFIPacketListener.java b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/listener/CFIPacketListener.java
index 30005a683..e1a1b36b9 100644
--- a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/listener/CFIPacketListener.java
+++ b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/listener/CFIPacketListener.java
@@ -26,7 +26,9 @@ import com.sk89q.worldedit.event.platform.Interaction;
import com.sk89q.worldedit.extension.platform.PlatformManager;
import com.sk89q.worldedit.math.BlockVector3;
+import com.sk89q.worldedit.util.formatting.text.TextComponent.Builder;
import java.lang.reflect.InvocationTargetException;
+import java.net.URI;
import java.util.List;
import com.sk89q.worldedit.world.block.BlockStateHolder;
@@ -59,7 +61,7 @@ public class CFIPacketListener implements Listener {
// Direct digging to the virtual world
registerBlockEvent(PacketType.Play.Client.BLOCK_DIG, false, new RunnableVal3() {
@Override
- public void run(PacketEvent event, VirtualWorld gen, BlockVector3 pt) {
+ public void run(Builder event, URI gen, String pt) {
try {
Player plr = event.getPlayer();
BlockVector3 realPos = pt.add(gen.getOrigin().toBlockPoint());
@@ -75,7 +77,7 @@ public class CFIPacketListener implements Listener {
// Direct placing to the virtual world
RunnableVal3 placeTask = new RunnableVal3() {
@Override
- public void run(PacketEvent event, VirtualWorld gen, BlockVector3 pt) {
+ public void run(Builder event, URI gen, String pt) {
try {
Player plr = event.getPlayer();
List hands = event.getPacket().getHands().getValues();
@@ -112,7 +114,7 @@ public class CFIPacketListener implements Listener {
// Cancel block change packets where the real world overlaps with the virtual one
registerBlockEvent(PacketType.Play.Server.BLOCK_CHANGE, false, new RunnableVal3() {
@Override
- public void run(PacketEvent event, VirtualWorld gen, BlockVector3 pt) {
+ public void run(Builder event, URI gen, String pt) {
// Do nothing
}
});
diff --git a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/regions/FactionsOneFeature.java b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/regions/FactionsOneFeature.java
index eafcb7634..e1ec86f25 100644
--- a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/regions/FactionsOneFeature.java
+++ b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/regions/FactionsOneFeature.java
@@ -3,7 +3,7 @@ package com.boydti.fawe.bukkit.regions;
import com.boydti.fawe.object.FawePlayer;
import com.boydti.fawe.object.RegionWrapper;
import com.boydti.fawe.regions.FaweMask;
-import com.boydti.fawe.util.Perm;
+import com.boydti.fawe.util.Permission;
import com.massivecraft.factions.FLocation;
import com.sk89q.worldedit.bukkit.BukkitAdapter;
import org.bukkit.Chunk;
@@ -30,7 +30,8 @@ public class FactionsOneFeature extends BukkitMaskManager implements Listener {
public FaweMask getMask(final FawePlayer fp, MaskType type) {
final Player player = fp.parent;
final Chunk chunk = player.getLocation().getChunk();
- final boolean perm = Perm.hasPermission(FawePlayer.wrap(player), "fawe.factions.wilderness");
+ final boolean perm = Permission
+ .hasPermission(fp.toWorldEditPlayer(), "fawe.factions.wilderness");
final World world = player.getWorld();
RegionWrapper locs = new RegionWrapper(chunk.getX(), chunk.getX(), chunk.getZ(), chunk.getZ());
@@ -40,7 +41,7 @@ public class FactionsOneFeature extends BukkitMaskManager implements Listener {
if (this.isAdded(locs, world, player, perm, type)) {
boolean hasPerm = true;
- while (hasPerm && (count > 0)) {
+ while (hasPerm && count > 0) {
count--;
hasPerm = false;
diff --git a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/regions/FactionsUUIDFeature.java b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/regions/FactionsUUIDFeature.java
index 12f10ae66..c6f9e3bb2 100644
--- a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/regions/FactionsUUIDFeature.java
+++ b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/regions/FactionsUUIDFeature.java
@@ -4,7 +4,7 @@ import com.boydti.fawe.bukkit.FaweBukkit;
import com.boydti.fawe.object.FawePlayer;
import com.boydti.fawe.object.RegionWrapper;
import com.boydti.fawe.regions.FaweMask;
-import com.boydti.fawe.util.Perm;
+import com.boydti.fawe.util.Permission;
import com.massivecraft.factions.Board;
import com.massivecraft.factions.FLocation;
import com.massivecraft.factions.Faction;
@@ -28,7 +28,8 @@ public class FactionsUUIDFeature extends BukkitMaskManager implements Listener {
public FaweMask getMask(final FawePlayer fp, MaskType type) {
final Player player = fp.parent;
final Chunk chunk = player.getLocation().getChunk();
- final boolean perm = Perm.hasPermission(FawePlayer.wrap(player), "fawe.factions.wilderness");
+ final boolean perm = Permission
+ .hasPermission(fp.toWorldEditPlayer(), "fawe.factions.wilderness");
final World world = player.getWorld();
RegionWrapper locs = new RegionWrapper(chunk.getX(), chunk.getX(), chunk.getZ(), chunk.getZ());
@@ -38,7 +39,7 @@ public class FactionsUUIDFeature extends BukkitMaskManager implements Listener {
if (this.isAdded(locs, world, player, perm, type)) {
boolean hasPerm = true;
- while (hasPerm && (count > 0)) {
+ while (hasPerm && count > 0) {
count--;
hasPerm = false;
diff --git a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/wrapper/state/AsyncSign.java b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/wrapper/state/AsyncSign.java
index 09ac437a4..74b4927e4 100644
--- a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/wrapper/state/AsyncSign.java
+++ b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/wrapper/state/AsyncSign.java
@@ -1,15 +1,15 @@
package com.boydti.fawe.bukkit.wrapper.state;
-import com.boydti.fawe.bukkit.chat.FancyMessage;
import com.boydti.fawe.bukkit.wrapper.AsyncBlock;
import com.boydti.fawe.bukkit.wrapper.AsyncBlockState;
import com.boydti.fawe.util.ReflectionUtils;
import com.sk89q.jnbt.CompoundTag;
import com.sk89q.jnbt.StringTag;
import com.sk89q.jnbt.Tag;
+import com.sk89q.worldedit.util.formatting.text.TextComponent;
+import com.sk89q.worldedit.util.formatting.text.serializer.gson.GsonComponentSerializer;
+import com.sk89q.worldedit.util.formatting.text.serializer.legacy.LegacyComponentSerializer;
import java.util.Map;
-
-import net.minecraft.server.v1_14_R1.TileEntitySign;
import org.bukkit.DyeColor;
import org.bukkit.block.Sign;
import org.bukkit.persistence.PersistentDataContainer;
@@ -37,18 +37,18 @@ public class AsyncSign extends AsyncBlockState implements Sign {
private String fromJson(String jsonInput) {
if (jsonInput == null || jsonInput.isEmpty()) return "";
- return FancyMessage.deserialize(jsonInput).toOldMessageFormat();
+ return GsonComponentSerializer.INSTANCE.deserialize(jsonInput).toString();
}
private String toJson(String oldInput) {
if (oldInput == null || oldInput.isEmpty()) return "";
- return new FancyMessage("").color(oldInput).toJSONString();
+ return LegacyComponentSerializer.INSTANCE.serialize(TextComponent.of(oldInput));
}
@Override
public String getLine(int index) throws IndexOutOfBoundsException {
CompoundTag nbt = getNbtData();
- return nbt == null ? null : fromJson(nbt.getString("Text" + (index + 1)));
+ return nbt == null ? "" : fromJson(nbt.getString("Text" + (index + 1)));
}
@Override
@@ -80,7 +80,7 @@ public class AsyncSign extends AsyncBlockState implements Sign {
CompoundTag nbt = getNbtData();
if (nbt != null) {
String color = nbt.getString("Color").toUpperCase();
- if (color != null) return DyeColor.valueOf(color);
+ return DyeColor.valueOf(color);
}
return DyeColor.BLACK;
}
diff --git a/worldedit-core/src/main/java/com/boydti/fawe/Fawe.java b/worldedit-core/src/main/java/com/boydti/fawe/Fawe.java
index 5f6378ca3..0832a9fdc 100644
--- a/worldedit-core/src/main/java/com/boydti/fawe/Fawe.java
+++ b/worldedit-core/src/main/java/com/boydti/fawe/Fawe.java
@@ -7,27 +7,39 @@ import com.boydti.fawe.config.Settings;
import com.boydti.fawe.object.FawePlayer;
import com.boydti.fawe.object.brush.visualization.VisualQueue;
import com.boydti.fawe.regions.general.plot.PlotSquaredFeature;
-import com.boydti.fawe.util.*;
-import com.boydti.fawe.util.chat.ChatManager;
-import com.boydti.fawe.util.chat.PlainChatManager;
+import com.boydti.fawe.util.CachedTextureUtil;
+import com.boydti.fawe.util.CleanTextureUtil;
+import com.boydti.fawe.util.FaweTimer;
+import com.boydti.fawe.util.MainUtil;
+import com.boydti.fawe.util.MemUtil;
+import com.boydti.fawe.util.RandomTextureUtil;
+import com.boydti.fawe.util.TaskManager;
+import com.boydti.fawe.util.TextureUtil;
+import com.boydti.fawe.util.WEManager;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.extension.factory.DefaultTransformParser;
import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.session.request.Request;
-
-import javax.annotation.Nullable;
-import javax.management.InstanceAlreadyExistsException;
-import javax.management.NotificationEmitter;
-import java.io.*;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
import java.lang.management.ManagementFactory;
import java.lang.management.MemoryMXBean;
import java.lang.management.MemoryPoolMXBean;
import java.lang.management.MemoryUsage;
-import java.util.*;
+import java.util.Collection;
+import java.util.Date;
+import java.util.List;
+import java.util.Objects;
+import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit;
-
-import static com.google.common.base.Preconditions.checkNotNull;
+import javax.annotation.Nullable;
+import javax.management.InstanceAlreadyExistsException;
+import javax.management.NotificationEmitter;
/**
* [ WorldEdit action]
@@ -80,7 +92,6 @@ public class Fawe {
private VisualQueue visualQueue;
private TextureUtil textures;
private DefaultTransformParser transformParser;
- private ChatManager chatManager = new PlainChatManager();
private QueueHandler queueHandler;
@@ -202,15 +213,6 @@ public class Fawe {
return queueHandler;
}
- public ChatManager getChatManager() {
- return chatManager;
- }
-
- public void setChatManager(ChatManager chatManager) {
- checkNotNull(chatManager);
- this.chatManager = chatManager;
- }
-
public DefaultTransformParser getTransformParser() {
return transformParser;
}
diff --git a/worldedit-core/src/main/java/com/boydti/fawe/beta/IChunkSet.java b/worldedit-core/src/main/java/com/boydti/fawe/beta/IChunkSet.java
index 35efd352a..9e34c4d4d 100644
--- a/worldedit-core/src/main/java/com/boydti/fawe/beta/IChunkSet.java
+++ b/worldedit-core/src/main/java/com/boydti/fawe/beta/IChunkSet.java
@@ -16,8 +16,10 @@ import java.util.UUID;
* Interface for setting blocks
*/
public interface IChunkSet extends IBlocks, OutputExtent {
+ @Override
boolean setBiome(int x, int y, int z, BiomeType biome);
+ @Override
boolean setBlock(int x, int y, int z, BlockStateHolder holder);
boolean isEmpty();
diff --git a/worldedit-core/src/main/java/com/boydti/fawe/beta/IQueueExtent.java b/worldedit-core/src/main/java/com/boydti/fawe/beta/IQueueExtent.java
index a94003ca8..66d7dcfda 100644
--- a/worldedit-core/src/main/java/com/boydti/fawe/beta/IQueueExtent.java
+++ b/worldedit-core/src/main/java/com/boydti/fawe/beta/IQueueExtent.java
@@ -59,11 +59,13 @@ public interface IQueueExtent extends Flushable, Trimable, Extent {
*/
> T submit(IChunk chunk);
+ @Override
default boolean setBlock(final int x, final int y, final int z, final BlockStateHolder state) {
final IChunk chunk = getCachedChunk(x >> 4, z >> 4);
return chunk.setBlock(x & 15, y, z & 15, state);
}
+ @Override
default boolean setBiome(final int x, final int y, final int z, final BiomeType biome) {
final IChunk chunk = getCachedChunk(x >> 4, z >> 4);
return chunk.setBiome(x & 15, y, z & 15, biome);
@@ -127,4 +129,4 @@ public interface IQueueExtent extends Flushable, Trimable, Extent {
boolean isEmpty();
void sendChunk(int chunkX, int chunkZ, int bitMask);
-}
\ 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 60787f493..29125b3c4 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
@@ -47,6 +47,7 @@ import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.util.formatting.text.TextComponent;
import com.sk89q.worldedit.util.formatting.text.TextComponent.Builder;
import com.sk89q.worldedit.util.formatting.text.event.ClickEvent;
+import com.sk89q.worldedit.util.formatting.text.event.HoverEvent;
import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.block.BlockStateHolder;
@@ -354,7 +355,7 @@ public class CFICommands {
floor(fp, BlockTypes.SNOW.getDefaultState().with(PropertyKey.LAYERS, 7), image, mask, disableWhiteOnly);
main(fp, BlockTypes.SNOW_BLOCK, image, mask, disableWhiteOnly);
smooth(fp, 1, 8, image, mask, disableWhiteOnly);
- TextComponent.of("Added snow!").send(fp);
+ fp.toWorldEditPlayer().print(TextComponent.of("Added snow!"));
assertSettings(fp).resetComponent();
component(fp);
}
@@ -383,17 +384,28 @@ public class CFICommands {
@CommandPermissions("worldedit.anvil.cfi")
public void paletteblocks(FawePlayer fp, Player player, LocalSession session, @Arg(name = "arg", desc = "String", def = "") String arg) throws EmptyClipboardException, InputParseException, FileNotFoundException {
if (arg == null) {
- TextComponent.of("What blocks do you want to color with?").append(newline())
- .text("[All]").cmdTip(alias() + " PaletteBlocks *").text(" - All available blocks")
- .append(newline())
- .text("[Clipboard]").cmdTip(alias() + " PaletteBlocks #clipboard").text(" - The blocks in your clipboard")
- .append(newline())
- .text("[List]").suggestTip(alias() + " PaletteBlocks stone,gravel").text(" - A comma separated list of blocks")
- .append(newline())
- .text("[Complexity]").cmdTip(alias() + " Complexity").text(" - Block textures within a complexity range")
- .append(newline())
- .text("< [Back]").cmdTip(alias() + " " + Commands.getAlias(CFICommands.class, "coloring"))
- .send(fp);
+ TextComponent build = TextComponent.builder("What blocks do you want to color with?")
+ .append(newline())
+ .append(TextComponent.of("[All]")
+ .clickEvent(ClickEvent.runCommand("/cfi PaletteBlocks *")))
+ .append(" - All available blocks")
+ .append(newline())
+ .append(TextComponent.of("[Clipboard]")
+ .clickEvent(ClickEvent.runCommand("/cfi PaletteBlocks #clipboard")))
+ .append(" - The blocks in your clipboard")
+ .append(newline())
+ .append(TextComponent.of("[List]")
+ .clickEvent(ClickEvent.runCommand("/cfi PaletteBlocks stone,gravel")))
+ .append(" - A comma separated list of blocks")
+ .append(newline())
+ .append(TextComponent.of("[Complexity]")
+ .clickEvent(ClickEvent.runCommand("/cfi Complexity")))
+ .append(" - Block textures within a complexity range")
+ .append(newline())
+ .append(TextComponent.of("< [Back]").clickEvent(ClickEvent
+ .runCommand("/cfi " + Commands.getAlias(CFICommands.class, "coloring"))))
+ .build();
+ fp.toWorldEditPlayer().print(build);
return;
}
HeightMapMCAGenerator generator = assertSettings(fp).getGenerator();
@@ -505,7 +517,7 @@ public class CFICommands {
} else {
gen.addSchems(load(imageMask), mask, multi.getHolders(), rarity, distance, rotate);
}
- TextComponent.of("Added schematics!").send(fp);
+ fp.toWorldEditPlayer().print(TextComponent.of("Added schematics!"));
populate(fp);
}
@@ -527,7 +539,7 @@ public class CFICommands {
} else {
gen.setBiome(biome);
}
- TextComponent.of("Set biome!").send(fp);
+ fp.toWorldEditPlayer().print(TextComponent.of("Set biome!"));
assertSettings(fp).resetComponent();
component(fp);
}
@@ -539,7 +551,7 @@ public class CFICommands {
@CommandPermissions("worldedit.anvil.cfi")
public void caves(FawePlayer fp) throws WorldEditException {
assertSettings(fp).getGenerator().addCaves();
- TextComponent.of("Added caves!").send(fp);
+ fp.toWorldEditPlayer().print(TextComponent.of("Added caves!"));
populate(fp);
}
@@ -580,7 +592,6 @@ public class CFICommands {
gen.setHeights(Integer.parseInt(arg));
}
fp.toWorldEditPlayer().print("Set Height!");
- TextComponent.of("Set height!").send(fp);
component(fp);
}
@@ -592,7 +603,8 @@ public class CFICommands {
public void waterId(FawePlayer fp, BlockStateHolder block) throws WorldEditException {
CFISettings settings = assertSettings(fp);
settings.getGenerator().setWaterId(block.getBlockType().getInternalId());
- TextComponent.of("Set water id!").send(fp);
+
+ fp.toWorldEditPlayer().print("Set water id!");
settings.resetComponent();
component(fp);
}
@@ -606,7 +618,7 @@ public class CFICommands {
public void baseId(FawePlayer fp, BlockStateHolder block) throws WorldEditException {
CFISettings settings = assertSettings(fp);
settings.getGenerator().setBedrockId(block.getBlockType().getInternalId());
- TextComponent.of("Set base id!").send(fp);
+ fp.toWorldEditPlayer().print(TextComponent.of("Set base id!"));
settings.resetComponent();
component(fp);
}
@@ -620,7 +632,7 @@ public class CFICommands {
@CommandPermissions("worldedit.anvil.cfi")
public void worldthickness(FawePlayer fp, int height) throws WorldEditException {
assertSettings(fp).getGenerator().setWorldThickness(height);
- TextComponent.of("Set world thickness!").send(fp);
+ fp.toWorldEditPlayer().print(TextComponent.of("Set world thickness!"));
component(fp);
}
@@ -633,7 +645,7 @@ public class CFICommands {
@CommandPermissions("worldedit.anvil.cfi")
public void floorthickness(FawePlayer fp, int height) throws WorldEditException {
assertSettings(fp).getGenerator().setFloorThickness(height);
- TextComponent.of("Set floor thickness!").send(fp);
+ fp.toWorldEditPlayer().print(TextComponent.of("Set floor thickness!"));
component(fp);
}
@@ -645,7 +657,7 @@ public class CFICommands {
@CommandPermissions("worldedit.anvil.cfi")
public void update(FawePlayer fp) throws WorldEditException {
assertSettings(fp).getGenerator().update();
- TextComponent.of("Chunks refreshed!").send(fp);
+ fp.toWorldEditPlayer().print(TextComponent.of("Chunks refreshed!"));
mainMenu(fp);
}
@@ -657,7 +669,7 @@ public class CFICommands {
@CommandPermissions("worldedit.anvil.cfi")
public void tp(FawePlayer fp) throws WorldEditException {
HeightMapMCAGenerator gen = assertSettings(fp).getGenerator();
- TextComponent.of("Teleporting...").send(fp);
+ fp.toWorldEditPlayer().print(TextComponent.of("Teleporting..."));
Vector3 origin = gen.getOrigin();
Player player = fp.getPlayer();
player.setPosition(origin.subtract(16, 0, 16));
@@ -675,7 +687,7 @@ public class CFICommands {
@CommandPermissions("worldedit.anvil.cfi")
public void waterheight(FawePlayer fp, int height) throws WorldEditException {
assertSettings(fp).getGenerator().setWaterHeight(height);
- TextComponent.of("Set water height!").send(fp);
+ fp.toWorldEditPlayer().print(TextComponent.of("Set water height!"));
component(fp);
}
@@ -689,7 +701,7 @@ public class CFICommands {
public void glass(FawePlayer fp, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri image, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri imageMask, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch(name = 'w', desc = "TODO") boolean disableWhiteOnly) throws WorldEditException {
CFISettings settings = assertSettings(fp);
settings.getGenerator().setColorWithGlass(load(image));
- TextComponent.of("Set color with glass!").send(fp);
+ fp.toWorldEditPlayer().print(TextComponent.of("Set color with glass!"));
settings.resetColoring();
mainMenu(fp);
}
@@ -714,7 +726,7 @@ public class CFICommands {
gen.setColor(load(image));
}
settings.resetColoring();
- TextComponent.of("Set color with blocks!").send(fp);
+ fp.toWorldEditPlayer().print(TextComponent.of("Set color with blocks!"));
mainMenu(fp);
}
@@ -730,7 +742,7 @@ public class CFICommands {
public void blockbiome(FawePlayer fp, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri image, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri imageMask, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch(name = 'w', desc = "TODO") boolean disableWhiteOnly) throws WorldEditException {
CFISettings settings = assertSettings(fp);
settings.getGenerator().setBlockAndBiomeColor(load(image), mask, load(imageMask), !disableWhiteOnly);
- TextComponent.of("Set color with blocks and biomes!").send(fp);
+ fp.toWorldEditPlayer().print(TextComponent.of("Set color with blocks and biomes!"));
settings.resetColoring();
mainMenu(fp);
}
@@ -746,7 +758,7 @@ public class CFICommands {
public void biomecolor(FawePlayer fp, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri image, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri imageMask, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch(name = 'w', desc = "TODO") boolean disableWhiteOnly) throws WorldEditException {
CFISettings settings = assertSettings(fp);
settings.getGenerator().setBiomeColor(load(image));
- TextComponent.of("Set color with biomes!").send(fp);
+ fp.toWorldEditPlayer().print(TextComponent.of("Set color with biomes!"));
settings.resetColoring();
mainMenu(fp);
}
@@ -811,13 +823,12 @@ public class CFICommands {
.append(newline());
if (settings.image != null) {
- StringBuilder colorArgs = new StringBuilder();
- colorArgs.append(" " + settings.imageArg);
+ StringBuilder colorArgs = new StringBuilder(" " + settings.imageArg);
if (settings.imageMask != null) {
- colorArgs.append(" " + settings.imageMaskArg);
+ colorArgs.append(" ").append(settings.imageMaskArg);
}
if (settings.mask != null) {
- colorArgs.append(" " + settings.maskArg);
+ colorArgs.append(" ").append(settings.maskArg);
}
if (!settings.whiteOnly) {
colorArgs.append(" -w");
@@ -854,14 +865,26 @@ public class CFICommands {
settings.maskArg = mask != null ? split[index++] : null;
settings.whiteOnly = !disableWhiteOnly;
- StringBuilder cmd = new StringBuilder(alias() + " mask ");
+ StringBuilder cmd = new StringBuilder("/cfi mask ");
- TextComponent.of(">> Current Settings <<").append(newline())
- .text("Image Mask ").text("[" + settings.imageMaskArg + "]").suggestTip(cmd + "http://")
+ String s = "/cfi mask http://";
+ String s1 = "/cfi mask ";
+ String s2 = alias() + " " + settings.getCategory();
+ TextComponent build = TextComponent.builder(">> Current Settings <<")
.append(newline())
- .text("WorldEdit Mask ").text("[" + settings.maskArg + "]").suggestTip(cmd + "")
+ .append("Image Mask ").append(
+ TextComponent.of("[" + settings.imageMaskArg + "]")
+ .hoverEvent(HoverEvent.showText(TextComponent.of(s)))
+ .clickEvent(ClickEvent.suggestCommand("/cfi mask http://")))
.append(newline())
- .text("< [Back]").cmdTip(alias() + " " + settings.getCategory()).send(fp);
+ .append("WorldEdit Mask ").append(TextComponent.of("[" + settings.maskArg + "]")
+ .hoverEvent(HoverEvent.showText(TextComponent.of(s1)))
+ .clickEvent(ClickEvent.suggestCommand(s1)))
+ .append(newline())
+ .append(
+ TextComponent.of("< [Back]").hoverEvent(HoverEvent.showText(TextComponent.of(s2)))
+ .clickEvent(ClickEvent.runCommand(s2))).build();
+ fp.toWorldEditPlayer().print(build);
}
@Command(
@@ -881,10 +904,17 @@ public class CFICommands {
if (pattern != null) {
settings.getCategory().accept(fp);
} else {
- TextComponent.of(">> Current Settings <<").append(newline())
- .text("Pattern ").text("[Click Here]").suggestTip(cmd + " stone")
- .append(newline())
- .text("< [Back]").cmdTip(alias() + " " + settings.getCategory()).send(fp);
+ String s = cmd + " stone";
+ String s1 = alias() + " " + settings.getCategory();
+ TextComponent build = TextComponent.builder(">> Current Settings <<").append(newline())
+ .append("Pattern ").append(TextComponent.of("[Click Here]")
+ .hoverEvent(HoverEvent.showText(TextComponent.of(s)))
+ .clickEvent(ClickEvent.suggestCommand(s)))
+ .append(newline())
+ .append(TextComponent.of("< [Back]")
+ .hoverEvent(HoverEvent.showText(TextComponent.of(s1)))
+ .clickEvent(ClickEvent.runCommand(s1))).build();
+ fp.toWorldEditPlayer().print(build);
}
}
@@ -917,13 +947,12 @@ public class CFICommands {
settings.image = image;
settings.imageArg = image != null ? split[index++] : null;
- StringBuilder cmd = new StringBuilder(alias() + " image ");
if (image == null) {
TextComponent build = TextComponent.builder("Please provide an image:")
.append(newline())
- .append("From a URL: ").append("[Click Here]")//TODO .suggestTip(cmd + "http://")
+ .append("From a URL: ").append(TextComponent.of("[Click Here]").clickEvent(ClickEvent.suggestCommand("/cfi image http://")))
.append(newline())
- .append("From a file: ").append("[Click Here]")//TODO .suggestTip(cmd + "file://")
+ .append("From a file: ").append(TextComponent.of("[Click Here]").clickEvent(ClickEvent.suggestCommand("/cfi image file://")))
.build();
fp.toWorldEditPlayer().print(build);
} else {
@@ -994,50 +1023,76 @@ public class CFICommands {
String snow = Commands.getAlias(CFICommands.class, "snow");
//TODO
-// Message msg = TextComponent.builder(">> Current Settings <<").append(newline())
-// .append("Mask ").append("[" + mask + "]").cmdTip(alias() + " mask")
-// .append(newline())
-// .append("Pattern ").append("[" + pattern + "]").cmdTip(alias() + " pattern")
-// .append(newline())
-// .append(newline())
-// .append(">> Components <<")
-// .append(newline())
-// .append("[Height]").suggestTip(alias() + " " + alias("height") + " 120").text(" - Terrain height for whole map")
-// .append(newline())
-// .text("[WaterHeight]").suggestTip(alias() + " " + alias("waterheight") + " 60").text(" - Sea level for whole map")
-// .append(newline())
-// .text("[FloorThickness]").suggestTip(alias() + " " + alias("floorthickness") + " 60").text(" - Floor thickness of entire map")
-// .append(newline())
-// .text("[WorldThickness]").suggestTip(alias() + " " + alias("worldthickness") + " 60").text(" - World thickness of entire map")
-// .append(newline())
-// .text("[Snow]").suggestTip(alias() + " " + alias("snow") + maskArgs).text(" - Set snow in the masked areas")
-// .append(newline());
-//
-// if (pattern != null) {
-// String disabled = "You must specify a pattern";
-// msg
-// .text("[&cWaterId]").tooltip(disabled).append(newline())
-// .text("[&cBedrockId]").tooltip(disabled).append(newline())
-// .text("[&cFloor]").tooltip(disabled).append(newline())
-// .text("[&cMain]").tooltip(disabled).append(newline())
-// .text("[&cColumn]").tooltip(disabled).append(newline())
-// .text("[&cOverlay]").tooltip(disabled).append(newline());
-// } else {
-// StringBuilder compArgs = new StringBuilder();
-// compArgs.append(" " + settings.patternArg + maskArgs);
-//
-// msg
-// .text("[WaterId]").cmdTip(alias() + " waterId " + pattern).text(" - Water id for whole map").append(newline())
-// .text("[BedrockId]").cmdTip(alias() + " baseId " + pattern).text(" - Bedrock id for whole map").append(newline())
-// .text("[Floor]").cmdTip(alias() + " floor" + compArgs).text(" - Set the floor in the masked areas").append(newline())
-// .text("[Main]").cmdTip(alias() + " main" + compArgs).text(" - Set the main block in the masked areas").append(newline())
-// .text("[Column]").cmdTip(alias() + " column" + compArgs).text(" - Set the columns in the masked areas").append(newline())
-// .text("[Overlay]").cmdTip(alias() + " overlay" + compArgs).text(" - Set the overlay in the masked areas").append(newline());
-// }
-//
-// msg.append(newline())
-// .text("< [Back]").cmdTip(alias())
-// .send(fp);
+ @NonNull Builder msg = TextComponent.builder(">> Current Settings <<").append(newline())
+ .append("Mask ").append(TextComponent.of("[" + mask + "]")
+ .hoverEvent(HoverEvent.showText(TextComponent.of(alias() + " mask")))
+ .clickEvent(ClickEvent.runCommand(alias() + " mask")))
+ .append(newline())
+ .append("Pattern ").append(TextComponent.of("[" + pattern + "]")
+ .hoverEvent(HoverEvent.showText(TextComponent.of(alias() + " pattern")))
+ .clickEvent(ClickEvent.runCommand(alias() + " pattern")))
+ .append(newline())
+ .append(newline())
+ .append(">> Components <<")
+ .append(newline())
+ .append(TextComponent.of("[Height]")
+ .hoverEvent(HoverEvent.showText(TextComponent.of(alias() + " " + alias("height") + " 120")))
+ .clickEvent(ClickEvent.suggestCommand(alias() + " " + alias("height") + " 120"))).append(" - Terrain height for whole map")
+ .append(newline())
+ .append(TextComponent.of("[WaterHeight]")
+ .hoverEvent(HoverEvent.showText(TextComponent.of(alias() + " " + alias("waterheight") + " 60")))
+ .clickEvent(ClickEvent.suggestCommand(alias() + " " + alias("waterheight") + " 60"))).append(" - Sea level for whole map")
+ .append(newline())
+ .append(TextComponent.of("[FloorThickness]").hoverEvent(HoverEvent.showText(TextComponent.of(alias() + " " + alias("floorthickness") + " 60")))
+ .clickEvent(ClickEvent.suggestCommand(alias() + " " + alias("floorthickness") + " 60"))).append(" - Floor thickness of entire map")
+ .append(newline())
+ .append(TextComponent.of("[WorldThickness]").hoverEvent(HoverEvent.showText(TextComponent.of(alias() + " " + alias("worldthickness") + " 60")))
+ .clickEvent(ClickEvent.suggestCommand(alias() + " " + alias("worldthickness") + " 60"))).append(" - World thickness of entire map")
+ .append(newline())
+ .append(TextComponent.of("[Snow]").hoverEvent(HoverEvent.showText(TextComponent.of(alias() + " " + alias("snow") + maskArgs)))
+ .clickEvent(ClickEvent.suggestCommand(alias() + " " + alias("snow") + maskArgs))).append(" - Set snow in the masked areas")
+ .append(newline());
+
+ if (pattern != null) {
+ String disabled = "You must specify a pattern";
+ msg.append(TextComponent.of("[&cWaterId]").hoverEvent(HoverEvent.showText(TextComponent.of(disabled)))).append(newline())
+ .append(TextComponent.of("[&cBedrockId]").hoverEvent(HoverEvent.showText(TextComponent.of(disabled)))).append(newline()).append(newline())
+ .append(TextComponent.of("[&cFloor]").hoverEvent(HoverEvent.showText(TextComponent.of(disabled)))).append(newline()).append(newline())
+ .append(TextComponent.of("[&cMain]").hoverEvent(HoverEvent.showText(TextComponent.of(disabled)))).append(newline()).append(newline())
+ .append(TextComponent.of("[&cColumn]").hoverEvent(HoverEvent.showText(TextComponent.of(disabled)))).append(newline()).append(newline())
+ .append(TextComponent.of("[&cOverlay]").hoverEvent(HoverEvent.showText(TextComponent.of(disabled)))).append(newline()).append(newline());
+ } else {
+ StringBuilder compArgs = new StringBuilder();
+ compArgs.append(" " + settings.patternArg + maskArgs);
+
+ msg
+ .append(TextComponent.of("[WaterId]")
+ .hoverEvent(HoverEvent.showText(TextComponent.of(alias() + " waterId " + pattern)))
+ .clickEvent(ClickEvent.runCommand(alias() + " waterId " + pattern)))
+ .append(" - Water id for whole map")
+ .append(newline())
+ .append(TextComponent.of("[BedrockId]")
+ .hoverEvent(HoverEvent.showText(TextComponent.of(alias() + " baseId " + pattern)))
+ .clickEvent(ClickEvent.runCommand(alias() + " baseId " + pattern)))
+ .append(TextComponent.of(" - Bedrock id for whole map"))
+ .append(newline())
+ .append(TextComponent.of("[Floor]")
+ .hoverEvent(HoverEvent.showText(TextComponent.of(alias() + " floor " + compArgs)))
+ .clickEvent(ClickEvent.runCommand(alias() + " floor " + compArgs)))
+ .append(TextComponent.of(" - Set the floor in the masked areas")).append(newline())
+ .append(TextComponent.of("[Main]")
+ .hoverEvent(HoverEvent.showText(TextComponent.of(alias() + " main " + compArgs)))
+ .clickEvent(ClickEvent.runCommand(alias() + " main " + compArgs)))
+ .append(TextComponent.of(" - Set the main block in the masked areas")).append(newline())
+ .append(TextComponent.of("[Column]").hoverEvent(HoverEvent.showText(TextComponent.of(alias() + " column" + compArgs)))
+ .clickEvent(ClickEvent.runCommand(alias() + " column" + compArgs))).append(" - Set the columns in the masked areas").append(newline())
+ .append(TextComponent.of("[Overlay]").hoverEvent(HoverEvent.showText(TextComponent.of(alias() + " overlay" + compArgs)))
+ .clickEvent(ClickEvent.runCommand(alias() + " overlay" + compArgs))).append(" - Set the overlay in the masked areas").append(newline());
+ }
+
+ msg.append(newline())
+ .append(TextComponent.of("< [Back]").hoverEvent(HoverEvent.showText(TextComponent.of(alias()))).clickEvent(ClickEvent.runCommand(alias())));
+ fp.toWorldEditPlayer().print(msg.build());
}
private static CFISettings assertSettings(FawePlayer fp) {
diff --git a/worldedit-core/src/main/java/com/boydti/fawe/database/RollbackDatabase.java b/worldedit-core/src/main/java/com/boydti/fawe/database/RollbackDatabase.java
index 6e5b83bc1..970c31c20 100644
--- a/worldedit-core/src/main/java/com/boydti/fawe/database/RollbackDatabase.java
+++ b/worldedit-core/src/main/java/com/boydti/fawe/database/RollbackDatabase.java
@@ -10,7 +10,6 @@ import com.boydti.fawe.object.task.AsyncNotifyQueue;
import com.boydti.fawe.util.MainUtil;
import com.boydti.fawe.util.TaskManager;
import com.sk89q.worldedit.math.BlockVector3;
-import com.sk89q.worldedit.math.Vector3;
import com.sk89q.worldedit.world.World;
import java.io.File;
import java.io.IOException;
@@ -50,7 +49,7 @@ public class RollbackDatabase extends AsyncNotifyQueue {
this(FaweAPI.getWorld(world));
}
- public RollbackDatabase(final World world) throws SQLException, ClassNotFoundException {
+ public RollbackDatabase(World world) throws SQLException, ClassNotFoundException {
this.prefix = "";
this.worldName = world.getName();
this.world = world;
@@ -96,7 +95,7 @@ public class RollbackDatabase extends AsyncNotifyQueue {
}
}
- public void delete(final UUID uuid, final int id) {
+ public void delete(UUID uuid, int id) {
addTask(new Runnable() {
@Override
public void run() {
@@ -127,12 +126,13 @@ public class RollbackDatabase extends AsyncNotifyQueue {
});
}
- public void getPotentialEdits(final UUID uuid, final long minTime, final BlockVector3 pos1, final BlockVector3 pos2, final RunnableVal onEach, final Runnable whenDone, final boolean delete, final boolean ascending) {
+ public void getPotentialEdits(UUID uuid, long minTime, BlockVector3 pos1, BlockVector3 pos2, RunnableVal onEach, Runnable whenDone, boolean delete, boolean ascending) {
final World world = FaweAPI.getWorld(this.worldName);
addTask(new Runnable() {
@Override
public void run() {
- String stmtStr = ascending ? (uuid == null ? GET_EDITS_ASC : GET_EDITS_USER_ASC) : (uuid == null ? GET_EDITS : GET_EDITS_USER);
+ String stmtStr = ascending ? uuid == null ? GET_EDITS_ASC : GET_EDITS_USER_ASC :
+ uuid == null ? GET_EDITS : GET_EDITS_USER;
try (PreparedStatement stmt = connection.prepareStatement(stmtStr)) {
stmt.setInt(1, pos1.getBlockX());
stmt.setInt(2, pos2.getBlockX());
@@ -243,7 +243,7 @@ public class RollbackDatabase extends AsyncNotifyQueue {
}
commit();
return true;
- } catch (final Exception e) {
+ } catch (Exception e) {
e.printStackTrace();
}
return false;
@@ -258,7 +258,7 @@ public class RollbackDatabase extends AsyncNotifyQueue {
connection.commit();
connection.setAutoCommit(true);
}
- } catch (final SQLException e) {
+ } catch (SQLException e) {
e.printStackTrace();
}
}
@@ -270,11 +270,11 @@ public class RollbackDatabase extends AsyncNotifyQueue {
if (!Fawe.imp().getDirectory().exists()) {
Fawe.imp().getDirectory().mkdirs();
}
- if (!(dbLocation.exists())) {
+ if (!dbLocation.exists()) {
try {
dbLocation.getParentFile().mkdirs();
dbLocation.createNewFile();
- } catch (final IOException e) {
+ } catch (IOException e) {
e.printStackTrace();
Fawe.debug("&cUnable to create database!");
}
@@ -299,9 +299,7 @@ public class RollbackDatabase extends AsyncNotifyQueue {
if (connection == null) {
try {
forceConnection();
- } catch (final ClassNotFoundException e) {
- e.printStackTrace();
- } catch (final SQLException e) {
+ } catch (ClassNotFoundException | SQLException e) {
e.printStackTrace();
}
}
@@ -312,7 +310,7 @@ public class RollbackDatabase extends AsyncNotifyQueue {
* Closes the connection with the database
*
* @return true if successful
- * @throws java.sql.SQLException if the connection cannot be closed
+ * @throws SQLException if the connection cannot be closed
*/
public boolean closeConnection() throws SQLException {
if (connection == null) {
@@ -332,12 +330,12 @@ public class RollbackDatabase extends AsyncNotifyQueue {
* Checks if a connection is open with the database
*
* @return true if the connection is open
- * @throws java.sql.SQLException if the connection cannot be checked
+ * @throws SQLException if the connection cannot be checked
*/
public boolean checkConnection() {
try {
- return (connection != null) && !connection.isClosed();
- } catch (final SQLException e) {
+ return connection != null && !connection.isClosed();
+ } catch (SQLException e) {
return false;
}
}
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 8ecf06f30..d61ef443d 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
@@ -108,7 +108,7 @@ public abstract class FawePlayer extends Metadatable {
}
@Deprecated
- public FawePlayer(final T parent) {
+ public FawePlayer(T parent) {
this.parent = parent;
Fawe.get().register(this);
if (Settings.IMP.CLIPBOARD.USE_DISK) {
@@ -247,7 +247,7 @@ public abstract class FawePlayer extends Metadatable {
* Queue an action to run async
* @param run
*/
- public void queueAction(final Runnable run) {
+ public void queueAction(Runnable run) {
runAction(run, false, true);
}
@@ -288,7 +288,7 @@ public abstract class FawePlayer extends Metadatable {
* @param async
* @return false if the task was ran or queued
*/
- public boolean runAction(final Runnable ifFree, boolean checkFree, boolean async) {
+ public boolean runAction(Runnable ifFree, boolean checkFree, boolean async) {
if (checkFree) {
if (runningCount.get() != 0) return false;
}
@@ -363,7 +363,7 @@ public abstract class FawePlayer extends Metadatable {
*
* @param world
*/
- public void loadSessionsFromDisk(final World world) {
+ public void loadSessionsFromDisk(World world) {
if (world == null) {
return;
}
@@ -417,14 +417,14 @@ public abstract class FawePlayer extends Metadatable {
* @param perm
* @return
*/
- public abstract boolean hasPermission(final String perm);
+ public abstract boolean hasPermission(String perm);
/**
* Send a message to the player
*
* @param message
*/
- public abstract void sendMessage(final String message);
+ public abstract void sendMessage(String message);
/**
* Print a WorldEdit error.
@@ -438,7 +438,7 @@ public abstract class FawePlayer extends Metadatable {
*
* @param substring
*/
- public abstract void executeCommand(final String substring);
+ public abstract void executeCommand(String substring);
/**
* Get the player's location
@@ -473,7 +473,7 @@ public abstract class FawePlayer extends Metadatable {
public Region getSelection() {
try {
return this.getSession().getSelection(this.getPlayer().getWorld());
- } catch (final IncompleteRegionException e) {
+ } catch (IncompleteRegionException e) {
return null;
}
}
@@ -509,7 +509,7 @@ public abstract class FawePlayer extends Metadatable {
* @param region
*/
@Deprecated
- public void setSelection(final RegionWrapper region) {
+ public void setSelection(RegionWrapper region) {
final Player player = this.getPlayer();
BlockVector3 top = region.getMaximumPoint();
top.withY(getWorld().getMaxY());
@@ -539,7 +539,7 @@ public abstract class FawePlayer extends Metadatable {
*
* @param selector
*/
- public void setSelection(final RegionSelector selector) {
+ public void setSelection(RegionSelector selector) {
this.getSession().setRegionSelector(toWorldEditPlayer().getWorld(), selector);
}
@@ -551,7 +551,7 @@ public abstract class FawePlayer extends Metadatable {
public Region getLargestRegion() {
int area = 0;
Region max = null;
- for (final Region region : this.getCurrentRegions()) {
+ for (Region region : this.getCurrentRegions()) {
final int tmp = region.getArea();
if (tmp > area) {
area = tmp;
diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/brush/SplatterBrush.java b/worldedit-core/src/main/java/com/boydti/fawe/object/brush/SplatterBrush.java
index 094461bda..c6b4693d0 100644
--- a/worldedit-core/src/main/java/com/boydti/fawe/object/brush/SplatterBrush.java
+++ b/worldedit-core/src/main/java/com/boydti/fawe/object/brush/SplatterBrush.java
@@ -5,7 +5,6 @@ import com.boydti.fawe.object.mask.SurfaceMask;
import com.boydti.fawe.object.pattern.BiomePattern;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.MaxChangedBlocksException;
-import com.sk89q.worldedit.function.mask.Mask;
import com.sk89q.worldedit.function.mask.SolidBlockMask;
import com.sk89q.worldedit.function.operation.Operations;
import com.sk89q.worldedit.function.pattern.Pattern;
@@ -52,7 +51,6 @@ public class SplatterBrush extends ScatterBrush {
}
return false;
}, vector -> editSession.setBlock(vector, finalPattern), recursion);
- visitor.setMaxBranch(2);
visitor.setDirections(Arrays.asList(BreadthFirstSearch.DIAGONAL_DIRECTIONS));
visitor.visit(position);
Operations.completeBlindly(visitor);
diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/brush/SplineBrush.java b/worldedit-core/src/main/java/com/boydti/fawe/object/brush/SplineBrush.java
index de3edc14b..99ec8c3d8 100644
--- a/worldedit-core/src/main/java/com/boydti/fawe/object/brush/SplineBrush.java
+++ b/worldedit-core/src/main/java/com/boydti/fawe/object/brush/SplineBrush.java
@@ -10,7 +10,6 @@ import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.command.tool.brush.Brush;
import com.sk89q.worldedit.entity.Player;
-import com.sk89q.worldedit.function.RegionFunction;
import com.sk89q.worldedit.function.mask.Mask;
import com.sk89q.worldedit.function.mask.MaskIntersection;
import com.sk89q.worldedit.function.operation.Operations;
@@ -21,7 +20,6 @@ import com.sk89q.worldedit.math.Vector3;
import com.sk89q.worldedit.math.interpolation.Node;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.Collections;
import java.util.List;
public class SplineBrush implements Brush, ResettableTool {
@@ -50,7 +48,7 @@ public class SplineBrush implements Brush, ResettableTool {
}
@Override
- public void build(EditSession editSession, final BlockVector3 position, Pattern pattern, double size) throws WorldEditException {
+ public void build(EditSession editSession, BlockVector3 position, Pattern pattern, double size) throws WorldEditException {
Mask mask = editSession.getMask();
if (mask == null) {
mask = new IdMask(editSession);
@@ -70,12 +68,9 @@ public class SplineBrush implements Brush, ResettableTool {
}
final ArrayList points = new ArrayList<>();
if (size > 0) {
- DFSRecursiveVisitor visitor = new DFSRecursiveVisitor(mask, new RegionFunction() {
- @Override
- public boolean apply(BlockVector3 p) {
- points.add(p);
- return true;
- }
+ DFSRecursiveVisitor visitor = new DFSRecursiveVisitor(mask, p -> {
+ points.add(p);
+ return true;
}, (int) size, 1);
List directions = visitor.getDirections();
for (int x = -1; x <= 1; x++) {
@@ -90,7 +85,7 @@ public class SplineBrush implements Brush, ResettableTool {
}
}
}
- Collections.sort(directions, (o1, o2) -> (int) Math.signum(o1.lengthSq() - o2.lengthSq()));
+ directions.sort((o1, o2) -> (int) Math.signum(o1.lengthSq() - o2.lengthSq()));
visitor.visit(position);
Operations.completeBlindly(visitor);
if (points.size() > numSplines) {
@@ -121,7 +116,7 @@ public class SplineBrush implements Brush, ResettableTool {
final List nodes = new ArrayList<>(centroids.size());
- for (final Vector3 nodevector : centroids) {
+ for (Vector3 nodevector : centroids) {
final Node n = new Node(nodevector);
n.setTension(tension);
n.setBias(bias);
@@ -133,7 +128,7 @@ public class SplineBrush implements Brush, ResettableTool {
List currentSpline = new ArrayList<>();
for (ArrayList points : positionSets) {
int listSize = points.size();
- int index = (int) (i * listSize / (double) (numSplines));
+ int index = (int) (i * listSize / (double) numSplines);
currentSpline.add(points.get(index));
}
editSession.drawSpline(pattern, currentSpline, 0, 0, 0, 10, 0, true);
@@ -161,12 +156,10 @@ public class SplineBrush implements Brush, ResettableTool {
private BlockVector3 normal(Collection points, BlockVector3 centroid) {
int n = points.size();
switch (n) {
- case 1: {
+ case 1:
return null;
- }
- case 2: {
+ case 2:
return null;
- }
}
// Calc full 3x3 covariance matrix, excluding symmetries:
@@ -179,9 +172,9 @@ public class SplineBrush implements Brush, ResettableTool {
MutableVector3 r = new MutableVector3();
for (BlockVector3 p : points) {
- r.mutX((p.getX() - centroid.getX()));
- r.mutY((p.getY() - centroid.getY()));
- r.mutZ((p.getZ() - centroid.getZ()));
+ r.mutX(p.getX() - centroid.getX());
+ r.mutY(p.getY() - centroid.getY());
+ r.mutZ(p.getZ() - centroid.getZ());
xx += r.getX() * r.getX();
xy += r.getX() * r.getY();
xz += r.getX() * r.getZ();
@@ -214,7 +207,6 @@ public class SplineBrush implements Brush, ResettableTool {
double b = (xz * xy - yz * xx) / det_z;
dir = BlockVector3.at(a, b, 1.0);
}
- ;
return dir.normalize();
}
}
diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/brush/visualization/ImmutableVirtualWorld.java b/worldedit-core/src/main/java/com/boydti/fawe/object/brush/visualization/ImmutableVirtualWorld.java
index 456f29586..3c33bd6d0 100644
--- a/worldedit-core/src/main/java/com/boydti/fawe/object/brush/visualization/ImmutableVirtualWorld.java
+++ b/worldedit-core/src/main/java/com/boydti/fawe/object/brush/visualization/ImmutableVirtualWorld.java
@@ -4,7 +4,6 @@ import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.MaxChangedBlocksException;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.blocks.BaseItemStack;
-import com.sk89q.worldedit.function.operation.Operation;
import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.Vector3;
@@ -14,8 +13,6 @@ import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.biome.BiomeTypes;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.weather.WeatherType;
-import com.sk89q.worldedit.world.weather.WeatherTypes;
-
import javax.annotation.Nullable;
public abstract class ImmutableVirtualWorld implements VirtualWorld {
@@ -34,12 +31,6 @@ public abstract class ImmutableVirtualWorld implements VirtualWorld {
return BiomeTypes.FOREST;
}
- @Nullable
- @Override
- public Operation commit() {
- return null;
- }
-
@Override
public String getName() {
return Integer.toString(hashCode());
@@ -90,16 +81,6 @@ public abstract class ImmutableVirtualWorld implements VirtualWorld {
unsupported();
}
- @Override
- public WeatherType getWeather() {
- return WeatherTypes.CLEAR;
- }
-
- @Override
- public long getRemainingWeatherDuration() {
- return 0;
- }
-
@Override
public void setWeather(WeatherType weatherType) {
unsupported();
diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/brush/visualization/VirtualWorld.java b/worldedit-core/src/main/java/com/boydti/fawe/object/brush/visualization/VirtualWorld.java
index be92b1ec6..864f9123b 100644
--- a/worldedit-core/src/main/java/com/boydti/fawe/object/brush/visualization/VirtualWorld.java
+++ b/worldedit-core/src/main/java/com/boydti/fawe/object/brush/visualization/VirtualWorld.java
@@ -17,11 +17,6 @@ import java.io.IOException;
public interface VirtualWorld extends SimpleWorld, Closeable {
Vector3 getOrigin();
- @Override
- default BaseBlock getFullBlock(BlockVector3 position) {
- return getBlock(position).toBaseBlock();
- }
-
@Override
default BaseBlock getFullBlock(int x, int y, int z) {
return getBlock(x, y, z).toBaseBlock();
diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/brush/visualization/VisualQueue.java b/worldedit-core/src/main/java/com/boydti/fawe/object/brush/visualization/VisualQueue.java
index b0e6d2bf3..8d4cec5e2 100644
--- a/worldedit-core/src/main/java/com/boydti/fawe/object/brush/visualization/VisualQueue.java
+++ b/worldedit-core/src/main/java/com/boydti/fawe/object/brush/visualization/VisualQueue.java
@@ -6,7 +6,6 @@ import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.command.tool.BrushTool;
import com.sk89q.worldedit.command.tool.Tool;
-import com.sk89q.worldedit.command.tool.brush.Brush;
import com.sk89q.worldedit.entity.Player;
public class VisualQueue extends SingleThreadIntervalQueue {
@@ -17,7 +16,8 @@ public class VisualQueue extends SingleThreadIntervalQueue {
@Override
public void operate(FawePlayer fp) {
- LocalSession session = fp.getSession();
+ LocalSession session = WorldEdit.getInstance().getSessionManager()
+ .get(fp.toWorldEditPlayer());
Player player = fp.getPlayer();
Tool tool = session.getTool(player);
if (tool instanceof BrushTool) {
diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/brush/visualization/cfi/HeightMapMCAGenerator.java b/worldedit-core/src/main/java/com/boydti/fawe/object/brush/visualization/cfi/HeightMapMCAGenerator.java
index 304b9166a..050aeab02 100644
--- a/worldedit-core/src/main/java/com/boydti/fawe/object/brush/visualization/cfi/HeightMapMCAGenerator.java
+++ b/worldedit-core/src/main/java/com/boydti/fawe/object/brush/visualization/cfi/HeightMapMCAGenerator.java
@@ -1942,11 +1942,6 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
return false;
}
- @Override
- public boolean generateTree(TreeGenerator.TreeType type, EditSession editSession, BlockVector3 position) throws MaxChangedBlocksException {
- return false;
- }
-
@Override
public void dropItem(Vector3 position, BaseItemStack item) {
// TODO Auto-generated method stub
@@ -1970,4 +1965,4 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
// TODO Auto-generated method stub
return null;
}
-}
\ No newline at end of file
+}
diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/changeset/AbstractDelegateChangeSet.java b/worldedit-core/src/main/java/com/boydti/fawe/object/changeset/AbstractDelegateChangeSet.java
index 3e01457f9..e69c1c41a 100644
--- a/worldedit-core/src/main/java/com/boydti/fawe/object/changeset/AbstractDelegateChangeSet.java
+++ b/worldedit-core/src/main/java/com/boydti/fawe/object/changeset/AbstractDelegateChangeSet.java
@@ -33,11 +33,6 @@ public class AbstractDelegateChangeSet extends FaweChangeSet {
super.addChangeTask(queue);
}
- @Override
- public boolean closeAsync() {
- return super.closeAsync();
- }
-
@Override
public boolean flush() {
return parent.flush();
diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/AbstractDelegateFaweClipboard.java b/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/AbstractDelegateFaweClipboard.java
index 37c9de4dd..6d9bd9b52 100644
--- a/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/AbstractDelegateFaweClipboard.java
+++ b/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/AbstractDelegateFaweClipboard.java
@@ -1,7 +1,6 @@
package com.boydti.fawe.object.clipboard;
import com.boydti.fawe.jnbt.NBTStreamer;
-
import com.sk89q.jnbt.CompoundTag;
import com.sk89q.worldedit.entity.BaseEntity;
import com.sk89q.worldedit.entity.Entity;
@@ -10,7 +9,6 @@ import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockStateHolder;
-
import java.util.List;
public class AbstractDelegateFaweClipboard extends FaweClipboard {
diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/CPUOptimizedClipboard.java b/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/CPUOptimizedClipboard.java
index 6544286a6..3eaab8e9d 100644
--- a/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/CPUOptimizedClipboard.java
+++ b/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/CPUOptimizedClipboard.java
@@ -3,7 +3,6 @@ package com.boydti.fawe.object.clipboard;
import com.boydti.fawe.jnbt.NBTStreamer;
import com.boydti.fawe.object.IntegerTrio;
import com.boydti.fawe.util.ReflectionUtils;
-
import com.sk89q.jnbt.CompoundTag;
import com.sk89q.jnbt.IntTag;
import com.sk89q.jnbt.Tag;
@@ -16,7 +15,6 @@ import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.block.BlockTypes;
-
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
@@ -127,13 +125,14 @@ public class CPUOptimizedClipboard extends FaweClipboard {
return BlockVector3.at(width, height, length);
}
- private int ylast;
- private int ylasti;
- private int zlast;
- private int zlasti;
+ private int yLast;
+ private int yLastI;
+ private int zLast;
+ private int zLastI;
public int getIndex(int x, int y, int z) {
- return x + ((ylast == y) ? ylasti : (ylasti = (ylast = y) * area)) + ((zlast == z) ? zlasti : (zlasti = (zlast = z) * width));
+ return x + ((yLast == y) ? yLastI : (yLastI = (yLast = y) * area)) + ((zLast == z) ? zLastI
+ : (zLastI = (zLast = z) * width));
}
@Override
diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/DiskOptimizedClipboard.java b/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/DiskOptimizedClipboard.java
index 1d86aa11b..7f581f4e1 100644
--- a/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/DiskOptimizedClipboard.java
+++ b/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/DiskOptimizedClipboard.java
@@ -9,9 +9,6 @@ import com.boydti.fawe.util.ReflectionUtils;
import com.sk89q.jnbt.CompoundTag;
import com.sk89q.jnbt.IntTag;
import com.sk89q.jnbt.Tag;
-import com.sk89q.worldedit.world.biome.BiomeTypes;
-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.Extent;
@@ -19,10 +16,12 @@ import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.CuboidRegion;
import com.sk89q.worldedit.world.biome.BiomeType;
+import com.sk89q.worldedit.world.biome.BiomeTypes;
+import com.sk89q.worldedit.world.block.BaseBlock;
+import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.block.BlockTypes;
-
import java.io.Closeable;
import java.io.File;
import java.io.IOException;
@@ -82,7 +81,7 @@ public class DiskOptimizedClipboard extends FaweClipboard implements Closeable {
area = width * length;
this.volume = length * width * height;
- if ((braf.length() - HEADER_SIZE) == (volume << 2) + area) {
+ if (braf.length() - HEADER_SIZE == (volume << 2) + area) {
hasBiomes = true;
}
autoCloseTask();
@@ -357,7 +356,7 @@ public class DiskOptimizedClipboard extends FaweClipboard implements Closeable {
}
@Override
- public void forEach(final BlockReader task, boolean air) {
+ public void forEach(BlockReader task, boolean air) {
byteBuffer.force();
int pos = HEADER_SIZE;
IntegerTrio trio = new IntegerTrio();
@@ -418,7 +417,8 @@ public class DiskOptimizedClipboard extends FaweClipboard implements Closeable {
}
public int getIndex(int x, int y, int z) {
- return x + ((ylast == y) ? ylasti : (ylasti = (ylast = y) * area)) + ((zlast == z) ? zlasti : (zlasti = (zlast = z) * width));
+ return x + (ylast == y ? ylasti : (ylasti = (ylast = y) * area)) + (zlast == z
+ ? zlasti : (zlasti = (zlast = z) * width));
}
@Override
@@ -445,7 +445,7 @@ public class DiskOptimizedClipboard extends FaweClipboard implements Closeable {
@Override
public BaseBlock getBlock(int i) {
try {
- int diskIndex = (HEADER_SIZE) + (i << 2);
+ int diskIndex = HEADER_SIZE + (i << 2);
int combinedId = byteBuffer.getInt(diskIndex);
BlockType type = BlockTypes.getFromStateId(combinedId);
BaseBlock base = type.withStateId(combinedId).toBaseBlock();
@@ -464,7 +464,7 @@ public class DiskOptimizedClipboard extends FaweClipboard implements Closeable {
} else {
// x + z * width + y * area;
int y = i / area;
- int newI = (i - (y * area));
+ int newI = i - y * area;
int z = newI / width;
int x = newI - z * width;
nbt = nbtMap.get(new IntegerTrio(x, y, z));
@@ -494,7 +494,7 @@ public class DiskOptimizedClipboard extends FaweClipboard implements Closeable {
@Override
public > boolean setBlock(int x, int y, int z, B block) {
try {
- int index = (HEADER_SIZE) + ((getIndex(x, y, z) << 2));
+ int index = HEADER_SIZE + (getIndex(x, y, z) << 2);
int combined = block.getInternalId();
byteBuffer.putInt(index, combined);
boolean hasNbt = block instanceof BaseBlock && block.hasNbtData();
@@ -512,12 +512,12 @@ public class DiskOptimizedClipboard extends FaweClipboard implements Closeable {
public > boolean setBlock(int i, B block) {
try {
int combined = block.getInternalId();
- int index = (HEADER_SIZE) + (i << 2);
+ int index = HEADER_SIZE + (i << 2);
byteBuffer.putInt(index, combined);
boolean hasNbt = block instanceof BaseBlock && block.hasNbtData();
if (hasNbt) {
int y = i / area;
- int newI = (i - (y * area));
+ int newI = i - y * area;
int z = newI / width;
int x = newI - z * width;
setTile(x, y, z, block.getNbtData());
diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/EmptyClipboard.java b/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/EmptyClipboard.java
index 78d49acca..1cc2a0329 100644
--- a/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/EmptyClipboard.java
+++ b/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/EmptyClipboard.java
@@ -1,25 +1,17 @@
package com.boydti.fawe.object.clipboard;
import com.sk89q.worldedit.WorldEditException;
-import com.sk89q.worldedit.entity.BaseEntity;
-import com.sk89q.worldedit.entity.Entity;
import com.sk89q.worldedit.extent.clipboard.Clipboard;
-import com.sk89q.worldedit.function.operation.Operation;
import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.CuboidRegion;
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.BaseBlock;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.block.BlockTypes;
-import javax.annotation.Nullable;
-import java.util.Collections;
-import java.util.List;
-
public class EmptyClipboard implements Clipboard {
public static final EmptyClipboard INSTANCE = new EmptyClipboard();
@@ -56,22 +48,6 @@ public class EmptyClipboard implements Clipboard {
return BlockVector3.ZERO;
}
- @Override
- public List extends Entity> getEntities(Region region) {
- return Collections.emptyList();
- }
-
- @Override
- public List extends Entity> getEntities() {
- return Collections.emptyList();
- }
-
- @Nullable
- @Override
- public Entity createEntity(Location location, BaseEntity entity) {
- return null;
- }
-
@Override
public BaseBlock getFullBlock(BlockVector3 position) {
return BlockTypes.AIR.getDefaultState().toBaseBlock();
@@ -97,9 +73,4 @@ public class EmptyClipboard implements Clipboard {
return false;
}
- @Nullable
- @Override
- public Operation commit() {
- return null;
- }
}
diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/FaweClipboard.java b/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/FaweClipboard.java
index 1345c8d78..0aa777c2a 100644
--- a/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/FaweClipboard.java
+++ b/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/FaweClipboard.java
@@ -66,11 +66,11 @@ public abstract class FaweClipboard {
> void run(int x, int y, int z, B block);
}
- public abstract void streamBiomes(final NBTStreamer.ByteReader task);
+ public abstract void streamBiomes(NBTStreamer.ByteReader task);
- public void streamCombinedIds(final NBTStreamer.ByteReader task) {
+ public void streamCombinedIds(NBTStreamer.ByteReader task) {
forEach(new BlockReader() {
- private int index = 0;
+ private int index;
@Override
public > void run(int x, int y, int z, B block) {
diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/LazyClipboardHolder.java b/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/LazyClipboardHolder.java
index 9542f5fc3..e7b9522c7 100644
--- a/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/LazyClipboardHolder.java
+++ b/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/LazyClipboardHolder.java
@@ -5,7 +5,6 @@ import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
import com.sk89q.worldedit.extent.clipboard.Clipboard;
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat;
import com.sk89q.worldedit.extent.clipboard.io.ClipboardReader;
-
import java.io.InputStream;
import java.net.URI;
import java.util.UUID;
diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/MemoryOptimizedClipboard.java b/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/MemoryOptimizedClipboard.java
index d09521a10..7d36969d6 100644
--- a/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/MemoryOptimizedClipboard.java
+++ b/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/MemoryOptimizedClipboard.java
@@ -5,27 +5,25 @@ import com.boydti.fawe.jnbt.NBTStreamer;
import com.boydti.fawe.object.IntegerTrio;
import com.boydti.fawe.util.MainUtil;
import com.boydti.fawe.util.ReflectionUtils;
-
import com.sk89q.jnbt.CompoundTag;
import com.sk89q.jnbt.IntTag;
import com.sk89q.jnbt.Tag;
-import com.sk89q.worldedit.world.biome.BiomeTypes;
-import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.entity.BaseEntity;
import com.sk89q.worldedit.entity.Entity;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.world.biome.BiomeType;
+import com.sk89q.worldedit.world.biome.BiomeTypes;
+import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.block.BlockTypes;
-import net.jpountz.util.SafeUtils;
-
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
+import net.jpountz.util.SafeUtils;
public class MemoryOptimizedClipboard extends FaweClipboard {
diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/MultiClipboardHolder.java b/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/MultiClipboardHolder.java
index 1238f3f91..b9e3ad59d 100644
--- a/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/MultiClipboardHolder.java
+++ b/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/MultiClipboardHolder.java
@@ -1,15 +1,18 @@
package com.boydti.fawe.object.clipboard;
+import static com.google.common.base.Preconditions.checkNotNull;
+
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
import com.sk89q.worldedit.extent.clipboard.Clipboard;
import com.sk89q.worldedit.session.ClipboardHolder;
import java.net.URI;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.UUID;
import java.util.concurrent.ThreadLocalRandom;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
public class MultiClipboardHolder extends URIClipboardHolder {
private final List holders;
private Clipboard[] cached;
diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/ReadOnlyClipboard.java b/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/ReadOnlyClipboard.java
index 88c373a0a..7ad3a4fdc 100644
--- a/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/ReadOnlyClipboard.java
+++ b/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/ReadOnlyClipboard.java
@@ -1,7 +1,6 @@
package com.boydti.fawe.object.clipboard;
import com.boydti.fawe.jnbt.NBTStreamer;
-
import com.sk89q.jnbt.CompoundTag;
import com.sk89q.worldedit.entity.BaseEntity;
import com.sk89q.worldedit.entity.Entity;
@@ -11,7 +10,6 @@ import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockStateHolder;
-
import java.util.List;
public abstract class ReadOnlyClipboard extends FaweClipboard {
diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/ResizableClipboardBuilder.java b/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/ResizableClipboardBuilder.java
index 8406b71a5..a7b74771f 100644
--- a/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/ResizableClipboardBuilder.java
+++ b/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/ResizableClipboardBuilder.java
@@ -4,15 +4,14 @@ import com.boydti.fawe.object.change.MutableBlockChange;
import com.boydti.fawe.object.change.MutableTileChange;
import com.boydti.fawe.object.changeset.MemoryOptimizedHistory;
import com.sk89q.worldedit.WorldEditException;
-import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
import com.sk89q.worldedit.extent.clipboard.Clipboard;
import com.sk89q.worldedit.history.change.Change;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.CuboidRegion;
import com.sk89q.worldedit.world.World;
+import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockStateHolder;
-
import java.util.Iterator;
public class ResizableClipboardBuilder extends MemoryOptimizedHistory {
diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/URIClipboardHolder.java b/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/URIClipboardHolder.java
index 5ae4c0502..c583565b1 100644
--- a/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/URIClipboardHolder.java
+++ b/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/URIClipboardHolder.java
@@ -1,14 +1,13 @@
package com.boydti.fawe.object.clipboard;
+import static com.google.common.base.Preconditions.checkNotNull;
+
import com.sk89q.worldedit.extent.clipboard.Clipboard;
import com.sk89q.worldedit.session.ClipboardHolder;
import java.net.URI;
import java.util.Collections;
import java.util.Set;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
public class URIClipboardHolder extends ClipboardHolder {
private final URI uri;
diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/WorldCutClipboard.java b/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/WorldCutClipboard.java
index c8512e8e8..7340f9959 100644
--- a/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/WorldCutClipboard.java
+++ b/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/WorldCutClipboard.java
@@ -2,8 +2,8 @@ package com.boydti.fawe.object.clipboard;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.math.BlockVector3;
-import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.regions.Region;
+import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockTypes;
public class WorldCutClipboard extends WorldCopyClipboard {
diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/remap/ClipboardRemapper.java b/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/remap/ClipboardRemapper.java
index b48c55f6e..328dd1106 100644
--- a/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/remap/ClipboardRemapper.java
+++ b/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/remap/ClipboardRemapper.java
@@ -5,9 +5,9 @@ import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.sk89q.jnbt.CompoundTag;
import com.sk89q.worldedit.WorldEditException;
-import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.blocks.BaseItem;
import com.sk89q.worldedit.extent.clipboard.Clipboard;
+import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.item.ItemTypes;
import java.io.File;
diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/remap/WikiScraper.java b/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/remap/WikiScraper.java
index 80ef67d78..acbcba52f 100644
--- a/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/remap/WikiScraper.java
+++ b/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/remap/WikiScraper.java
@@ -2,12 +2,10 @@ package com.boydti.fawe.object.clipboard.remap;
import com.boydti.fawe.util.MainUtil;
-
import com.google.common.io.Resources;
import com.google.common.reflect.TypeToken;
import com.google.gson.Gson;
import com.google.gson.JsonSyntaxException;
-
import java.io.File;
import java.io.IOException;
import java.nio.charset.Charset;
diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/collection/AdaptedSetCollection.java b/worldedit-core/src/main/java/com/boydti/fawe/object/collection/AdaptedSetCollection.java
index 0f0b33b7b..8b9a23663 100644
--- a/worldedit-core/src/main/java/com/boydti/fawe/object/collection/AdaptedSetCollection.java
+++ b/worldedit-core/src/main/java/com/boydti/fawe/object/collection/AdaptedSetCollection.java
@@ -2,9 +2,6 @@ package com.boydti.fawe.object.collection;
import com.google.common.base.Function;
import com.google.common.collect.Collections2;
-import org.jetbrains.annotations.NotNull;
-
-import javax.annotation.Nullable;
import java.util.Collection;
import java.util.Iterator;
import java.util.Set;
@@ -12,6 +9,7 @@ import java.util.Spliterator;
import java.util.function.Consumer;
import java.util.function.Predicate;
import java.util.stream.Stream;
+import org.jetbrains.annotations.NotNull;
/**
* Adapt a collection to a set
@@ -67,6 +65,7 @@ public class AdaptedSetCollection implements Set {
return adapted.toArray(a);
}
+ @Override
public boolean add(V v) {
return adapted.add(v);
}
@@ -81,6 +80,7 @@ public class AdaptedSetCollection implements Set {
return adapted.containsAll(c);
}
+ @Override
public boolean addAll(@NotNull Collection extends V> c) {
return adapted.addAll(c);
}
@@ -90,6 +90,7 @@ public class AdaptedSetCollection implements Set {
return adapted.removeAll(c);
}
+ @Override
public boolean removeIf(Predicate super V> filter) {
return adapted.removeIf(filter);
}
@@ -129,6 +130,7 @@ public class AdaptedSetCollection implements Set {
return adapted.parallelStream();
}
+ @Override
public void forEach(Consumer super V> action) {
adapted.forEach(action);
}
diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/collection/BlockSet.java b/worldedit-core/src/main/java/com/boydti/fawe/object/collection/BlockSet.java
index a96a8f340..0edf2c6bd 100644
--- a/worldedit-core/src/main/java/com/boydti/fawe/object/collection/BlockSet.java
+++ b/worldedit-core/src/main/java/com/boydti/fawe/object/collection/BlockSet.java
@@ -4,9 +4,6 @@ import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.AbstractRegion;
import com.sk89q.worldedit.regions.RegionOperationException;
-import com.sk89q.worldedit.world.World;
-
-import java.util.AbstractSet;
import java.util.Iterator;
import java.util.Set;
@@ -34,6 +31,7 @@ public abstract class BlockSet extends AbstractRegion {
}
}
+ @Override
public boolean contains(BlockVector3 obj) {
return contains(obj.getX(), obj.getY(), obj.getZ());
}
@@ -94,10 +92,15 @@ public abstract class BlockSet extends AbstractRegion {
public abstract void set(int x, int y, int z);
public abstract void clear(int x, int y, int z);
public abstract boolean remove(int x, int y, int z);
+ @Override
public abstract Iterator iterator();
+ @Override
public abstract Set getChunks();
+ @Override
public abstract Set getChunkCubes();
+ @Override
public abstract BlockVector3 getMaximumPoint();
+ @Override
public abstract BlockVector3 getMinimumPoint();
@Override
diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/collection/BlockVectorSet.java b/worldedit-core/src/main/java/com/boydti/fawe/object/collection/BlockVectorSet.java
index 068b25c10..74dc46802 100644
--- a/worldedit-core/src/main/java/com/boydti/fawe/object/collection/BlockVectorSet.java
+++ b/worldedit-core/src/main/java/com/boydti/fawe/object/collection/BlockVectorSet.java
@@ -19,7 +19,6 @@ import java.util.*;
*/
public class BlockVectorSet extends AbstractCollection implements Set {
private Int2ObjectMap localSets = new Int2ObjectOpenHashMap<>();
- private MutableBlockVector3 mutable = new MutableBlockVector3();
@Override
public int size() {
diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/extent/MemoryCheckingExtent.java b/worldedit-core/src/main/java/com/boydti/fawe/object/extent/MemoryCheckingExtent.java
index 72f7583cb..d9b428f96 100644
--- a/worldedit-core/src/main/java/com/boydti/fawe/object/extent/MemoryCheckingExtent.java
+++ b/worldedit-core/src/main/java/com/boydti/fawe/object/extent/MemoryCheckingExtent.java
@@ -4,10 +4,9 @@ import com.boydti.fawe.config.BBC;
import com.boydti.fawe.object.FawePlayer;
import com.boydti.fawe.object.exception.FaweException;
import com.boydti.fawe.util.MemUtil;
-import com.boydti.fawe.util.Perm;
+import com.boydti.fawe.util.Permission;
import com.boydti.fawe.util.WEManager;
import com.sk89q.worldedit.WorldEditException;
-import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.extent.AbstractDelegateExtent;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.math.BlockVector3;
@@ -27,7 +26,7 @@ public class MemoryCheckingExtent extends AbstractDelegateExtent {
if (MemUtil.isMemoryLimited()) {
if (this.player != null) {
player.sendMessage(BBC.WORLDEDIT_CANCEL_REASON.format(BBC.WORLDEDIT_CANCEL_REASON_LOW_MEMORY.s()));
- if (Perm.hasPermission(this.player, "worldedit.fast")) {
+ if (Permission.hasPermission(this.player.toWorldEditPlayer(), "worldedit.fast")) {
BBC.WORLDEDIT_OOM_ADMIN.send(this.player);
}
}
diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/extent/ProcessedWEExtent.java b/worldedit-core/src/main/java/com/boydti/fawe/object/extent/ProcessedWEExtent.java
index 3aa689ada..8965d7d4d 100644
--- a/worldedit-core/src/main/java/com/boydti/fawe/object/extent/ProcessedWEExtent.java
+++ b/worldedit-core/src/main/java/com/boydti/fawe/object/extent/ProcessedWEExtent.java
@@ -1,10 +1,8 @@
package com.boydti.fawe.object.extent;
-import com.boydti.fawe.config.BBC;
import com.boydti.fawe.object.FaweLimit;
import com.boydti.fawe.object.exception.FaweException;
import com.boydti.fawe.util.WEManager;
-
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.entity.BaseEntity;
import com.sk89q.worldedit.entity.Entity;
@@ -12,7 +10,6 @@ import com.sk89q.worldedit.extent.AbstractDelegateExtent;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.math.BlockVector3;
-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.BaseBlock;
@@ -20,8 +17,6 @@ import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.block.BlockTypes;
-import java.util.List;
-
public class ProcessedWEExtent extends AbstractDelegateExtent {
private final FaweLimit limit;
private final AbstractDelegateExtent extent;
@@ -48,21 +43,6 @@ public class ProcessedWEExtent extends AbstractDelegateExtent {
return super.createEntity(location, entity);
}
- @Override
- public BiomeType getBiome(final BlockVector2 position) {
- return super.getBiome(position);
- }
-
- @Override
- public List extends Entity> getEntities() {
- return super.getEntities();
- }
-
- @Override
- public List extends Entity> getEntities(final Region region) {
- return super.getEntities(region);
- }
-
@Override
public BlockState getBlock(int x, int y, int z) {
if (!limit.MAX_CHECKS()) {
diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/io/AsyncBufferedOutputStream.java b/worldedit-core/src/main/java/com/boydti/fawe/object/io/AsyncBufferedOutputStream.java
index 2559af7e5..10d150982 100644
--- a/worldedit-core/src/main/java/com/boydti/fawe/object/io/AsyncBufferedOutputStream.java
+++ b/worldedit-core/src/main/java/com/boydti/fawe/object/io/AsyncBufferedOutputStream.java
@@ -36,7 +36,7 @@ public final class AsyncBufferedOutputStream extends FilterOutputStream {
}
/**
- * Creates an asynchronous buffered output stream with defined buffersize and
+ * Creates an asynchronous buffered output stream with defined bufferSize and
* 5 maximal buffers.
*/
public AsyncBufferedOutputStream(OutputStream out, int bufSize) {
@@ -46,7 +46,7 @@ public final class AsyncBufferedOutputStream extends FilterOutputStream {
/**
* Creates an asynchronous buffered output stream.
*
- * @param out the outputstream to layer on.
+ * @param out the outputStream to layer on.
* @param bufSize the buffer size.
* @param maxBuffers the number of buffers to keep in parallel.
*/
@@ -179,4 +179,4 @@ public final class AsyncBufferedOutputStream extends FilterOutputStream {
}
}
-}
\ No newline at end of file
+}
diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/io/zstd/ZstdInputStream.java b/worldedit-core/src/main/java/com/boydti/fawe/object/io/zstd/ZstdInputStream.java
index 1f3e94d3d..18a9d9aac 100644
--- a/worldedit-core/src/main/java/com/boydti/fawe/object/io/zstd/ZstdInputStream.java
+++ b/worldedit-core/src/main/java/com/boydti/fawe/object/io/zstd/ZstdInputStream.java
@@ -1,12 +1,9 @@
package com.github.luben.zstd;
-import java.io.InputStream;
+import com.github.luben.zstd.util.Native;
import java.io.FilterInputStream;
import java.io.IOException;
-import java.lang.IndexOutOfBoundsException;
-
-import com.github.luben.zstd.util.Native;
-import com.github.luben.zstd.Zstd;
+import java.io.InputStream;
/**
* InputStream filter that decompresses the data provided
@@ -42,16 +39,13 @@ public class ZstdInputStream extends FilterInputStream {
private native int initDStream(long stream);
private native int decompressStream(long stream, byte[] dst, int dst_size, byte[] src, int src_size);
- // The main constuctor / legacy version dispatcher
+ // The main constructor / legacy version dispatcher
public ZstdInputStream(InputStream inStream) throws IOException {
// FilterInputStream constructor
super(inStream);
// allocate input buffer with max frame header size
src = new byte[srcBuffSize];
- if (src == null) {
- throw new IOException("Error allocating the input buffer of size " + srcBuffSize);
- }
stream = createDStream();
int size = initDStream(stream);
if (Zstd.isError(size)) {
@@ -80,9 +74,9 @@ public class ZstdInputStream extends FilterInputStream {
throw new IOException("Stream closed");
}
- // guard agains buffer overflows
+ // guard against buffer overflows
if (offset < 0 || len > dst.length - offset) {
- throw new IndexOutOfBoundsException("Requested lenght " + len
+ throw new IndexOutOfBoundsException("Requested length " + len
+ " from offset " + offset + " in buffer of size " + dst.length);
}
int dstSize = offset + len;
diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/mask/AngleMask.java b/worldedit-core/src/main/java/com/boydti/fawe/object/mask/AngleMask.java
index 430651602..ad07972be 100644
--- a/worldedit-core/src/main/java/com/boydti/fawe/object/mask/AngleMask.java
+++ b/worldedit-core/src/main/java/com/boydti/fawe/object/mask/AngleMask.java
@@ -4,7 +4,6 @@ import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.function.mask.SolidBlockMask;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.MutableBlockVector3;
-
import java.util.Arrays;
public class AngleMask extends SolidBlockMask implements ResettableMask {
diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/mask/BlockLightMask.java b/worldedit-core/src/main/java/com/boydti/fawe/object/mask/BlockLightMask.java
index 815a7fc2c..618b5256b 100644
--- a/worldedit-core/src/main/java/com/boydti/fawe/object/mask/BlockLightMask.java
+++ b/worldedit-core/src/main/java/com/boydti/fawe/object/mask/BlockLightMask.java
@@ -3,11 +3,8 @@ package com.boydti.fawe.object.mask;
import com.boydti.fawe.object.extent.LightingExtent;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.function.mask.AbstractExtentMask;
-import com.sk89q.worldedit.function.mask.Mask2D;
import com.sk89q.worldedit.math.BlockVector3;
-import javax.annotation.Nullable;
-
public class BlockLightMask extends AbstractExtentMask {
private final int min, max;
diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/mask/BrightnessMask.java b/worldedit-core/src/main/java/com/boydti/fawe/object/mask/BrightnessMask.java
index 9b08f93c0..b8e274d1a 100644
--- a/worldedit-core/src/main/java/com/boydti/fawe/object/mask/BrightnessMask.java
+++ b/worldedit-core/src/main/java/com/boydti/fawe/object/mask/BrightnessMask.java
@@ -1,7 +1,6 @@
package com.boydti.fawe.object.mask;
import com.boydti.fawe.object.extent.LightingExtent;
-
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.function.mask.AbstractExtentMask;
import com.sk89q.worldedit.math.BlockVector3;
diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/mask/FaweBlockMatcher.java b/worldedit-core/src/main/java/com/boydti/fawe/object/mask/FaweBlockMatcher.java
index b05ad4ef5..421e3c133 100644
--- a/worldedit-core/src/main/java/com/boydti/fawe/object/mask/FaweBlockMatcher.java
+++ b/worldedit-core/src/main/java/com/boydti/fawe/object/mask/FaweBlockMatcher.java
@@ -1,7 +1,6 @@
package com.boydti.fawe.object.mask;
import com.sk89q.worldedit.world.block.BaseBlock;
-
import java.util.Set;
// TODO FIXME
diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/mask/IdMask.java b/worldedit-core/src/main/java/com/boydti/fawe/object/mask/IdMask.java
index 38b0d8b7c..c235e93c5 100644
--- a/worldedit-core/src/main/java/com/boydti/fawe/object/mask/IdMask.java
+++ b/worldedit-core/src/main/java/com/boydti/fawe/object/mask/IdMask.java
@@ -2,11 +2,8 @@ package com.boydti.fawe.object.mask;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.function.mask.AbstractExtentMask;
-import com.sk89q.worldedit.function.mask.Mask2D;
import com.sk89q.worldedit.math.BlockVector3;
-import javax.annotation.Nullable;
-
public class IdMask extends AbstractExtentMask implements ResettableMask {
private transient int id = -1;
diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/mask/LightMask.java b/worldedit-core/src/main/java/com/boydti/fawe/object/mask/LightMask.java
index 8489124ec..c6debf87d 100644
--- a/worldedit-core/src/main/java/com/boydti/fawe/object/mask/LightMask.java
+++ b/worldedit-core/src/main/java/com/boydti/fawe/object/mask/LightMask.java
@@ -3,11 +3,8 @@ package com.boydti.fawe.object.mask;
import com.boydti.fawe.object.extent.LightingExtent;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.function.mask.AbstractExtentMask;
-import com.sk89q.worldedit.function.mask.Mask2D;
import com.sk89q.worldedit.math.BlockVector3;
-import javax.annotation.Nullable;
-
public class LightMask extends AbstractExtentMask {
private final int min, max;
diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/mask/MaskedTargetBlock.java b/worldedit-core/src/main/java/com/boydti/fawe/object/mask/MaskedTargetBlock.java
index 8735343fd..88b94072e 100644
--- a/worldedit-core/src/main/java/com/boydti/fawe/object/mask/MaskedTargetBlock.java
+++ b/worldedit-core/src/main/java/com/boydti/fawe/object/mask/MaskedTargetBlock.java
@@ -33,6 +33,6 @@ public class MaskedTargetBlock extends TargetBlock {
}
}
Location currentBlock = getCurrentBlock();
- return (currentBlock != null || !useLastBlock ? currentBlock : lastBlock);
+ return currentBlock != null || !useLastBlock ? currentBlock : lastBlock;
}
-}
\ No newline at end of file
+}
diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/mask/OpacityMask.java b/worldedit-core/src/main/java/com/boydti/fawe/object/mask/OpacityMask.java
index 8d35f884e..0a5dd7720 100644
--- a/worldedit-core/src/main/java/com/boydti/fawe/object/mask/OpacityMask.java
+++ b/worldedit-core/src/main/java/com/boydti/fawe/object/mask/OpacityMask.java
@@ -3,11 +3,8 @@ package com.boydti.fawe.object.mask;
import com.boydti.fawe.object.extent.LightingExtent;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.function.mask.AbstractExtentMask;
-import com.sk89q.worldedit.function.mask.Mask2D;
import com.sk89q.worldedit.math.BlockVector3;
-import javax.annotation.Nullable;
-
public class OpacityMask extends AbstractExtentMask {
private final int min, max;
diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/mask/PlaneMask.java b/worldedit-core/src/main/java/com/boydti/fawe/object/mask/PlaneMask.java
index ba22cbe75..07227a34c 100644
--- a/worldedit-core/src/main/java/com/boydti/fawe/object/mask/PlaneMask.java
+++ b/worldedit-core/src/main/java/com/boydti/fawe/object/mask/PlaneMask.java
@@ -1,11 +1,8 @@
package com.boydti.fawe.object.mask;
import com.sk89q.worldedit.function.mask.AbstractMask;
-import com.sk89q.worldedit.function.mask.Mask2D;
import com.sk89q.worldedit.math.BlockVector3;
-import javax.annotation.Nullable;
-
/**
* Restricts the
*/
diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/mask/ROCAngleMask.java b/worldedit-core/src/main/java/com/boydti/fawe/object/mask/ROCAngleMask.java
index b1ecb4f02..de4c437fc 100644
--- a/worldedit-core/src/main/java/com/boydti/fawe/object/mask/ROCAngleMask.java
+++ b/worldedit-core/src/main/java/com/boydti/fawe/object/mask/ROCAngleMask.java
@@ -10,22 +10,25 @@ public class ROCAngleMask extends AngleMask {
@Override
protected boolean testSlope(int x, int y, int z) {
- double slope, tmp;
- boolean aboveMin;
+ double tmp;
lastY = y;
int base = getHeight(x, y, z);
- slope = ((getHeight(x + distance, y, z) - base) - (base - getHeight(x - distance, y, z))) * ADJACENT_MOD;
+ double slope =
+ (getHeight(x + distance, y, z) - base - (base - getHeight(x - distance, y, z)))
+ * ADJACENT_MOD;
- tmp = ((getHeight(x, y, z + distance) - base) - (base - getHeight(x, y, z - distance))) * ADJACENT_MOD;
+ tmp = (getHeight(x, y, z + distance) - base - (base - getHeight(x, y, z - distance))) * ADJACENT_MOD;
if (Math.abs(tmp) > Math.abs(slope)) slope = tmp;
- tmp = ((getHeight(x + distance, y, z + distance) - base) - (base - getHeight(x - distance, y, z - distance))) * DIAGONAL_MOD;
+ tmp = (getHeight(x + distance, y, z + distance) - base - (base - getHeight(x - distance, y,
+ z - distance))) * DIAGONAL_MOD;
if (Math.abs(tmp) > Math.abs(slope)) slope = tmp;
- tmp = ((getHeight(x - distance, y, z + distance) - base) - (base - getHeight(x + distance, y, z - distance))) * DIAGONAL_MOD;
+ tmp = (getHeight(x - distance, y, z + distance) - base - (base - getHeight(x + distance, y,
+ z - distance))) * DIAGONAL_MOD;
if (Math.abs(tmp) > Math.abs(slope)) slope = tmp;
- return lastValue = (slope >= min && slope <= max);
+ return lastValue = slope >= min && slope <= max;
}
-}
\ No newline at end of file
+}
diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/mask/RadiusMask.java b/worldedit-core/src/main/java/com/boydti/fawe/object/mask/RadiusMask.java
index 0ece9ff56..46091a7e8 100644
--- a/worldedit-core/src/main/java/com/boydti/fawe/object/mask/RadiusMask.java
+++ b/worldedit-core/src/main/java/com/boydti/fawe/object/mask/RadiusMask.java
@@ -1,11 +1,8 @@
package com.boydti.fawe.object.mask;
import com.sk89q.worldedit.function.mask.AbstractMask;
-import com.sk89q.worldedit.function.mask.Mask2D;
import com.sk89q.worldedit.math.BlockVector3;
-import javax.annotation.Nullable;
-
public class RadiusMask extends AbstractMask implements ResettableMask {
private transient BlockVector3 pos;
diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/mask/RandomMask.java b/worldedit-core/src/main/java/com/boydti/fawe/object/mask/RandomMask.java
index 265184db9..05de613cc 100644
--- a/worldedit-core/src/main/java/com/boydti/fawe/object/mask/RandomMask.java
+++ b/worldedit-core/src/main/java/com/boydti/fawe/object/mask/RandomMask.java
@@ -2,7 +2,6 @@ package com.boydti.fawe.object.mask;
import com.sk89q.worldedit.function.mask.AbstractMask;
import com.sk89q.worldedit.math.BlockVector3;
-
import java.util.SplittableRandom;
public class RandomMask extends AbstractMask implements ResettableMask {
@@ -23,4 +22,4 @@ public class RandomMask extends AbstractMask implements ResettableMask {
public void reset() {
random = new SplittableRandom();
}
-}
\ No newline at end of file
+}
diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/mask/SkyLightMask.java b/worldedit-core/src/main/java/com/boydti/fawe/object/mask/SkyLightMask.java
index 3be2f710f..bd014ed71 100644
--- a/worldedit-core/src/main/java/com/boydti/fawe/object/mask/SkyLightMask.java
+++ b/worldedit-core/src/main/java/com/boydti/fawe/object/mask/SkyLightMask.java
@@ -3,11 +3,8 @@ package com.boydti.fawe.object.mask;
import com.boydti.fawe.object.extent.LightingExtent;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.function.mask.AbstractExtentMask;
-import com.sk89q.worldedit.function.mask.Mask2D;
import com.sk89q.worldedit.math.BlockVector3;
-import javax.annotation.Nullable;
-
public class SkyLightMask extends AbstractExtentMask {
private final int min, max;
diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/mask/SolidPlaneMask.java b/worldedit-core/src/main/java/com/boydti/fawe/object/mask/SolidPlaneMask.java
index 144397237..a560f7dc1 100644
--- a/worldedit-core/src/main/java/com/boydti/fawe/object/mask/SolidPlaneMask.java
+++ b/worldedit-core/src/main/java/com/boydti/fawe/object/mask/SolidPlaneMask.java
@@ -1,13 +1,10 @@
package com.boydti.fawe.object.mask;
import com.sk89q.worldedit.extent.Extent;
-import com.sk89q.worldedit.function.mask.Mask2D;
import com.sk89q.worldedit.function.mask.SolidBlockMask;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.MutableBlockVector3;
-import javax.annotation.Nullable;
-
/**
* Restricts the
*/
diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/mask/XAxisMask.java b/worldedit-core/src/main/java/com/boydti/fawe/object/mask/XAxisMask.java
index 109eea2f3..ec61666f3 100644
--- a/worldedit-core/src/main/java/com/boydti/fawe/object/mask/XAxisMask.java
+++ b/worldedit-core/src/main/java/com/boydti/fawe/object/mask/XAxisMask.java
@@ -1,11 +1,8 @@
package com.boydti.fawe.object.mask;
import com.sk89q.worldedit.function.mask.AbstractMask;
-import com.sk89q.worldedit.function.mask.Mask2D;
import com.sk89q.worldedit.math.BlockVector3;
-import javax.annotation.Nullable;
-
/**
* Restricts the
*/
diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/mask/ZAxisMask.java b/worldedit-core/src/main/java/com/boydti/fawe/object/mask/ZAxisMask.java
index cf8c082df..28d315953 100644
--- a/worldedit-core/src/main/java/com/boydti/fawe/object/mask/ZAxisMask.java
+++ b/worldedit-core/src/main/java/com/boydti/fawe/object/mask/ZAxisMask.java
@@ -1,11 +1,8 @@
package com.boydti.fawe.object.mask;
import com.sk89q.worldedit.function.mask.AbstractMask;
-import com.sk89q.worldedit.function.mask.Mask2D;
import com.sk89q.worldedit.math.BlockVector3;
-import javax.annotation.Nullable;
-
/**
* Restricts the
*/
diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/pattern/AbstractExtentPattern.java b/worldedit-core/src/main/java/com/boydti/fawe/object/pattern/AbstractExtentPattern.java
index 1e6a8204f..47c63dd05 100644
--- a/worldedit-core/src/main/java/com/boydti/fawe/object/pattern/AbstractExtentPattern.java
+++ b/worldedit-core/src/main/java/com/boydti/fawe/object/pattern/AbstractExtentPattern.java
@@ -1,11 +1,10 @@
package com.boydti.fawe.object.pattern;
+import static com.google.common.base.Preconditions.checkNotNull;
+
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.function.pattern.AbstractPattern;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
public abstract class AbstractExtentPattern extends AbstractPattern {
private transient final Extent extent;
diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/pattern/AngleColorPattern.java b/worldedit-core/src/main/java/com/boydti/fawe/object/pattern/AngleColorPattern.java
index d94340204..250bb00e2 100644
--- a/worldedit-core/src/main/java/com/boydti/fawe/object/pattern/AngleColorPattern.java
+++ b/worldedit-core/src/main/java/com/boydti/fawe/object/pattern/AngleColorPattern.java
@@ -1,13 +1,11 @@
package com.boydti.fawe.object.pattern;
-import com.boydti.fawe.beta.FilterBlock;
import com.boydti.fawe.object.DataAnglePattern;
import com.boydti.fawe.util.TextureHolder;
import com.sk89q.worldedit.WorldEditException;
-import com.sk89q.worldedit.world.block.BaseBlock;
-import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.math.BlockVector3;
+import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.block.BlockType;
@@ -69,4 +67,4 @@ public class AngleColorPattern extends DataAnglePattern {
if (newBlock == null) return false;
return set.setBlock(extent, newBlock.getDefaultState());
}
-}
\ No newline at end of file
+}
diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/pattern/AverageColorPattern.java b/worldedit-core/src/main/java/com/boydti/fawe/object/pattern/AverageColorPattern.java
index 952b6a661..c6ef74ef2 100644
--- a/worldedit-core/src/main/java/com/boydti/fawe/object/pattern/AverageColorPattern.java
+++ b/worldedit-core/src/main/java/com/boydti/fawe/object/pattern/AverageColorPattern.java
@@ -1,6 +1,5 @@
package com.boydti.fawe.object.pattern;
-import com.boydti.fawe.Fawe;
import com.boydti.fawe.util.TextureHolder;
import com.boydti.fawe.util.TextureUtil;
import com.sk89q.worldedit.WorldEditException;
@@ -9,8 +8,6 @@ import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockType;
import java.awt.Color;
-import java.io.IOException;
-import java.io.ObjectInputStream;
public class AverageColorPattern extends AbstractExtentPattern {
private transient TextureHolder holder;
diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/pattern/BiomePattern.java b/worldedit-core/src/main/java/com/boydti/fawe/object/pattern/BiomePattern.java
index 1446feb74..7907dcb5b 100644
--- a/worldedit-core/src/main/java/com/boydti/fawe/object/pattern/BiomePattern.java
+++ b/worldedit-core/src/main/java/com/boydti/fawe/object/pattern/BiomePattern.java
@@ -1,14 +1,10 @@
package com.boydti.fawe.object.pattern;
-import com.boydti.fawe.beta.FilterBlock;
import com.sk89q.worldedit.WorldEditException;
-import com.sk89q.worldedit.world.block.BaseBlock;
-import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.math.BlockVector3;
-import com.sk89q.worldedit.math.MutableBlockVector2;
import com.sk89q.worldedit.world.biome.BiomeType;
-import java.io.IOException;
+import com.sk89q.worldedit.world.block.BaseBlock;
public class BiomePattern extends ExistingPattern {
private final BiomeType biome;
diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/pattern/BufferedPattern.java b/worldedit-core/src/main/java/com/boydti/fawe/object/pattern/BufferedPattern.java
index 9bfafc9c5..222d4553b 100644
--- a/worldedit-core/src/main/java/com/boydti/fawe/object/pattern/BufferedPattern.java
+++ b/worldedit-core/src/main/java/com/boydti/fawe/object/pattern/BufferedPattern.java
@@ -1,20 +1,15 @@
package com.boydti.fawe.object.pattern;
import com.boydti.fawe.Fawe;
-import com.boydti.fawe.beta.FilterBlock;
import com.boydti.fawe.object.FawePlayer;
import com.boydti.fawe.object.collection.LocalBlockVectorSet;
import com.boydti.fawe.util.FaweTimer;
import com.sk89q.worldedit.WorldEditException;
-import com.sk89q.worldedit.world.block.BaseBlock;
-import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.function.pattern.AbstractPattern;
import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.math.BlockVector3;
-import com.sk89q.worldedit.world.block.BlockStateHolder;
-
-import java.io.IOException;
+import com.sk89q.worldedit.world.block.BaseBlock;
import java.util.UUID;
public class BufferedPattern extends AbstractPattern implements ResettablePattern {
diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/pattern/DataPattern.java b/worldedit-core/src/main/java/com/boydti/fawe/object/pattern/DataPattern.java
index 7b3b580d2..01f2d2b34 100644
--- a/worldedit-core/src/main/java/com/boydti/fawe/object/pattern/DataPattern.java
+++ b/worldedit-core/src/main/java/com/boydti/fawe/object/pattern/DataPattern.java
@@ -1,16 +1,13 @@
package com.boydti.fawe.object.pattern;
-import com.boydti.fawe.beta.DelegateFilterBlock;
-import com.boydti.fawe.beta.FilterBlock;
+import static com.google.common.base.Preconditions.checkNotNull;
+
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockState;
-import com.sk89q.worldedit.world.block.BlockStateHolder;
-
-import static com.google.common.base.Preconditions.checkNotNull;
public class DataPattern extends AbstractExtentPattern {
private final Pattern pattern;
diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/pattern/DesaturatePattern.java b/worldedit-core/src/main/java/com/boydti/fawe/object/pattern/DesaturatePattern.java
index fca405051..57440ecd3 100644
--- a/worldedit-core/src/main/java/com/boydti/fawe/object/pattern/DesaturatePattern.java
+++ b/worldedit-core/src/main/java/com/boydti/fawe/object/pattern/DesaturatePattern.java
@@ -1,6 +1,5 @@
package com.boydti.fawe.object.pattern;
-import com.boydti.fawe.Fawe;
import com.boydti.fawe.util.TextureHolder;
import com.boydti.fawe.util.TextureUtil;
import com.sk89q.worldedit.WorldEditException;
@@ -9,8 +8,6 @@ import com.sk89q.worldedit.function.pattern.AbstractPattern;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockType;
-import java.io.IOException;
-import java.io.ObjectInputStream;
public class DesaturatePattern extends AbstractPattern {
private final TextureHolder holder;
@@ -40,8 +37,7 @@ public class DesaturatePattern extends AbstractPattern {
int red = (int) (r + value * (l - r));
int green = (int) (g + value * (l - g));
int blue = (int) (b + value * (l - b));
- int newColor = (alpha << 24) + (red << 16) + (green << 8) + (blue << 0);
- return newColor;
+ return (alpha << 24) + (red << 16) + (green << 8) + (blue << 0);
}
@Override
diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/pattern/ExistingPattern.java b/worldedit-core/src/main/java/com/boydti/fawe/object/pattern/ExistingPattern.java
index 35f5299c9..bd81d765a 100644
--- a/worldedit-core/src/main/java/com/boydti/fawe/object/pattern/ExistingPattern.java
+++ b/worldedit-core/src/main/java/com/boydti/fawe/object/pattern/ExistingPattern.java
@@ -1,10 +1,9 @@
package com.boydti.fawe.object.pattern;
-import com.boydti.fawe.beta.FilterBlock;
import com.sk89q.worldedit.WorldEditException;
-import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.math.BlockVector3;
+import com.sk89q.worldedit.world.block.BaseBlock;
public class ExistingPattern extends AbstractExtentPattern {
public ExistingPattern(Extent extent) {
diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/pattern/ExpressionPattern.java b/worldedit-core/src/main/java/com/boydti/fawe/object/pattern/ExpressionPattern.java
index 36500403b..300da2a5e 100644
--- a/worldedit-core/src/main/java/com/boydti/fawe/object/pattern/ExpressionPattern.java
+++ b/worldedit-core/src/main/java/com/boydti/fawe/object/pattern/ExpressionPattern.java
@@ -1,20 +1,17 @@
package com.boydti.fawe.object.pattern;
-import com.sk89q.worldedit.world.block.BaseBlock;
-import com.sk89q.worldedit.world.block.BlockState;
+import static com.google.common.base.Preconditions.checkNotNull;
+
import com.sk89q.worldedit.function.pattern.AbstractPattern;
import com.sk89q.worldedit.internal.expression.Expression;
import com.sk89q.worldedit.internal.expression.ExpressionException;
import com.sk89q.worldedit.internal.expression.runtime.EvaluationException;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.shape.WorldEditExpressionEnvironment;
+import com.sk89q.worldedit.world.block.BaseBlock;
+import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockTypes;
-import java.io.IOException;
-
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
/**
* A mask that evaluates an expression.
*