mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-12 08:18:35 +00:00
Part 1 of upstream merge and format
This commit is contained in:
@ -22,6 +22,7 @@ package com.sk89q.jnbt;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
@ -19,11 +19,11 @@
|
||||
|
||||
package com.sk89q.jnbt;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
/**
|
||||
* Helps create compound tags.
|
||||
*/
|
||||
|
@ -1,9 +1,10 @@
|
||||
package com.sk89q.jnbt;
|
||||
|
||||
import net.jpountz.lz4.LZ4BlockInputStream;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import net.jpountz.lz4.LZ4BlockInputStream;
|
||||
|
||||
public abstract class CompressedCompoundTag<T> extends CompoundTag {
|
||||
private T in;
|
||||
|
@ -21,7 +21,6 @@ package com.sk89q.jnbt;
|
||||
|
||||
/**
|
||||
* The {@code TAG_Double} tag.
|
||||
*
|
||||
*/
|
||||
public final class DoubleTag extends NumberTag {
|
||||
@Override
|
||||
|
@ -19,14 +19,13 @@
|
||||
|
||||
package com.sk89q.jnbt;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
/**
|
||||
* The {@code TAG_List} tag.
|
||||
*/
|
||||
@ -79,7 +78,7 @@ public final class ListTag extends Tag {
|
||||
|
||||
/**
|
||||
* Get the tag if it exists at the given index.
|
||||
*
|
||||
*
|
||||
* @param index the index
|
||||
* @return the tag or null
|
||||
*/
|
||||
@ -424,7 +423,7 @@ public final class ListTag extends Tag {
|
||||
|
||||
@Override
|
||||
public ArrayList toRaw() {
|
||||
ArrayList raw = new ArrayList<>();
|
||||
ArrayList<Object> raw = new ArrayList<>();
|
||||
if (this.value.isEmpty()) {
|
||||
return raw;
|
||||
}
|
||||
|
@ -19,13 +19,13 @@
|
||||
|
||||
package com.sk89q.jnbt;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
/**
|
||||
* Helps create list tags.
|
||||
*/
|
||||
|
@ -21,7 +21,6 @@ package com.sk89q.jnbt;
|
||||
|
||||
/**
|
||||
* The {@code TAG_Long} tag.
|
||||
*
|
||||
*/
|
||||
public final class LongTag extends NumberTag {
|
||||
@Override
|
||||
|
@ -29,10 +29,19 @@ public final class NBTConstants {
|
||||
|
||||
public static final Charset CHARSET = StandardCharsets.UTF_8;
|
||||
|
||||
public static final int TYPE_END = 0, TYPE_BYTE = 1, TYPE_SHORT = 2,
|
||||
TYPE_INT = 3, TYPE_LONG = 4, TYPE_FLOAT = 5, TYPE_DOUBLE = 6,
|
||||
TYPE_BYTE_ARRAY = 7, TYPE_STRING = 8, TYPE_LIST = 9,
|
||||
TYPE_COMPOUND = 10, TYPE_INT_ARRAY = 11, TYPE_LONG_ARRAY = 12;
|
||||
public static final int TYPE_END = 0;
|
||||
public static final int TYPE_BYTE = 1;
|
||||
public static final int TYPE_SHORT = 2;
|
||||
public static final int TYPE_INT = 3;
|
||||
public static final int TYPE_LONG = 4;
|
||||
public static final int TYPE_FLOAT = 5;
|
||||
public static final int TYPE_DOUBLE = 6;
|
||||
public static final int TYPE_BYTE_ARRAY = 7;
|
||||
public static final int TYPE_STRING = 8;
|
||||
public static final int TYPE_LIST = 9;
|
||||
public static final int TYPE_COMPOUND = 10;
|
||||
public static final int TYPE_INT_ARRAY = 11;
|
||||
public static final int TYPE_LONG_ARRAY = 12;
|
||||
|
||||
/**
|
||||
* Default private constructor.
|
||||
@ -40,44 +49,44 @@ public final class NBTConstants {
|
||||
private NBTConstants() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Convert a type ID to its corresponding {@link Tag} class.
|
||||
*
|
||||
*
|
||||
* @param id type ID
|
||||
* @return tag class
|
||||
* @throws IllegalArgumentException thrown if the tag ID is not valid
|
||||
*/
|
||||
public static Class<? extends Tag> getClassFromType(int id) {
|
||||
switch (id) {
|
||||
case TYPE_END:
|
||||
return EndTag.class;
|
||||
case TYPE_BYTE:
|
||||
return ByteTag.class;
|
||||
case TYPE_SHORT:
|
||||
return ShortTag.class;
|
||||
case TYPE_INT:
|
||||
return IntTag.class;
|
||||
case TYPE_LONG:
|
||||
return LongTag.class;
|
||||
case TYPE_FLOAT:
|
||||
return FloatTag.class;
|
||||
case TYPE_DOUBLE:
|
||||
return DoubleTag.class;
|
||||
case TYPE_BYTE_ARRAY:
|
||||
return ByteArrayTag.class;
|
||||
case TYPE_STRING:
|
||||
return StringTag.class;
|
||||
case TYPE_LIST:
|
||||
return ListTag.class;
|
||||
case TYPE_COMPOUND:
|
||||
return CompoundTag.class;
|
||||
case TYPE_INT_ARRAY:
|
||||
return IntArrayTag.class;
|
||||
case TYPE_LONG_ARRAY:
|
||||
return LongArrayTag.class;
|
||||
default:
|
||||
throw new IllegalArgumentException("Unknown tag type ID of " + id);
|
||||
case TYPE_END:
|
||||
return EndTag.class;
|
||||
case TYPE_BYTE:
|
||||
return ByteTag.class;
|
||||
case TYPE_SHORT:
|
||||
return ShortTag.class;
|
||||
case TYPE_INT:
|
||||
return IntTag.class;
|
||||
case TYPE_LONG:
|
||||
return LongTag.class;
|
||||
case TYPE_FLOAT:
|
||||
return FloatTag.class;
|
||||
case TYPE_DOUBLE:
|
||||
return DoubleTag.class;
|
||||
case TYPE_BYTE_ARRAY:
|
||||
return ByteArrayTag.class;
|
||||
case TYPE_STRING:
|
||||
return StringTag.class;
|
||||
case TYPE_LIST:
|
||||
return ListTag.class;
|
||||
case TYPE_COMPOUND:
|
||||
return CompoundTag.class;
|
||||
case TYPE_INT_ARRAY:
|
||||
return IntArrayTag.class;
|
||||
case TYPE_LONG_ARRAY:
|
||||
return LongArrayTag.class;
|
||||
default:
|
||||
throw new IllegalArgumentException("Unknown tag type ID of " + id);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -36,10 +36,12 @@ import java.util.Map;
|
||||
* This class reads <strong>NBT</strong>, or <strong>Named Binary Tag</strong>
|
||||
* streams, and produces an object graph of subclasses of the {@code Tag}
|
||||
* object.
|
||||
*
|
||||
* <p>The NBT format was created by Markus Persson, and the specification may be
|
||||
* found at <a href="http://www.minecraft.net/docs/NBT.txt">
|
||||
* http://www.minecraft.net/docs/NBT.txt</a>.</p>
|
||||
*
|
||||
* <p>
|
||||
* The NBT format was created by Markus Persson, and the specification may be
|
||||
* found at <a href="https://minecraft.gamepedia.com/NBT_format">
|
||||
* https://minecraft.gamepedia.com/NBT_format</a>.
|
||||
* </p>
|
||||
*/
|
||||
public final class NBTInputStream implements Closeable {
|
||||
|
||||
@ -48,7 +50,7 @@ public final class NBTInputStream implements Closeable {
|
||||
/**
|
||||
* Creates a new {@code NBTInputStream}, which will source its data
|
||||
* from the specified input stream.
|
||||
*
|
||||
*
|
||||
* @param is the input stream
|
||||
*/
|
||||
public NBTInputStream(InputStream is) {
|
||||
@ -61,7 +63,7 @@ public final class NBTInputStream implements Closeable {
|
||||
|
||||
/**
|
||||
* Reads an NBT tag from the stream.
|
||||
*
|
||||
*
|
||||
* @return The tag that was read.
|
||||
* @throws IOException if an I/O error occurs.
|
||||
*/
|
||||
@ -89,7 +91,9 @@ public final class NBTInputStream implements Closeable {
|
||||
public void readNamedTagLazy(StreamDelegate scope) throws IOException {
|
||||
try {
|
||||
int type = is.readByte();
|
||||
if (type == NBTConstants.TYPE_END) return;
|
||||
if (type == NBTConstants.TYPE_END) {
|
||||
return;
|
||||
}
|
||||
|
||||
StreamDelegate child = scope.get(is);
|
||||
if (child != null) {
|
||||
@ -540,7 +544,7 @@ public final class NBTInputStream implements Closeable {
|
||||
case NBTConstants.TYPE_END:
|
||||
if (depth == 0) {
|
||||
throw new IOException(
|
||||
"TAG_End found without a TAG_Compound/TAG_List tag preceding it.");
|
||||
"TAG_End found without a TAG_Compound/TAG_List tag preceding it.");
|
||||
} else {
|
||||
return new EndTag();
|
||||
}
|
||||
@ -569,6 +573,7 @@ public final class NBTInputStream implements Closeable {
|
||||
case NBTConstants.TYPE_LIST:
|
||||
int childType = is.readByte();
|
||||
length = is.readInt();
|
||||
|
||||
List<Tag> tagList = new ArrayList<>();
|
||||
for (int i = 0; i < length; ++i) {
|
||||
Tag tag = readTagPayload(childType, depth + 1);
|
||||
@ -590,6 +595,7 @@ public final class NBTInputStream implements Closeable {
|
||||
tagMap.put(namedTag.getName(), tag);
|
||||
}
|
||||
}
|
||||
|
||||
return new CompoundTag(tagMap);
|
||||
case NBTConstants.TYPE_INT_ARRAY:
|
||||
length = is.readInt();
|
||||
|
@ -21,8 +21,6 @@ package com.sk89q.jnbt;
|
||||
|
||||
import com.boydti.fawe.object.io.LittleEndianOutputStream;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import java.io.Closeable;
|
||||
import java.io.DataOutput;
|
||||
import java.io.DataOutputStream;
|
||||
@ -32,13 +30,17 @@ import java.io.OutputStream;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
/**
|
||||
* This class writes <strong>NBT</strong>, or <strong>Named Binary Tag</strong>
|
||||
* {@code Tag} objects to an underlying {@code OutputStream}.
|
||||
*
|
||||
* <p>The NBT format was created by Markus Persson, and the specification may be
|
||||
* found at <a href="http://www.minecraft.net/docs/NBT.txt">
|
||||
* http://www.minecraft.net/docs/NBT.txt</a>.</p>
|
||||
* <p>
|
||||
* The NBT format was created by Markus Persson, and the specification may be
|
||||
* found at <a href="https://minecraft.gamepedia.com/NBT_format">
|
||||
* https://minecraft.gamepedia.com/NBT_format</a>.
|
||||
* </p>
|
||||
*/
|
||||
public final class NBTOutputStream extends OutputStream implements Closeable, DataOutput {
|
||||
|
||||
@ -167,12 +169,12 @@ public final class NBTOutputStream extends OutputStream implements Closeable, Da
|
||||
}
|
||||
|
||||
public void writeNamedTagName(String name, int type) throws IOException {
|
||||
// byte[] nameBytes = name.getBytes(NBTConstants.CHARSET);
|
||||
// byte[] nameBytes = name.getBytes(NBTConstants.CHARSET);
|
||||
|
||||
os.writeByte(type);
|
||||
os.writeUTF(name);
|
||||
// os.writeShort(nameBytes.length);
|
||||
// os.write(nameBytes);
|
||||
// os.writeShort(nameBytes.length);
|
||||
// os.write(nameBytes);
|
||||
}
|
||||
|
||||
public void writeLazyCompoundTag(String name, LazyWrite next) throws IOException {
|
||||
|
@ -19,13 +19,13 @@
|
||||
|
||||
package com.sk89q.jnbt;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.world.storage.InvalidFormatException;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
/**
|
||||
* A class which contains NBT-related utility methods.
|
||||
*
|
||||
@ -126,34 +126,34 @@ public final class NBTUtils {
|
||||
*/
|
||||
public static Class<? extends Tag> getTypeClass(int type) {
|
||||
switch (type) {
|
||||
case NBTConstants.TYPE_END:
|
||||
return EndTag.class;
|
||||
case NBTConstants.TYPE_BYTE:
|
||||
return ByteTag.class;
|
||||
case NBTConstants.TYPE_SHORT:
|
||||
return ShortTag.class;
|
||||
case NBTConstants.TYPE_INT:
|
||||
return IntTag.class;
|
||||
case NBTConstants.TYPE_LONG:
|
||||
return LongTag.class;
|
||||
case NBTConstants.TYPE_FLOAT:
|
||||
return FloatTag.class;
|
||||
case NBTConstants.TYPE_DOUBLE:
|
||||
return DoubleTag.class;
|
||||
case NBTConstants.TYPE_BYTE_ARRAY:
|
||||
return ByteArrayTag.class;
|
||||
case NBTConstants.TYPE_STRING:
|
||||
return StringTag.class;
|
||||
case NBTConstants.TYPE_LIST:
|
||||
return ListTag.class;
|
||||
case NBTConstants.TYPE_COMPOUND:
|
||||
return CompoundTag.class;
|
||||
case NBTConstants.TYPE_INT_ARRAY:
|
||||
return IntArrayTag.class;
|
||||
case NBTConstants.TYPE_LONG_ARRAY:
|
||||
return LongArrayTag.class;
|
||||
default:
|
||||
throw new IllegalArgumentException("Invalid tag type : " + type
|
||||
case NBTConstants.TYPE_END:
|
||||
return EndTag.class;
|
||||
case NBTConstants.TYPE_BYTE:
|
||||
return ByteTag.class;
|
||||
case NBTConstants.TYPE_SHORT:
|
||||
return ShortTag.class;
|
||||
case NBTConstants.TYPE_INT:
|
||||
return IntTag.class;
|
||||
case NBTConstants.TYPE_LONG:
|
||||
return LongTag.class;
|
||||
case NBTConstants.TYPE_FLOAT:
|
||||
return FloatTag.class;
|
||||
case NBTConstants.TYPE_DOUBLE:
|
||||
return DoubleTag.class;
|
||||
case NBTConstants.TYPE_BYTE_ARRAY:
|
||||
return ByteArrayTag.class;
|
||||
case NBTConstants.TYPE_STRING:
|
||||
return StringTag.class;
|
||||
case NBTConstants.TYPE_LIST:
|
||||
return ListTag.class;
|
||||
case NBTConstants.TYPE_COMPOUND:
|
||||
return CompoundTag.class;
|
||||
case NBTConstants.TYPE_INT_ARRAY:
|
||||
return IntArrayTag.class;
|
||||
case NBTConstants.TYPE_LONG_ARRAY:
|
||||
return LongArrayTag.class;
|
||||
default:
|
||||
throw new IllegalArgumentException("Invalid tag type : " + type
|
||||
+ ".");
|
||||
}
|
||||
}
|
||||
@ -179,7 +179,7 @@ public final class NBTUtils {
|
||||
* @param key the key to look for
|
||||
* @param expected the expected NBT class type
|
||||
* @return child tag
|
||||
* @throws InvalidFormatException
|
||||
* @throws InvalidFormatException if the format of the items is invalid
|
||||
*/
|
||||
public static <T extends Tag> T getChildTag(Map<String, Tag> items, String key, Class<T> expected) throws InvalidFormatException {
|
||||
if (!items.containsKey(key)) {
|
||||
|
@ -19,14 +19,13 @@
|
||||
|
||||
package com.sk89q.minecraft.util.commands;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.ListIterator;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
public class CommandException extends Exception {
|
||||
|
||||
private List<String> commandStack = new ArrayList<>();
|
||||
|
@ -149,7 +149,7 @@ public final class StringUtil {
|
||||
* @param initialIndex the initial index to start form
|
||||
* @return a new string
|
||||
*/
|
||||
public static String joinString(Collection<?> str, String delimiter,int initialIndex) {
|
||||
public static String joinString(Collection<?> str, String delimiter, int initialIndex) {
|
||||
if (str.isEmpty()) {
|
||||
return "";
|
||||
}
|
||||
@ -310,8 +310,9 @@ public final class StringUtil {
|
||||
return parseListInQuotes(input, delimiter, quoteOpen, quoteClose, false);
|
||||
}
|
||||
|
||||
public static List<String> parseListInQuotes(String[] input, char delimiter, char quoteOpen, char quoteClose, boolean appendLeftover) {
|
||||
List<String> parsableBlocks = new ArrayList<>();
|
||||
public static List<String> parseListInQuotes(String[] input, char delimiter, char quoteOpen,
|
||||
char quoteClose, boolean appendLeftover) {
|
||||
List<String> parsableBlocks = new ArrayList<>();
|
||||
StringBuilder buffer = new StringBuilder();
|
||||
for (String split : input) {
|
||||
if (split.indexOf(quoteOpen) != -1 && split.indexOf(quoteClose) == -1) {
|
||||
|
@ -28,7 +28,6 @@ import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
@ -62,7 +61,7 @@ public class YAMLNode {
|
||||
|
||||
/**
|
||||
* Gets a property at a location. This will either return an Object
|
||||
* or null, with null meaning no configuration value exists at
|
||||
* or null, with null meaning that no configuration value exists at
|
||||
* that location. This could potentially return a default value (not yet
|
||||
* implemented) as defined by a plugin, if this is a plugin-tied
|
||||
* configuration.
|
||||
@ -274,7 +273,9 @@ public class YAMLNode {
|
||||
public Vector3 getVector(String path, Vector3 def) {
|
||||
Vector3 v = getVector(path);
|
||||
if (v == null) {
|
||||
if (writeDefaults) setProperty(path, def);
|
||||
if (writeDefaults) {
|
||||
setProperty(path, def);
|
||||
}
|
||||
return def;
|
||||
}
|
||||
return v;
|
||||
@ -292,7 +293,9 @@ public class YAMLNode {
|
||||
public String getString(String path, String def) {
|
||||
String o = getString(path);
|
||||
if (o == null) {
|
||||
if (writeDefaults) setProperty(path, def);
|
||||
if (writeDefaults) {
|
||||
setProperty(path, def);
|
||||
}
|
||||
return def;
|
||||
}
|
||||
return o;
|
||||
@ -329,7 +332,9 @@ public class YAMLNode {
|
||||
public int getInt(String path, int def) {
|
||||
Integer o = castInt(getProperty(path));
|
||||
if (o == null) {
|
||||
if (writeDefaults) setProperty(path, def);
|
||||
if (writeDefaults) {
|
||||
setProperty(path, def);
|
||||
}
|
||||
return def;
|
||||
} else {
|
||||
return o;
|
||||
@ -367,7 +372,9 @@ public class YAMLNode {
|
||||
public double getDouble(String path, double def) {
|
||||
Double o = castDouble(getProperty(path));
|
||||
if (o == null) {
|
||||
if (writeDefaults) setProperty(path, def);
|
||||
if (writeDefaults) {
|
||||
setProperty(path, def);
|
||||
}
|
||||
return def;
|
||||
} else {
|
||||
return o;
|
||||
@ -403,7 +410,9 @@ public class YAMLNode {
|
||||
public boolean getBoolean(String path, boolean def) {
|
||||
Boolean o = castBoolean(getProperty(path));
|
||||
if (o == null) {
|
||||
if (writeDefaults) setProperty(path, def);
|
||||
if (writeDefaults) {
|
||||
setProperty(path, def);
|
||||
}
|
||||
return def;
|
||||
} else {
|
||||
return o;
|
||||
@ -419,7 +428,9 @@ public class YAMLNode {
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<String> getKeys(String path) {
|
||||
if (path == null) return new ArrayList<>(root.keySet());
|
||||
if (path == null) {
|
||||
return new ArrayList<>(root.keySet());
|
||||
}
|
||||
Object o = getProperty(path);
|
||||
if (o == null) {
|
||||
return null;
|
||||
@ -464,7 +475,9 @@ public class YAMLNode {
|
||||
public List<String> getStringList(String path, List<String> def) {
|
||||
List<Object> raw = getList(path);
|
||||
if (raw == null) {
|
||||
if (writeDefaults && def != null) setProperty(path, def);
|
||||
if (writeDefaults && def != null) {
|
||||
setProperty(path, def);
|
||||
}
|
||||
return def != null ? def : new ArrayList<>();
|
||||
}
|
||||
|
||||
@ -494,7 +507,9 @@ public class YAMLNode {
|
||||
public List<Integer> getIntList(String path, List<Integer> def) {
|
||||
List<Object> raw = getList(path);
|
||||
if (raw == null) {
|
||||
if (writeDefaults && def != null) setProperty(path, def);
|
||||
if (writeDefaults && def != null) {
|
||||
setProperty(path, def);
|
||||
}
|
||||
return def != null ? def : new ArrayList<>();
|
||||
}
|
||||
|
||||
@ -523,7 +538,9 @@ public class YAMLNode {
|
||||
public List<Double> getDoubleList(String path, List<Double> def) {
|
||||
List<Object> raw = getList(path);
|
||||
if (raw == null) {
|
||||
if (writeDefaults && def != null) setProperty(path, def);
|
||||
if (writeDefaults && def != null) {
|
||||
setProperty(path, def);
|
||||
}
|
||||
return def != null ? def : new ArrayList<>();
|
||||
}
|
||||
|
||||
@ -552,7 +569,9 @@ public class YAMLNode {
|
||||
public List<Boolean> getBooleanList(String path, List<Boolean> def) {
|
||||
List<Object> raw = getList(path);
|
||||
if (raw == null) {
|
||||
if (writeDefaults && def != null) setProperty(path, def);
|
||||
if (writeDefaults && def != null) {
|
||||
setProperty(path, def);
|
||||
}
|
||||
return def != null ? def : new ArrayList<>();
|
||||
}
|
||||
|
||||
@ -672,7 +691,9 @@ public class YAMLNode {
|
||||
public List<YAMLNode> getNodeList(String path, List<YAMLNode> def) {
|
||||
List<Object> raw = getList(path);
|
||||
if (raw == null) {
|
||||
if (writeDefaults && def != null) setProperty(path, def);
|
||||
if (writeDefaults && def != null) {
|
||||
setProperty(path, def);
|
||||
}
|
||||
return def != null ? def : new ArrayList<>();
|
||||
}
|
||||
|
||||
|
@ -110,10 +110,10 @@ public class YAMLProcessor extends YAMLNode {
|
||||
* @throws java.io.IOException on load error
|
||||
*/
|
||||
public void load() throws IOException {
|
||||
|
||||
try (InputStream stream = getInputStream()) {
|
||||
if (stream == null)
|
||||
if (stream == null) {
|
||||
throw new IOException("Stream is null!");
|
||||
}
|
||||
read(yaml.load(new UnicodeReader(stream)));
|
||||
} catch (YAMLProcessorException e) {
|
||||
root = new LinkedHashMap<>();
|
||||
@ -172,8 +172,9 @@ public class YAMLProcessor extends YAMLNode {
|
||||
parent.mkdirs();
|
||||
}
|
||||
try (OutputStream stream = getOutputStream()) {
|
||||
if (stream == null)
|
||||
if (stream == null) {
|
||||
return false;
|
||||
}
|
||||
OutputStreamWriter writer = new OutputStreamWriter(stream, StandardCharsets.UTF_8);
|
||||
if (header != null) {
|
||||
writer.append(header);
|
||||
@ -247,7 +248,7 @@ public class YAMLProcessor extends YAMLNode {
|
||||
*
|
||||
* @param key the property key
|
||||
* @param comment the comment. May be {@code null}, in which case the comment
|
||||
* is removed.
|
||||
* is removed.
|
||||
*/
|
||||
public void setComment(String key, String... comment) {
|
||||
if (comment != null && comment.length > 0) {
|
||||
@ -285,10 +286,11 @@ public class YAMLProcessor extends YAMLNode {
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns an empty ConfigurationNode for using as a
|
||||
* default in methods that select a node from a node list.
|
||||
* Get an empty ConfigurationNode for using as a default in methods that
|
||||
* select a node from a node list.
|
||||
*
|
||||
* @param writeDefaults true to write default values when a property is requested that doesn't exist
|
||||
* @param writeDefaults true to write default values when a property is
|
||||
* requested that doesn't exist
|
||||
* @return a node
|
||||
*/
|
||||
public static YAMLNode getEmptyNode(boolean writeDefaults) {
|
||||
|
@ -19,12 +19,6 @@
|
||||
|
||||
package com.sk89q.worldedit;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static com.sk89q.worldedit.regions.Regions.asFlatRegion;
|
||||
import static com.sk89q.worldedit.regions.Regions.maximumBlockY;
|
||||
import static com.sk89q.worldedit.regions.Regions.minimumBlockY;
|
||||
|
||||
import com.boydti.fawe.FaweCache;
|
||||
import com.boydti.fawe.config.Caption;
|
||||
import com.boydti.fawe.config.Settings;
|
||||
@ -132,6 +126,11 @@ import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
import com.sk89q.worldedit.world.registry.LegacyMapper;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
@ -142,10 +141,12 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static com.sk89q.worldedit.regions.Regions.asFlatRegion;
|
||||
import static com.sk89q.worldedit.regions.Regions.maximumBlockY;
|
||||
import static com.sk89q.worldedit.regions.Regions.minimumBlockY;
|
||||
|
||||
/**
|
||||
* An {@link Extent} that handles history, {@link BlockBag}s, change limits,
|
||||
|
@ -19,14 +19,14 @@
|
||||
|
||||
package com.sk89q.worldedit;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.sk89q.worldedit.event.extent.EditSessionEvent;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.extent.inventory.BlockBag;
|
||||
import com.sk89q.worldedit.util.eventbus.EventBus;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
/**
|
||||
* Creates new {@link EditSession}s. To get an instance of this factory,
|
||||
* use {@link WorldEdit#getEditSessionFactory()}.
|
||||
|
@ -29,7 +29,6 @@ import com.sk89q.worldedit.util.io.file.ArchiveNioSupports;
|
||||
import com.sk89q.worldedit.util.logging.LogFormat;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
import com.sk89q.worldedit.world.registry.LegacyMapper;
|
||||
import com.sk89q.worldedit.world.snapshot.SnapshotRepository;
|
||||
import com.sk89q.worldedit.world.snapshot.experimental.SnapshotDatabase;
|
||||
|
@ -36,7 +36,6 @@ import com.boydti.fawe.util.StringMan;
|
||||
import com.boydti.fawe.util.TextureHolder;
|
||||
import com.boydti.fawe.util.TextureUtil;
|
||||
import com.boydti.fawe.wrappers.WorldWrapper;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.sk89q.jchronic.Chronic;
|
||||
import com.sk89q.jchronic.Options;
|
||||
import com.sk89q.jchronic.utils.Span;
|
||||
@ -81,7 +80,6 @@ import com.sk89q.worldedit.world.item.ItemTypes;
|
||||
import com.sk89q.worldedit.world.snapshot.experimental.Snapshot;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
|
@ -19,12 +19,12 @@
|
||||
|
||||
package com.sk89q.worldedit;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
import static com.sk89q.worldedit.event.platform.Interaction.HIT;
|
||||
import static com.sk89q.worldedit.event.platform.Interaction.OPEN;
|
||||
|
||||
import com.google.common.base.Throwables;
|
||||
import com.google.common.collect.HashMultimap;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.SetMultimap;
|
||||
import com.google.common.util.concurrent.ListeningExecutorService;
|
||||
import com.google.common.util.concurrent.MoreExecutors;
|
||||
import com.sk89q.worldedit.blocks.BaseItem;
|
||||
@ -44,6 +44,7 @@ import com.sk89q.worldedit.extent.inventory.BlockBag;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.internal.expression.Expression;
|
||||
import com.sk89q.worldedit.internal.expression.invoke.ReturnException;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.scripting.CraftScriptContext;
|
||||
import com.sk89q.worldedit.scripting.CraftScriptEngine;
|
||||
@ -68,6 +69,9 @@ import com.sk89q.worldedit.world.block.BlockType;
|
||||
import com.sk89q.worldedit.world.registry.BundledBlockData;
|
||||
import com.sk89q.worldedit.world.registry.BundledItemData;
|
||||
import com.sk89q.worldedit.world.registry.LegacyMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
@ -84,8 +88,9 @@ import java.util.Map;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.script.ScriptException;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
import static com.sk89q.worldedit.event.platform.Interaction.HIT;
|
||||
import static com.sk89q.worldedit.event.platform.Interaction.OPEN;
|
||||
|
||||
/**
|
||||
* The entry point and container for a working implementation of WorldEdit.
|
||||
@ -111,8 +116,7 @@ public final class WorldEdit {
|
||||
private final PlatformManager platformManager = new PlatformManager(this);
|
||||
private final EditSessionFactory editSessionFactory = new EditSessionFactory.EditSessionFactoryImpl(eventBus);
|
||||
private final SessionManager sessions = new SessionManager(this);
|
||||
private final ListeningExecutorService executorService = MoreExecutors.listeningDecorator(
|
||||
EvenMoreExecutors.newBoundedCachedThreadPool(0, 1, 20, "WorldEdit Task Executor - %s"));
|
||||
private final ListeningExecutorService executorService = MoreExecutors.listeningDecorator(EvenMoreExecutors.newBoundedCachedThreadPool(0, 1, 20, "WorldEdit Task Executor - %s"));
|
||||
private final Supervisor supervisor = new SimpleSupervisor();
|
||||
private final TranslationManager translationManager = new TranslationManager(this);
|
||||
|
||||
@ -288,7 +292,9 @@ public final class WorldEdit {
|
||||
* @throws FilenameException thrown if the filename is invalid
|
||||
*/
|
||||
private File getSafeFile(@Nullable Actor actor, File dir, String filename, String defaultExt, String[] extensions, boolean isSave) throws FilenameException {
|
||||
if (extensions != null && (extensions.length == 1 && extensions[0] == null)) extensions = null;
|
||||
if (extensions != null && (extensions.length == 1 && extensions[0] == null)) {
|
||||
extensions = null;
|
||||
}
|
||||
|
||||
File f;
|
||||
|
||||
@ -388,7 +394,7 @@ public final class WorldEdit {
|
||||
* Checks to see if the specified radius is within bounds.
|
||||
*
|
||||
* @param radius the radius
|
||||
* @throws MaxRadiusException
|
||||
* @throws MaxRadiusException if the radius is bigger than the configured radius
|
||||
*/
|
||||
public void checkMaxRadius(double radius) throws MaxRadiusException {
|
||||
if (getConfiguration().maxRadius > 0 && radius > getConfiguration().maxRadius) {
|
||||
@ -400,7 +406,7 @@ public final class WorldEdit {
|
||||
* Checks to see if the specified brush radius is within bounds.
|
||||
*
|
||||
* @param radius the radius
|
||||
* @throws MaxBrushRadiusException
|
||||
* @throws MaxBrushRadiusException if the radius is bigger than the configured radius
|
||||
*/
|
||||
public void checkMaxBrushRadius(double radius) throws MaxBrushRadiusException {
|
||||
if (getConfiguration().maxBrushRadius > 0 && radius > getConfiguration().maxBrushRadius) {
|
||||
@ -474,6 +480,38 @@ public final class WorldEdit {
|
||||
throw new UnknownDirectionException(dir.name());
|
||||
}
|
||||
|
||||
private static final Map<String, Direction> NAME_TO_DIRECTION_MAP;
|
||||
|
||||
static {
|
||||
SetMultimap<Direction, String> directionNames = HashMultimap.create();
|
||||
for (Direction direction : Direction.valuesOf(
|
||||
Direction.Flag.CARDINAL | Direction.Flag.UPRIGHT
|
||||
)) {
|
||||
String name = direction.name().toLowerCase(Locale.ROOT);
|
||||
for (int i = 1; i <= name.length(); i++) {
|
||||
directionNames.put(direction, name.substring(0, i));
|
||||
}
|
||||
}
|
||||
ImmutableMap.Builder<String, Direction> nameToDirectionMap = ImmutableMap.builder();
|
||||
for (Direction direction : directionNames.keySet()) {
|
||||
directionNames.get(direction).forEach(name ->
|
||||
nameToDirectionMap.put(name, direction)
|
||||
);
|
||||
}
|
||||
for (Direction direction : ImmutableList.of(Direction.NORTH, Direction.SOUTH)) {
|
||||
for (Direction diagonal : ImmutableList.of(Direction.WEST, Direction.EAST)) {
|
||||
for (String dirName : directionNames.get(direction)) {
|
||||
for (String diagName : directionNames.get(diagonal)) {
|
||||
nameToDirectionMap.put(dirName + diagName, Direction.valueOf(
|
||||
direction.name() + diagonal.name()
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
NAME_TO_DIRECTION_MAP = nameToDirectionMap.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the direction vector for a player's direction.
|
||||
*
|
||||
@ -483,68 +521,32 @@ public final class WorldEdit {
|
||||
* @throws UnknownDirectionException thrown if the direction is not known, or a relative direction is used with null player
|
||||
*/
|
||||
private Direction getPlayerDirection(@Nullable Player player, String dirStr) throws UnknownDirectionException {
|
||||
final Direction dir;
|
||||
|
||||
switch (dirStr.charAt(0)) {
|
||||
case 'w':
|
||||
dir = Direction.WEST;
|
||||
break;
|
||||
|
||||
case 'e':
|
||||
dir = Direction.EAST;
|
||||
break;
|
||||
|
||||
case 's':
|
||||
if (dirStr.indexOf('w') > 0) {
|
||||
return Direction.SOUTHWEST;
|
||||
}
|
||||
|
||||
if (dirStr.indexOf('e') > 0) {
|
||||
return Direction.SOUTHEAST;
|
||||
}
|
||||
dir = Direction.SOUTH;
|
||||
break;
|
||||
|
||||
case 'n':
|
||||
if (dirStr.indexOf('w') > 0) {
|
||||
return Direction.NORTHWEST;
|
||||
}
|
||||
|
||||
if (dirStr.indexOf('e') > 0) {
|
||||
return Direction.NORTHEAST;
|
||||
}
|
||||
dir = Direction.NORTH;
|
||||
break;
|
||||
|
||||
case 'u':
|
||||
dir = Direction.UP;
|
||||
break;
|
||||
|
||||
case 'd':
|
||||
dir = Direction.DOWN;
|
||||
break;
|
||||
|
||||
case 'm': // me
|
||||
case 'f': // forward
|
||||
dir = getDirectionRelative(player, 0);
|
||||
break;
|
||||
|
||||
case 'b': // back
|
||||
dir = getDirectionRelative(player, 180);
|
||||
break;
|
||||
|
||||
case 'l': // left
|
||||
dir = getDirectionRelative(player, -90);
|
||||
break;
|
||||
|
||||
case 'r': // right
|
||||
dir = getDirectionRelative(player, 90);
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new UnknownDirectionException(dirStr);
|
||||
Direction byName = NAME_TO_DIRECTION_MAP.get(dirStr);
|
||||
if (byName != null) {
|
||||
return byName;
|
||||
}
|
||||
switch (dirStr) {
|
||||
case "m":
|
||||
case "me":
|
||||
case "f":
|
||||
case "forward":
|
||||
return getDirectionRelative(player, 0);
|
||||
|
||||
case "b":
|
||||
case "back":
|
||||
return getDirectionRelative(player, 180);
|
||||
|
||||
case "l":
|
||||
case "left":
|
||||
return getDirectionRelative(player, -90);
|
||||
|
||||
case "r":
|
||||
case "right":
|
||||
return getDirectionRelative(player, 90);
|
||||
|
||||
default:
|
||||
throw new UnknownDirectionException(dirStr);
|
||||
}
|
||||
return dir;
|
||||
}
|
||||
|
||||
private Direction getDirectionRelative(Player player, int yawOffset) throws UnknownDirectionException {
|
||||
@ -622,8 +624,21 @@ public final class WorldEdit {
|
||||
* @param clicked the clicked block
|
||||
* @return false if you want the action to go through
|
||||
*/
|
||||
@Deprecated
|
||||
public boolean handleBlockRightClick(Player player, Location clicked) {
|
||||
BlockInteractEvent event = new BlockInteractEvent(player, clicked, OPEN);
|
||||
return handleBlockRightClick(player, clicked, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called on right click.
|
||||
*
|
||||
* @param player the player
|
||||
* @param clicked the clicked block
|
||||
* @param face The clicked face
|
||||
* @return false if you want the action to go through
|
||||
*/
|
||||
public boolean handleBlockRightClick(Player player, Location clicked, @Nullable Direction face) {
|
||||
BlockInteractEvent event = new BlockInteractEvent(player, clicked, face, OPEN);
|
||||
getEventBus().post(event);
|
||||
return event.isCancelled();
|
||||
}
|
||||
@ -635,8 +650,21 @@ public final class WorldEdit {
|
||||
* @param clicked the clicked block
|
||||
* @return false if you want the action to go through
|
||||
*/
|
||||
@Deprecated
|
||||
public boolean handleBlockLeftClick(Player player, Location clicked) {
|
||||
BlockInteractEvent event = new BlockInteractEvent(player, clicked, HIT);
|
||||
return handleBlockLeftClick(player, clicked, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called on left click.
|
||||
*
|
||||
* @param player the player
|
||||
* @param clicked the clicked block
|
||||
* @param face The clicked face
|
||||
* @return false if you want the action to go through
|
||||
*/
|
||||
public boolean handleBlockLeftClick(Player player, Location clicked, @Nullable Direction face) {
|
||||
BlockInteractEvent event = new BlockInteractEvent(player, clicked, face, HIT);
|
||||
getEventBus().post(event);
|
||||
return event.isCancelled();
|
||||
}
|
||||
@ -708,8 +736,11 @@ public final class WorldEdit {
|
||||
try {
|
||||
engine.evaluate(script, filename, vars);
|
||||
} catch (ScriptException e) {
|
||||
player.printError(TranslatableComponent.of("worldedit.script.failed", TextComponent.of(e.getMessage(), TextColor.WHITE)));
|
||||
logger.warn("Failed to execute script", e);
|
||||
// non-exceptional return check
|
||||
if (!(Throwables.getRootCause(e) instanceof ReturnException)) {
|
||||
player.printError(TranslatableComponent.of("worldedit.script.failed", TextComponent.of(e.getMessage(), TextColor.WHITE)));
|
||||
logger.warn("Failed to execute script", e);
|
||||
}
|
||||
} catch (NumberFormatException | WorldEditException e) {
|
||||
throw e;
|
||||
} catch (Throwable e) {
|
||||
|
@ -19,15 +19,37 @@
|
||||
|
||||
package com.sk89q.worldedit;
|
||||
|
||||
import com.sk89q.worldedit.util.formatting.WorldEditText;
|
||||
import com.sk89q.worldedit.util.formatting.text.Component;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* Parent for all WorldEdit exceptions.
|
||||
*/
|
||||
public abstract class WorldEditException extends RuntimeException {
|
||||
|
||||
private final Component message;
|
||||
|
||||
/**
|
||||
* Create a new exception.
|
||||
*/
|
||||
protected WorldEditException() {
|
||||
this.message = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new exception with a message.
|
||||
*
|
||||
* @param message the message
|
||||
* @deprecated Use component version
|
||||
*/
|
||||
@Deprecated
|
||||
protected WorldEditException(String message) {
|
||||
super(message);
|
||||
|
||||
this.message = TextComponent.of(message);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -35,8 +57,24 @@ public abstract class WorldEditException extends RuntimeException {
|
||||
*
|
||||
* @param message the message
|
||||
*/
|
||||
protected WorldEditException(String message) {
|
||||
super(message);
|
||||
protected WorldEditException(Component message) {
|
||||
super(WorldEditText.reduceToText(message, Locale.getDefault()));
|
||||
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new exception with a message and a cause.
|
||||
*
|
||||
* @param message the message
|
||||
* @param cause the cause
|
||||
* @deprecated Use component version
|
||||
*/
|
||||
@Deprecated
|
||||
protected WorldEditException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
|
||||
this.message = TextComponent.of(message);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -45,8 +83,10 @@ public abstract class WorldEditException extends RuntimeException {
|
||||
* @param message the message
|
||||
* @param cause the cause
|
||||
*/
|
||||
protected WorldEditException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
protected WorldEditException(Component message, Throwable cause) {
|
||||
super(WorldEditText.reduceToText(message, Locale.getDefault()), cause);
|
||||
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -56,5 +96,16 @@ public abstract class WorldEditException extends RuntimeException {
|
||||
*/
|
||||
protected WorldEditException(Throwable cause) {
|
||||
super(cause);
|
||||
|
||||
this.message = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the message of this exception as a rich text component.
|
||||
*
|
||||
* @return The rich message
|
||||
*/
|
||||
public Component getRichMessage() {
|
||||
return this.message;
|
||||
}
|
||||
}
|
||||
|
@ -19,7 +19,6 @@
|
||||
|
||||
package com.sk89q.worldedit;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.IOException;
|
||||
import java.io.UncheckedIOException;
|
||||
import java.net.JarURLConnection;
|
||||
@ -27,6 +26,7 @@ import java.net.URL;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.jar.Attributes;
|
||||
import java.util.jar.Manifest;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* Represents WorldEdit info from the MANIFEST.MF file.
|
||||
|
@ -19,13 +19,14 @@
|
||||
|
||||
package com.sk89q.worldedit.blocks;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.worldedit.world.NbtValued;
|
||||
import com.sk89q.worldedit.world.item.ItemType;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
/**
|
||||
* Represents an item, without an amount value. See {@link BaseItemStack}
|
||||
* for an instance with stack amount information.
|
||||
|
@ -65,13 +65,17 @@ public final class Blocks {
|
||||
states.forEach((key, value) -> {
|
||||
@SuppressWarnings("unchecked")
|
||||
Property<Object> prop = (Property<Object>) existing.get(key);
|
||||
if (prop == null) return;
|
||||
if (prop == null) {
|
||||
return;
|
||||
}
|
||||
Object val = null;
|
||||
try {
|
||||
val = prop.getValueFor(value);
|
||||
} catch (IllegalArgumentException ignored) {
|
||||
}
|
||||
if (val == null) return;
|
||||
if (val == null) {
|
||||
return;
|
||||
}
|
||||
newMap.put(prop, val);
|
||||
});
|
||||
return newMap;
|
||||
|
@ -19,9 +19,6 @@
|
||||
|
||||
package com.sk89q.worldedit.command;
|
||||
|
||||
import static java.util.Objects.requireNonNull;
|
||||
import static org.enginehub.piston.part.CommandParts.arg;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
@ -47,7 +44,6 @@ import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
|
||||
import com.sk89q.worldedit.util.formatting.text.format.TextDecoration;
|
||||
import java.util.stream.Collectors;
|
||||
import org.enginehub.piston.CommandManager;
|
||||
import org.enginehub.piston.CommandManagerService;
|
||||
import org.enginehub.piston.CommandParameters;
|
||||
@ -58,6 +54,11 @@ import org.enginehub.piston.inject.Key;
|
||||
import org.enginehub.piston.part.CommandArgument;
|
||||
import org.enginehub.piston.part.SubCommandPart;
|
||||
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static java.util.Objects.requireNonNull;
|
||||
import static org.enginehub.piston.part.CommandParts.arg;
|
||||
|
||||
@CommandContainer(superTypes = CommandPermissionsConditionGenerator.Registration.class)
|
||||
public class ApplyBrushCommands {
|
||||
|
||||
|
@ -19,17 +19,14 @@
|
||||
|
||||
package com.sk89q.worldedit.command;
|
||||
|
||||
import static com.sk89q.worldedit.command.util.Logging.LogMode.REGION;
|
||||
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.command.util.CommandPermissions;
|
||||
import com.sk89q.worldedit.command.util.WorldEditAsyncCommandBuilder;
|
||||
import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator;
|
||||
import com.sk89q.worldedit.command.util.Logging;
|
||||
import com.sk89q.worldedit.command.util.WorldEditAsyncCommandBuilder;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.extension.platform.Capability;
|
||||
@ -51,21 +48,25 @@ import com.sk89q.worldedit.util.formatting.component.PaginationBox;
|
||||
import com.sk89q.worldedit.util.formatting.component.TextUtils;
|
||||
import com.sk89q.worldedit.util.formatting.text.Component;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.event.HoverEvent;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.biome.BiomeData;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import com.sk89q.worldedit.world.registry.BiomeRegistry;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import org.enginehub.piston.annotation.Command;
|
||||
import org.enginehub.piston.annotation.CommandContainer;
|
||||
import java.util.List;
|
||||
import org.enginehub.piston.annotation.param.Arg;
|
||||
import org.enginehub.piston.annotation.param.ArgFlag;
|
||||
import org.enginehub.piston.annotation.param.Switch;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.sk89q.worldedit.command.util.Logging.LogMode.REGION;
|
||||
|
||||
/**
|
||||
* Implements biome-related commands such as "/biomelist".
|
||||
*/
|
||||
@ -88,30 +89,29 @@ public class BiomeCommands {
|
||||
@ArgFlag(name = 'p', desc = "Page number.", def = "1")
|
||||
int page) {
|
||||
WorldEditAsyncCommandBuilder.createAndSendMessage(actor, () -> {
|
||||
BiomeRegistry biomeRegistry = WorldEdit.getInstance().getPlatformManager()
|
||||
.queryCapability(Capability.GAME_HOOKS).getRegistries().getBiomeRegistry();
|
||||
BiomeRegistry biomeRegistry =
|
||||
WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.GAME_HOOKS)
|
||||
.getRegistries().getBiomeRegistry();
|
||||
|
||||
PaginationBox paginationBox = PaginationBox.fromStrings("Available Biomes", "/biomelist -p %page%",
|
||||
BiomeType.REGISTRY.values().stream()
|
||||
.map(biomeType -> {
|
||||
String id = biomeType.getId();
|
||||
final BiomeData data = biomeRegistry.getData(biomeType);
|
||||
if (data != null) {
|
||||
String name = data.getName();
|
||||
return id + " (" + name + ")";
|
||||
} else {
|
||||
return id;
|
||||
}
|
||||
})
|
||||
.collect(Collectors.toList()));
|
||||
return paginationBox.create(page);
|
||||
PaginationBox paginationBox = PaginationBox
|
||||
.fromStrings("Available Biomes", "/biomelist -p %page%",
|
||||
BiomeType.REGISTRY.values().stream().map(biomeType -> {
|
||||
String id = biomeType.getId();
|
||||
final BiomeData data = biomeRegistry.getData(biomeType);
|
||||
if (data != null) {
|
||||
String name = data.getName();
|
||||
return id + " (" + name + ")";
|
||||
} else {
|
||||
return id;
|
||||
}
|
||||
}).collect(Collectors.toList()));
|
||||
return paginationBox.create(page);
|
||||
}, (Component) null);
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "biomeinfo",
|
||||
desc = "Get the biome of the targeted block.",
|
||||
aliases = { "/biomeinfo" },
|
||||
descFooter = "By default, uses all blocks in your selection."
|
||||
)
|
||||
@CommandPermissions("worldedit.biome.info")
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -18,8 +18,6 @@
|
||||
*/
|
||||
|
||||
package com.sk89q.worldedit.command;
|
||||
import static com.sk89q.worldedit.command.util.Logging.LogMode.REGION;
|
||||
import static com.sk89q.worldedit.internal.anvil.ChunkDeleter.DELCHUNKS_FILE_NAME;
|
||||
|
||||
import com.google.gson.JsonIOException;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
@ -37,7 +35,6 @@ import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.util.formatting.component.PaginationBox;
|
||||
import com.sk89q.worldedit.command.util.WorldEditAsyncCommandBuilder;
|
||||
import com.sk89q.worldedit.util.formatting.text.Component;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
@ -46,21 +43,23 @@ import com.sk89q.worldedit.util.formatting.text.format.TextColor;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.storage.LegacyChunkStore;
|
||||
import com.sk89q.worldedit.world.storage.McRegionChunkStore;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Path;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import org.enginehub.piston.annotation.Command;
|
||||
import org.enginehub.piston.annotation.CommandContainer;
|
||||
import org.enginehub.piston.annotation.param.ArgFlag;
|
||||
import org.enginehub.piston.exception.StopExecutionException;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static com.sk89q.worldedit.command.util.Logging.LogMode.REGION;
|
||||
import static com.sk89q.worldedit.internal.anvil.ChunkDeleter.DELCHUNKS_FILE_NAME;
|
||||
|
||||
/**
|
||||
* Commands for working with chunks.
|
||||
|
@ -25,7 +25,6 @@ import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.command.util.Logging;
|
||||
import com.sk89q.worldedit.command.util.PermissionCondition;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.internal.annotation.Direction;
|
||||
import com.sk89q.worldedit.internal.annotation.MultiDirection;
|
||||
|
@ -19,8 +19,6 @@
|
||||
|
||||
package com.sk89q.worldedit.command;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import com.sk89q.worldedit.extent.transform.BlockTransformExtent;
|
||||
@ -33,6 +31,8 @@ import com.sk89q.worldedit.math.transform.Transform;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
/**
|
||||
* Helper class to 'bake' a transform into a clipboard.
|
||||
*
|
||||
|
@ -19,11 +19,8 @@
|
||||
|
||||
package com.sk89q.worldedit.command;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.config.Caption;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.boydti.fawe.object.extent.ResettableExtent;
|
||||
import com.boydti.fawe.util.CachedTextureUtil;
|
||||
import com.boydti.fawe.util.CleanTextureUtil;
|
||||
@ -44,10 +41,8 @@ import com.sk89q.worldedit.extension.input.DisallowedUsageException;
|
||||
import com.sk89q.worldedit.extension.input.InputParseException;
|
||||
import com.sk89q.worldedit.extension.input.ParserContext;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import com.sk89q.worldedit.extension.platform.Capability;
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
import com.sk89q.worldedit.util.SideEffect;
|
||||
import com.sk89q.worldedit.util.SideEffectSet;
|
||||
@ -55,21 +50,26 @@ import com.sk89q.worldedit.util.formatting.component.PaginationBox;
|
||||
import com.sk89q.worldedit.util.formatting.component.SideEffectBox;
|
||||
import com.sk89q.worldedit.util.formatting.text.Component;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.item.ItemType;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
import java.util.concurrent.Callable;
|
||||
import org.enginehub.piston.annotation.Command;
|
||||
import org.enginehub.piston.annotation.CommandContainer;
|
||||
import org.enginehub.piston.annotation.param.Arg;
|
||||
import org.enginehub.piston.annotation.param.ArgFlag;
|
||||
import org.enginehub.piston.annotation.param.Switch;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
/**
|
||||
* General WorldEdit commands.
|
||||
*/
|
||||
|
@ -18,16 +18,10 @@
|
||||
*/
|
||||
|
||||
package com.sk89q.worldedit.command;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static com.sk89q.worldedit.command.util.Logging.LogMode.ALL;
|
||||
import static com.sk89q.worldedit.command.util.Logging.LogMode.PLACEMENT;
|
||||
import static com.sk89q.worldedit.command.util.Logging.LogMode.POSITION;
|
||||
import static com.sk89q.worldedit.internal.command.CommandUtil.checkCommandArgument;
|
||||
|
||||
import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.config.Caption;
|
||||
import com.boydti.fawe.util.MainUtil;
|
||||
import com.boydti.fawe.util.MathMan;
|
||||
import com.boydti.fawe.util.TextureUtil;
|
||||
import com.boydti.fawe.util.image.ImageUtil;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
@ -58,17 +52,24 @@ import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
import java.awt.RenderingHints;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.List;
|
||||
import org.enginehub.piston.annotation.Command;
|
||||
import org.enginehub.piston.annotation.CommandContainer;
|
||||
import org.enginehub.piston.annotation.param.Arg;
|
||||
import org.enginehub.piston.annotation.param.Switch;
|
||||
import org.jetbrains.annotations.Range;
|
||||
|
||||
import java.awt.RenderingHints;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.List;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static com.sk89q.worldedit.command.util.Logging.LogMode.ALL;
|
||||
import static com.sk89q.worldedit.command.util.Logging.LogMode.PLACEMENT;
|
||||
import static com.sk89q.worldedit.command.util.Logging.LogMode.POSITION;
|
||||
import static com.sk89q.worldedit.internal.command.CommandUtil.checkCommandArgument;
|
||||
|
||||
/**
|
||||
* Commands for the generation of shapes and other objects.
|
||||
*/
|
||||
|
@ -1,7 +1,5 @@
|
||||
package com.sk89q.worldedit.command;
|
||||
|
||||
import static com.sk89q.worldedit.internal.command.CommandUtil.checkCommandArgument;
|
||||
|
||||
import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.FaweAPI;
|
||||
import com.boydti.fawe.config.Caption;
|
||||
@ -23,7 +21,6 @@ import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator;
|
||||
import com.sk89q.worldedit.command.util.annotation.Confirm;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.history.change.Change;
|
||||
import com.sk89q.worldedit.history.changeset.ChangeSet;
|
||||
import com.sk89q.worldedit.internal.annotation.AllowedRegion;
|
||||
import com.sk89q.worldedit.internal.annotation.Time;
|
||||
@ -43,6 +40,14 @@ import com.sk89q.worldedit.util.formatting.text.event.ClickEvent;
|
||||
import com.sk89q.worldedit.util.formatting.text.event.HoverEvent;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import org.enginehub.piston.annotation.Command;
|
||||
import org.enginehub.piston.annotation.CommandContainer;
|
||||
import org.enginehub.piston.annotation.param.Arg;
|
||||
import org.enginehub.piston.annotation.param.ArgFlag;
|
||||
import org.enginehub.piston.annotation.param.Switch;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Range;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.ref.Reference;
|
||||
import java.lang.ref.SoftReference;
|
||||
@ -52,13 +57,8 @@ import java.util.UUID;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.function.Supplier;
|
||||
import javax.annotation.Nullable;
|
||||
import org.enginehub.piston.annotation.Command;
|
||||
import org.enginehub.piston.annotation.CommandContainer;
|
||||
import org.enginehub.piston.annotation.param.Arg;
|
||||
import org.enginehub.piston.annotation.param.ArgFlag;
|
||||
import org.enginehub.piston.annotation.param.Switch;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Range;
|
||||
|
||||
import static com.sk89q.worldedit.internal.command.CommandUtil.checkCommandArgument;
|
||||
|
||||
@CommandContainer(superTypes = CommandPermissionsConditionGenerator.Registration.class)
|
||||
public class HistorySubCommands {
|
||||
|
@ -4,13 +4,14 @@ import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.util.StringMan;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import org.enginehub.piston.annotation.Command;
|
||||
import org.enginehub.piston.exception.StopExecutionException;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Locale;
|
||||
import java.util.UUID;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.regex.PatternSyntaxException;
|
||||
import org.enginehub.piston.annotation.Command;
|
||||
import org.enginehub.piston.exception.StopExecutionException;
|
||||
|
||||
//TODO This class breaks compilation
|
||||
//@CommandContainer
|
||||
|
@ -1,10 +1,11 @@
|
||||
package com.sk89q.worldedit.command;
|
||||
|
||||
import com.sk89q.worldedit.command.argument.Arguments;
|
||||
import java.util.Optional;
|
||||
import org.enginehub.piston.inject.InjectedValueAccess;
|
||||
import org.enginehub.piston.inject.Key;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
public class MethodCommands {
|
||||
|
||||
public static String getArguments(InjectedValueAccess context) {
|
||||
|
@ -18,9 +18,7 @@
|
||||
*/
|
||||
|
||||
package com.sk89q.worldedit.command;
|
||||
import static com.sk89q.worldedit.command.util.Logging.LogMode.POSITION;
|
||||
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.sk89q.worldedit.LocalConfiguration;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
@ -30,12 +28,14 @@ import com.sk89q.worldedit.command.util.Logging;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import org.enginehub.piston.annotation.Command;
|
||||
import org.enginehub.piston.annotation.CommandContainer;
|
||||
import org.enginehub.piston.annotation.param.Arg;
|
||||
import org.enginehub.piston.annotation.param.Switch;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static com.sk89q.worldedit.command.util.Logging.LogMode.POSITION;
|
||||
|
||||
/**
|
||||
* Commands for moving the player around.
|
||||
|
@ -19,9 +19,6 @@
|
||||
|
||||
package com.sk89q.worldedit.command;
|
||||
|
||||
import static java.util.Objects.requireNonNull;
|
||||
import static org.enginehub.piston.part.CommandParts.arg;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
@ -46,7 +43,6 @@ import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
|
||||
import com.sk89q.worldedit.util.formatting.text.format.TextDecoration;
|
||||
import java.util.stream.Collectors;
|
||||
import org.enginehub.piston.CommandManager;
|
||||
import org.enginehub.piston.CommandManagerService;
|
||||
import org.enginehub.piston.CommandParameters;
|
||||
@ -57,6 +53,11 @@ import org.enginehub.piston.inject.Key;
|
||||
import org.enginehub.piston.part.CommandArgument;
|
||||
import org.enginehub.piston.part.SubCommandPart;
|
||||
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static java.util.Objects.requireNonNull;
|
||||
import static org.enginehub.piston.part.CommandParts.arg;
|
||||
|
||||
@CommandContainer(superTypes = CommandPermissionsConditionGenerator.Registration.class)
|
||||
public class PaintBrushCommands {
|
||||
|
||||
|
@ -19,14 +19,6 @@
|
||||
|
||||
package com.sk89q.worldedit.command;
|
||||
|
||||
import static com.sk89q.worldedit.command.util.Logging.LogMode.ALL;
|
||||
import static com.sk89q.worldedit.command.util.Logging.LogMode.ORIENTATION_REGION;
|
||||
import static com.sk89q.worldedit.command.util.Logging.LogMode.REGION;
|
||||
import static com.sk89q.worldedit.internal.command.CommandUtil.checkCommandArgument;
|
||||
import static com.sk89q.worldedit.regions.Regions.asFlatRegion;
|
||||
import static com.sk89q.worldedit.regions.Regions.maximumBlockY;
|
||||
import static com.sk89q.worldedit.regions.Regions.minimumBlockY;
|
||||
|
||||
import com.boydti.fawe.FaweAPI;
|
||||
import com.boydti.fawe.FaweCache;
|
||||
import com.boydti.fawe.config.Caption;
|
||||
@ -74,15 +66,23 @@ import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import org.enginehub.piston.annotation.Command;
|
||||
import org.enginehub.piston.annotation.CommandContainer;
|
||||
import org.enginehub.piston.annotation.param.Arg;
|
||||
import org.enginehub.piston.annotation.param.ArgFlag;
|
||||
import org.enginehub.piston.annotation.param.Switch;
|
||||
import org.jetbrains.annotations.Range;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import static com.sk89q.worldedit.command.util.Logging.LogMode.ALL;
|
||||
import static com.sk89q.worldedit.command.util.Logging.LogMode.ORIENTATION_REGION;
|
||||
import static com.sk89q.worldedit.command.util.Logging.LogMode.REGION;
|
||||
import static com.sk89q.worldedit.internal.command.CommandUtil.checkCommandArgument;
|
||||
import static com.sk89q.worldedit.regions.Regions.asFlatRegion;
|
||||
import static com.sk89q.worldedit.regions.Regions.maximumBlockY;
|
||||
import static com.sk89q.worldedit.regions.Regions.minimumBlockY;
|
||||
|
||||
/**
|
||||
* Commands that operate on regions.
|
||||
|
@ -19,17 +19,12 @@
|
||||
|
||||
package com.sk89q.worldedit.command;
|
||||
|
||||
import static com.boydti.fawe.util.ReflectionUtils.as;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.boydti.fawe.config.Caption;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.boydti.fawe.config.Settings;
|
||||
import com.boydti.fawe.object.clipboard.MultiClipboardHolder;
|
||||
import com.boydti.fawe.object.clipboard.URIClipboardHolder;
|
||||
import com.boydti.fawe.object.schematic.MinecraftStructure;
|
||||
import com.boydti.fawe.util.MainUtil;
|
||||
import com.boydti.fawe.util.MathMan;
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.collect.Multimap;
|
||||
import com.sk89q.worldedit.LocalConfiguration;
|
||||
@ -57,11 +52,21 @@ import com.sk89q.worldedit.util.formatting.component.PaginationBox;
|
||||
import com.sk89q.worldedit.util.formatting.component.TextComponentProducer;
|
||||
import com.sk89q.worldedit.util.formatting.text.Component;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.event.ClickEvent;
|
||||
import com.sk89q.worldedit.util.formatting.text.event.HoverEvent;
|
||||
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
|
||||
import com.sk89q.worldedit.util.io.Closer;
|
||||
import com.sk89q.worldedit.util.io.file.FilenameException;
|
||||
import org.enginehub.piston.annotation.Command;
|
||||
import org.enginehub.piston.annotation.CommandContainer;
|
||||
import org.enginehub.piston.annotation.param.Arg;
|
||||
import org.enginehub.piston.annotation.param.ArgFlag;
|
||||
import org.enginehub.piston.annotation.param.Switch;
|
||||
import org.enginehub.piston.exception.StopExecutionException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.File;
|
||||
@ -69,8 +74,6 @@ import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
@ -86,14 +89,10 @@ import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.regex.Pattern;
|
||||
import org.enginehub.piston.annotation.Command;
|
||||
import org.enginehub.piston.annotation.CommandContainer;
|
||||
import org.enginehub.piston.annotation.param.Arg;
|
||||
import org.enginehub.piston.annotation.param.ArgFlag;
|
||||
import org.enginehub.piston.annotation.param.Switch;
|
||||
import org.enginehub.piston.exception.StopExecutionException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import static com.boydti.fawe.util.ReflectionUtils.as;
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
//import com.boydti.fawe.object.schematic.visualizer.SchemVis;
|
||||
|
||||
|
@ -18,9 +18,7 @@
|
||||
*/
|
||||
|
||||
package com.sk89q.worldedit.command;
|
||||
import static com.sk89q.worldedit.command.util.Logging.LogMode.ALL;
|
||||
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
@ -28,15 +26,17 @@ import com.sk89q.worldedit.command.util.CommandPermissions;
|
||||
import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator;
|
||||
import com.sk89q.worldedit.command.util.Logging;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
import java.util.stream.Stream;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import org.enginehub.piston.annotation.Command;
|
||||
import org.enginehub.piston.annotation.CommandContainer;
|
||||
import org.enginehub.piston.annotation.param.Arg;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static com.sk89q.worldedit.command.util.Logging.LogMode.ALL;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -19,9 +19,6 @@
|
||||
|
||||
package com.sk89q.worldedit.command;
|
||||
|
||||
import static com.sk89q.worldedit.command.util.Logging.LogMode.POSITION;
|
||||
import static com.sk89q.worldedit.command.util.Logging.LogMode.REGION;
|
||||
|
||||
import com.boydti.fawe.config.Caption;
|
||||
import com.boydti.fawe.object.clipboard.URIClipboardHolder;
|
||||
import com.boydti.fawe.object.mask.IdMask;
|
||||
@ -43,7 +40,6 @@ import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.extension.platform.Locatable;
|
||||
import com.sk89q.worldedit.extension.platform.permission.ActorSelectorLimits;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import com.sk89q.worldedit.function.block.BlockDistributionCounter;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
@ -84,11 +80,6 @@ import com.sk89q.worldedit.world.block.BlockType;
|
||||
import com.sk89q.worldedit.world.item.ItemType;
|
||||
import com.sk89q.worldedit.world.item.ItemTypes;
|
||||
import com.sk89q.worldedit.world.storage.ChunkStore;
|
||||
import java.io.File;
|
||||
import java.net.URI;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Stream;
|
||||
import org.enginehub.piston.annotation.Command;
|
||||
import org.enginehub.piston.annotation.CommandContainer;
|
||||
import org.enginehub.piston.annotation.param.Arg;
|
||||
@ -96,6 +87,15 @@ import org.enginehub.piston.annotation.param.ArgFlag;
|
||||
import org.enginehub.piston.annotation.param.Switch;
|
||||
import org.enginehub.piston.exception.StopExecutionException;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.URI;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static com.sk89q.worldedit.command.util.Logging.LogMode.POSITION;
|
||||
import static com.sk89q.worldedit.command.util.Logging.LogMode.REGION;
|
||||
|
||||
/**
|
||||
* Selection commands.
|
||||
*/
|
||||
|
@ -19,7 +19,6 @@
|
||||
|
||||
package com.sk89q.worldedit.command;
|
||||
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.sk89q.worldedit.LocalConfiguration;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
@ -31,6 +30,7 @@ import com.sk89q.worldedit.command.util.CommandPermissions;
|
||||
import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import org.enginehub.piston.annotation.Command;
|
||||
import org.enginehub.piston.annotation.CommandContainer;
|
||||
import org.enginehub.piston.annotation.param.Arg;
|
||||
|
@ -19,20 +19,18 @@
|
||||
|
||||
package com.sk89q.worldedit.command;
|
||||
|
||||
import com.google.common.collect.Collections2;
|
||||
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.boydti.fawe.object.brush.InspectBrush;
|
||||
import com.google.common.collect.Collections2;
|
||||
import com.sk89q.worldedit.LocalConfiguration;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.command.tool.BlockDataCyler;
|
||||
import com.sk89q.worldedit.command.tool.BlockReplacer;
|
||||
import com.sk89q.worldedit.command.tool.InvalidToolBindException;
|
||||
import com.sk89q.worldedit.command.tool.DistanceWand;
|
||||
import com.sk89q.worldedit.command.tool.FloatingTreeRemover;
|
||||
import com.sk89q.worldedit.command.tool.FloodFillTool;
|
||||
import com.sk89q.worldedit.command.tool.InvalidToolBindException;
|
||||
import com.sk89q.worldedit.command.tool.LongRangeBuildTool;
|
||||
import com.sk89q.worldedit.command.tool.NavigationWand;
|
||||
import com.sk89q.worldedit.command.tool.QueryTool;
|
||||
@ -42,20 +40,21 @@ import com.sk89q.worldedit.command.util.CommandPermissions;
|
||||
import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.util.HandSide;
|
||||
import com.sk89q.worldedit.util.TreeGenerator;
|
||||
import com.sk89q.worldedit.world.item.ItemType;
|
||||
import org.enginehub.piston.annotation.Command;
|
||||
import com.sk89q.worldedit.internal.command.CommandRegistrationHandler;
|
||||
import com.sk89q.worldedit.internal.command.CommandUtil;
|
||||
import org.enginehub.piston.annotation.CommandContainer;
|
||||
import org.enginehub.piston.annotation.param.Arg;
|
||||
import com.sk89q.worldedit.util.HandSide;
|
||||
import com.sk89q.worldedit.util.TreeGenerator;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.item.ItemType;
|
||||
import org.enginehub.piston.CommandManager;
|
||||
import org.enginehub.piston.CommandManagerService;
|
||||
import org.enginehub.piston.CommandMetadata;
|
||||
import org.enginehub.piston.CommandParameters;
|
||||
import org.enginehub.piston.annotation.Command;
|
||||
import org.enginehub.piston.annotation.CommandContainer;
|
||||
import org.enginehub.piston.annotation.param.Arg;
|
||||
import org.enginehub.piston.part.SubCommandPart;
|
||||
|
||||
import java.util.Optional;
|
||||
|
@ -20,12 +20,10 @@
|
||||
package com.sk89q.worldedit.command;
|
||||
|
||||
import com.boydti.fawe.config.Caption;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.boydti.fawe.object.brush.BrushSettings;
|
||||
import com.boydti.fawe.object.brush.TargetMode;
|
||||
import com.boydti.fawe.object.brush.scroll.Scroll;
|
||||
import com.boydti.fawe.object.brush.visualization.VisualMode;
|
||||
import com.boydti.fawe.object.extent.ResettableExtent;
|
||||
import com.boydti.fawe.util.MathMan;
|
||||
import com.boydti.fawe.util.StringMan;
|
||||
import com.google.common.collect.Iterables;
|
||||
@ -45,6 +43,7 @@ import com.sk89q.worldedit.function.mask.Mask;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.internal.command.CommandArgParser;
|
||||
import com.sk89q.worldedit.util.HandSide;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import org.enginehub.piston.annotation.Command;
|
||||
import org.enginehub.piston.annotation.CommandContainer;
|
||||
import org.enginehub.piston.annotation.param.Arg;
|
||||
|
@ -19,18 +19,14 @@
|
||||
|
||||
package com.sk89q.worldedit.command;
|
||||
|
||||
import static com.sk89q.worldedit.command.util.Logging.LogMode.PLACEMENT;
|
||||
|
||||
import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.config.Caption;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.boydti.fawe.config.Settings;
|
||||
import com.boydti.fawe.object.DelegateConsumer;
|
||||
import com.boydti.fawe.object.function.QuadFunction;
|
||||
import com.boydti.fawe.util.MainUtil;
|
||||
import com.boydti.fawe.util.image.ImageUtil;
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.IncompleteRegionException;
|
||||
import com.sk89q.worldedit.LocalConfiguration;
|
||||
@ -44,25 +40,23 @@ import com.sk89q.worldedit.command.util.CreatureButcher;
|
||||
import com.sk89q.worldedit.command.util.EntityRemover;
|
||||
import com.sk89q.worldedit.command.util.Logging;
|
||||
import com.sk89q.worldedit.command.util.PrintCommandHelp;
|
||||
import com.sk89q.worldedit.command.util.WorldEditAsyncCommandBuilder;
|
||||
import com.sk89q.worldedit.entity.Entity;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat;
|
||||
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats;
|
||||
import com.sk89q.worldedit.function.EntityFunction;
|
||||
import com.sk89q.worldedit.function.mask.BlockTypeMask;
|
||||
import com.sk89q.worldedit.function.mask.ExistingBlockMask;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
import com.sk89q.worldedit.command.util.WorldEditAsyncCommandBuilder;
|
||||
import com.sk89q.worldedit.function.operation.Operations;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.function.mask.BlockTypeMask;
|
||||
import com.sk89q.worldedit.function.visitor.EntityVisitor;
|
||||
import com.sk89q.worldedit.internal.annotation.Direction;
|
||||
import com.sk89q.worldedit.internal.expression.EvaluationException;
|
||||
import com.sk89q.worldedit.internal.expression.Expression;
|
||||
import com.sk89q.worldedit.internal.expression.ExpressionException;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import com.sk89q.worldedit.regions.CylinderRegion;
|
||||
@ -70,17 +64,25 @@ import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.util.formatting.component.SubtleFormat;
|
||||
import com.sk89q.worldedit.util.formatting.text.Component;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
import org.enginehub.piston.annotation.Command;
|
||||
import org.enginehub.piston.annotation.CommandContainer;
|
||||
import org.enginehub.piston.annotation.param.Arg;
|
||||
import org.enginehub.piston.annotation.param.ArgFlag;
|
||||
import org.enginehub.piston.annotation.param.Switch;
|
||||
import org.enginehub.piston.exception.StopExecutionException;
|
||||
|
||||
import java.awt.RenderingHints;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.nio.file.Files;
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.NumberFormat;
|
||||
import java.util.AbstractMap;
|
||||
import java.util.AbstractMap.SimpleEntry;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
@ -93,13 +95,8 @@ import java.util.function.Consumer;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.imageio.ImageIO;
|
||||
import org.enginehub.piston.annotation.Command;
|
||||
import org.enginehub.piston.annotation.CommandContainer;
|
||||
import org.enginehub.piston.annotation.param.Arg;
|
||||
import org.enginehub.piston.annotation.param.ArgFlag;
|
||||
import org.enginehub.piston.annotation.param.Switch;
|
||||
import org.enginehub.piston.exception.StopExecutionException;
|
||||
import org.jetbrains.annotations.Range;
|
||||
|
||||
import static com.sk89q.worldedit.command.util.Logging.LogMode.PLACEMENT;
|
||||
|
||||
/**
|
||||
* Utility commands.
|
||||
|
@ -21,8 +21,6 @@ package com.sk89q.worldedit.command;
|
||||
|
||||
import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.FaweVersion;
|
||||
import com.sk89q.worldedit.util.formatting.text.Component;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.boydti.fawe.config.Settings;
|
||||
import com.boydti.fawe.util.IncendoPaster;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
@ -37,11 +35,18 @@ import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.extension.platform.Capability;
|
||||
import com.sk89q.worldedit.extension.platform.Platform;
|
||||
import com.sk89q.worldedit.extension.platform.PlatformManager;
|
||||
import com.sk89q.worldedit.util.formatting.component.MessageBox;
|
||||
import com.sk89q.worldedit.util.formatting.component.TextComponentProducer;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.event.ClickEvent;
|
||||
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import com.sk89q.worldedit.util.formatting.component.TextComponentProducer;
|
||||
import com.sk89q.worldedit.util.formatting.component.MessageBox;
|
||||
import org.enginehub.piston.annotation.Command;
|
||||
import org.enginehub.piston.annotation.CommandContainer;
|
||||
import org.enginehub.piston.annotation.param.Arg;
|
||||
import org.enginehub.piston.annotation.param.ArgFlag;
|
||||
import org.enginehub.piston.annotation.param.Switch;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.time.ZoneId;
|
||||
import java.time.ZonedDateTime;
|
||||
@ -52,11 +57,6 @@ import java.util.Date;
|
||||
import java.util.GregorianCalendar;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.enginehub.piston.annotation.Command;
|
||||
import org.enginehub.piston.annotation.CommandContainer;
|
||||
import org.enginehub.piston.annotation.param.Arg;
|
||||
import org.enginehub.piston.annotation.param.ArgFlag;
|
||||
import org.enginehub.piston.annotation.param.Switch;
|
||||
|
||||
@CommandContainer(superTypes = {CommandPermissionsConditionGenerator.Registration.class})
|
||||
public class WorldEditCommands {
|
||||
|
@ -38,8 +38,8 @@ import org.enginehub.piston.converter.SuccessfulConversion;
|
||||
import org.enginehub.piston.inject.InjectedValueAccess;
|
||||
import org.enginehub.piston.inject.Key;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import static org.enginehub.piston.converter.SuggestionHelper.limitByPrefix;
|
||||
|
||||
@ -56,7 +56,7 @@ public abstract class AbstractDirectionConverter<D> implements ArgumentConverter
|
||||
}
|
||||
|
||||
protected static <D> void register(CommandManager commandManager, AbstractDirectionConverter<D> converter,
|
||||
Class<D> keyClass, boolean includeDiagonals) {
|
||||
Class<D> keyClass, boolean includeDiagonals) {
|
||||
commandManager.registerConverter(
|
||||
Key.of(keyClass, direction(includeDiagonals)),
|
||||
converter
|
||||
|
@ -51,6 +51,8 @@ public class Chunk3dVectorConverter<C, T> implements ArgumentConverter<T> {
|
||||
return BlockVector3.at(cmps.get(0), 0, cmps.get(1));
|
||||
case 3:
|
||||
return BlockVector3.at(cmps.get(0), cmps.get(1), cmps.get(2));
|
||||
default:
|
||||
break;
|
||||
}
|
||||
throw new AssertionError("Expected 2 or 3 components");
|
||||
},
|
||||
|
@ -26,8 +26,8 @@ import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.util.Direction;
|
||||
import org.enginehub.piston.CommandManager;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Optional;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public final class DirectionConverter extends AbstractDirectionConverter<Direction> {
|
||||
|
||||
|
@ -30,12 +30,11 @@ import org.enginehub.piston.converter.ArgumentConverter;
|
||||
import org.enginehub.piston.converter.MultiKeyConverter;
|
||||
import org.enginehub.piston.inject.Key;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public final class EnumConverter {
|
||||
|
||||
|
@ -23,7 +23,6 @@ import com.sk89q.worldedit.EmptyClipboardException;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.blocks.BaseItem;
|
||||
import com.sk89q.worldedit.entity.Entity;
|
||||
import com.sk89q.worldedit.extension.input.InputParseException;
|
||||
import com.sk89q.worldedit.extension.input.ParserContext;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
@ -48,10 +47,10 @@ import org.enginehub.piston.converter.SuccessfulConversion;
|
||||
import org.enginehub.piston.inject.InjectedValueAccess;
|
||||
import org.enginehub.piston.inject.Key;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class FactoryConverter<T> implements ArgumentConverter<T> {
|
||||
|
||||
@ -64,22 +63,22 @@ public class FactoryConverter<T> implements ArgumentConverter<T> {
|
||||
new FactoryConverter<>(worldEdit, WorldEdit::getItemFactory, "item", null));
|
||||
|
||||
commandManager.registerConverter(Key.of(Mask.class, ClipboardMask.class),
|
||||
new FactoryConverter<>(worldEdit, WorldEdit::getMaskFactory, "mask",
|
||||
context -> {
|
||||
try {
|
||||
ClipboardHolder holder = context.getSession().getClipboard();
|
||||
Transform transform = holder.getTransform();
|
||||
Extent target;
|
||||
if (transform.isIdentity()) {
|
||||
target = holder.getClipboard();
|
||||
} else {
|
||||
target = new BlockTransformExtent(holder.getClipboard(), transform);
|
||||
}
|
||||
context.setExtent(target);
|
||||
} catch (EmptyClipboardException e) {
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
}));
|
||||
new FactoryConverter<>(worldEdit, WorldEdit::getMaskFactory, "mask",
|
||||
context -> {
|
||||
try {
|
||||
ClipboardHolder holder = context.getSession().getClipboard();
|
||||
Transform transform = holder.getTransform();
|
||||
Extent target;
|
||||
if (transform.isIdentity()) {
|
||||
target = holder.getClipboard();
|
||||
} else {
|
||||
target = new BlockTransformExtent(holder.getClipboard(), transform);
|
||||
}
|
||||
context.setExtent(target);
|
||||
} catch (EmptyClipboardException e) {
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
private final WorldEdit worldEdit;
|
||||
|
@ -62,7 +62,8 @@ public final class RegistryConverter<V extends Keyed> implements ArgumentConvert
|
||||
FluidCategory.class,
|
||||
GameMode.class,
|
||||
WeatherType.class
|
||||
).stream()
|
||||
)
|
||||
.stream()
|
||||
.map(c -> (Class<Keyed>) c)
|
||||
.forEach(registryType ->
|
||||
commandManager.registerConverter(Key.of(registryType), from(registryType))
|
||||
|
@ -19,11 +19,7 @@
|
||||
|
||||
package com.sk89q.worldedit.command.argument;
|
||||
|
||||
import static org.enginehub.piston.converter.SuggestionHelper.limitByPrefix;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.command.util.EntityRemover;
|
||||
import com.sk89q.worldedit.util.SideEffect;
|
||||
import com.sk89q.worldedit.util.formatting.text.Component;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
@ -39,6 +35,8 @@ import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import static org.enginehub.piston.converter.SuggestionHelper.limitByPrefix;
|
||||
|
||||
public class SideEffectConverter implements ArgumentConverter<SideEffect> {
|
||||
|
||||
public static void register(CommandManager commandManager) {
|
||||
|
@ -21,9 +21,9 @@ package com.sk89q.worldedit.command.factory;
|
||||
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.blocks.BaseItem;
|
||||
import com.sk89q.worldedit.function.ItemUseFunction;
|
||||
import com.sk89q.worldedit.function.Contextual;
|
||||
import com.sk89q.worldedit.function.EditContext;
|
||||
import com.sk89q.worldedit.function.ItemUseFunction;
|
||||
import com.sk89q.worldedit.function.RegionFunction;
|
||||
import com.sk89q.worldedit.util.Direction;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
|
@ -19,8 +19,6 @@
|
||||
|
||||
package com.sk89q.worldedit.command.factory;
|
||||
|
||||
import static com.sk89q.worldedit.util.GuavaUtil.firstNonNull;
|
||||
|
||||
import com.sk89q.worldedit.extent.NullExtent;
|
||||
import com.sk89q.worldedit.function.Contextual;
|
||||
import com.sk89q.worldedit.function.EditContext;
|
||||
@ -28,6 +26,8 @@ import com.sk89q.worldedit.function.RegionFunction;
|
||||
import com.sk89q.worldedit.function.block.BlockReplace;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
|
||||
import static com.sk89q.worldedit.util.GuavaUtil.firstNonNull;
|
||||
|
||||
public class ReplaceFactory implements Contextual<RegionFunction> {
|
||||
private final Pattern fill;
|
||||
|
||||
|
@ -19,7 +19,6 @@
|
||||
|
||||
package com.sk89q.worldedit.command.tool;
|
||||
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.LocalConfiguration;
|
||||
@ -30,8 +29,10 @@ import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.extension.platform.Platform;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.registry.state.Property;
|
||||
import com.sk89q.worldedit.util.Direction;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
|
||||
@ -39,6 +40,7 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* A mode that cycles the data values of supported blocks.
|
||||
@ -50,7 +52,7 @@ public class BlockDataCyler implements DoubleActionBlockTool {
|
||||
return player.hasPermission("worldedit.tool.data-cycler");
|
||||
}
|
||||
|
||||
private Map<UUID, Property<?>> selectedProperties = new HashMap<>();
|
||||
private final Map<UUID, Property<?>> selectedProperties = new HashMap<>();
|
||||
|
||||
private boolean handleCycle(LocalConfiguration config, Player player, LocalSession session,
|
||||
Location clicked, boolean forward) {
|
||||
@ -85,7 +87,7 @@ public class BlockDataCyler implements DoubleActionBlockTool {
|
||||
Property<Object> objProp = (Property<Object>) currentProperty;
|
||||
BlockState newBlock = block.with(objProp, currentProperty.getValues().get(index));
|
||||
|
||||
try (EditSession editSession = session.createEditSession(player, "BlockDataCyler")) {
|
||||
try (EditSession editSession = session.createEditSession(player)) {
|
||||
editSession.disableBuffering();
|
||||
|
||||
try {
|
||||
@ -115,12 +117,12 @@ public class BlockDataCyler implements DoubleActionBlockTool {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, Location clicked) {
|
||||
public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, Location clicked, @Nullable Direction face) {
|
||||
return handleCycle(config, player, session, clicked, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean actSecondary(Platform server, LocalConfiguration config, Player player, LocalSession session, Location clicked) {
|
||||
public boolean actSecondary(Platform server, LocalConfiguration config, Player player, LocalSession session, Location clicked, @Nullable Direction face) {
|
||||
return handleCycle(config, player, session, clicked, false);
|
||||
}
|
||||
|
||||
|
@ -23,19 +23,47 @@ import com.sk89q.worldedit.LocalConfiguration;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.extension.platform.Platform;
|
||||
import com.sk89q.worldedit.internal.util.DeprecationUtil;
|
||||
import com.sk89q.worldedit.internal.util.NonAbstractForCompatibility;
|
||||
import com.sk89q.worldedit.util.Direction;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public interface BlockTool extends Tool {
|
||||
|
||||
/**
|
||||
* Perform the primary action of this tool.
|
||||
*
|
||||
* @param server
|
||||
* @param config
|
||||
* @param player
|
||||
* @param session
|
||||
* @param clicked
|
||||
* @return true to cancel the original event which triggered this action (if possible)
|
||||
* @deprecated New subclasses should override
|
||||
* {@link #actPrimary(Platform, LocalConfiguration, Player, LocalSession, Location, Direction)}
|
||||
* instead
|
||||
*/
|
||||
boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, Location clicked);
|
||||
@Deprecated
|
||||
default boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, Location clicked) {
|
||||
return actPrimary(server, config, player, session, clicked, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform the primary action of this tool.
|
||||
*
|
||||
* @param server The platform
|
||||
* @param config The config instance
|
||||
* @param player The player
|
||||
* @param session The local session
|
||||
* @param clicked The location that was clicked
|
||||
* @param face The face that was clicked
|
||||
* @return true to cancel the original event which triggered this action (if possible)
|
||||
* @apiNote This must be overridden by new subclasses. See {@link NonAbstractForCompatibility}
|
||||
* for details
|
||||
*/
|
||||
@NonAbstractForCompatibility(
|
||||
delegateName = "actPrimary",
|
||||
delegateParams = { Platform.class, LocalConfiguration.class, Player.class, LocalSession.class, Location.class }
|
||||
)
|
||||
default boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, Location clicked, @Nullable Direction face) {
|
||||
DeprecationUtil.checkDelegatingOverride(getClass());
|
||||
return actPrimary(server, config, player, session, clicked);
|
||||
}
|
||||
}
|
||||
|
@ -19,14 +19,11 @@
|
||||
|
||||
package com.sk89q.worldedit.command.tool;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.beta.implementation.IChunkExtent;
|
||||
import com.boydti.fawe.beta.implementation.processors.NullProcessor;
|
||||
import com.boydti.fawe.beta.implementation.processors.PersistentChunkSendProcessor;
|
||||
import com.boydti.fawe.config.Caption;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.boydti.fawe.object.brush.BrushSettings;
|
||||
import com.boydti.fawe.object.brush.MovableTool;
|
||||
import com.boydti.fawe.object.brush.ResettableTool;
|
||||
@ -43,7 +40,6 @@ import com.boydti.fawe.util.EditSessionBuilder;
|
||||
import com.boydti.fawe.util.ExtentTraverser;
|
||||
import com.boydti.fawe.util.MaskTraverser;
|
||||
import com.boydti.fawe.util.StringMan;
|
||||
import com.google.gson.Gson;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.LocalConfiguration;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
@ -65,31 +61,36 @@ import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.session.request.Request;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.Serializable;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.function.Supplier;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
/**
|
||||
* Builds a shape at the place being looked at.
|
||||
*/
|
||||
public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool, ResettableTool, Serializable {
|
||||
// TODO:
|
||||
public class BrushTool
|
||||
implements DoubleActionTraceTool, ScrollTool, MovableTool, ResettableTool, Serializable {
|
||||
// TODO:
|
||||
// Serialize methods
|
||||
// serialize BrushSettings (primary and secondary only if different)
|
||||
// set transient values e.g., context
|
||||
|
||||
|
||||
public enum BrushAction {
|
||||
PRIMARY,
|
||||
SECONDARY
|
||||
PRIMARY, SECONDARY
|
||||
}
|
||||
|
||||
|
||||
protected static int MAX_RANGE = 500;
|
||||
protected static int DEFAULT_RANGE = 240; // 500 is laggy as the default
|
||||
protected int range = -1;
|
||||
@ -108,7 +109,7 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
|
||||
|
||||
/**
|
||||
* Construct the tool.
|
||||
*
|
||||
*
|
||||
* @param permission the permission to check before use is allowed
|
||||
*/
|
||||
public BrushTool(String permission) {
|
||||
@ -126,7 +127,7 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
|
||||
public boolean isSet() {
|
||||
return primary.getBrush() != null || secondary.getBrush() != null;
|
||||
}
|
||||
|
||||
|
||||
public void update() {
|
||||
if (holder != null) {
|
||||
BrushCache.setTool(holder, this);
|
||||
@ -210,7 +211,7 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
|
||||
|
||||
/**
|
||||
* Get the filter.
|
||||
*
|
||||
*
|
||||
* @return the filter
|
||||
*/
|
||||
public Mask getMask() {
|
||||
@ -238,7 +239,7 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
|
||||
|
||||
/**
|
||||
* Set the block filter used for identifying blocks to replace.
|
||||
*
|
||||
*
|
||||
* @param filter the filter to set
|
||||
*/
|
||||
public void setMask(Mask filter) {
|
||||
@ -251,7 +252,8 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
|
||||
*
|
||||
* @return the mask used to stop block traces
|
||||
*/
|
||||
public @Nullable Mask getTraceMask() {
|
||||
@Nullable
|
||||
public Mask getTraceMask() {
|
||||
return this.traceMask;
|
||||
}
|
||||
|
||||
@ -277,8 +279,8 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
|
||||
|
||||
/**
|
||||
* Set the brush.
|
||||
*
|
||||
* @param brush tbe brush
|
||||
*
|
||||
* @param brush tbe brush
|
||||
* @param permission the permission
|
||||
*/
|
||||
public void setBrush(Brush brush, String permission) {
|
||||
@ -291,7 +293,7 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
|
||||
|
||||
/**
|
||||
* Get the current brush.
|
||||
|
||||
*
|
||||
* @return the current brush
|
||||
*/
|
||||
public Brush getBrush() {
|
||||
@ -300,7 +302,7 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
|
||||
|
||||
/**
|
||||
* Set the material.
|
||||
*
|
||||
*
|
||||
* @param material the material
|
||||
*/
|
||||
public void setFill(@Nullable Pattern material) {
|
||||
@ -312,13 +314,14 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
|
||||
*
|
||||
* @return the material
|
||||
*/
|
||||
@Nullable public Pattern getMaterial() {
|
||||
@Nullable
|
||||
public Pattern getMaterial() {
|
||||
return getContext().getMaterial();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the set brush size.
|
||||
*
|
||||
*
|
||||
* @return a radius
|
||||
*/
|
||||
public double getSize() {
|
||||
@ -327,7 +330,7 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
|
||||
|
||||
/**
|
||||
* Set the set brush size.
|
||||
*
|
||||
*
|
||||
* @param radius a radius
|
||||
*/
|
||||
public void setSize(double radius) {
|
||||
@ -345,7 +348,7 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
|
||||
|
||||
/**
|
||||
* Get the set brush range.
|
||||
*
|
||||
*
|
||||
* @return the range of the brush in blocks
|
||||
*/
|
||||
public int getRange() {
|
||||
@ -354,7 +357,7 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
|
||||
|
||||
/**
|
||||
* Set the set brush range.
|
||||
*
|
||||
*
|
||||
* @param range the range of the brush in blocks
|
||||
*/
|
||||
public void setRange(int range) {
|
||||
@ -362,9 +365,10 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session) {
|
||||
public boolean actPrimary(Platform server, LocalConfiguration config, Player player,
|
||||
LocalSession session) {
|
||||
return act(BrushAction.PRIMARY, player, session);
|
||||
}
|
||||
}
|
||||
|
||||
public BlockVector3 getPosition(EditSession editSession, Player player) {
|
||||
Location loc = player.getLocation();
|
||||
@ -376,7 +380,8 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
|
||||
float pitch = loc.getPitch();
|
||||
pitch = 23 - (pitch / 4);
|
||||
d += (int) (Math.sin(Math.toRadians(pitch)) * 50);
|
||||
final Vector3 vector = loc.getDirection().withY(0).normalize().multiply(d).add(loc.getX(), loc.getY(), loc.getZ());
|
||||
final Vector3 vector = loc.getDirection().withY(0).normalize().multiply(d)
|
||||
.add(loc.getX(), loc.getY(), loc.getZ());
|
||||
return offset(vector, loc).toBlockPoint();
|
||||
}
|
||||
case TARGET_POINT_HEIGHT: {
|
||||
@ -401,7 +406,9 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
|
||||
}
|
||||
|
||||
private Vector3 offset(Vector3 target, Vector3 playerPos) {
|
||||
if (targetOffset == 0) return target;
|
||||
if (targetOffset == 0) {
|
||||
return target;
|
||||
}
|
||||
return target.subtract(target.subtract(playerPos).normalize().multiply(targetOffset));
|
||||
}
|
||||
|
||||
@ -420,13 +427,18 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
|
||||
case SECONDARY:
|
||||
setContext(secondary);
|
||||
break;
|
||||
default:
|
||||
throw new IllegalStateException("Unexpected value: " + action);
|
||||
}
|
||||
BrushSettings current = getContext();
|
||||
Brush brush = current.getBrush();
|
||||
if (brush == null) return false;
|
||||
if (brush == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!current.canUse(player)) {
|
||||
player.print(Caption.of("fawe.error.no-perm" , StringMan.join(current.getPermissions(), ",")));
|
||||
player.print(
|
||||
Caption.of("fawe.error.no-perm", StringMan.join(current.getPermissions(), ",")));
|
||||
return false;
|
||||
}
|
||||
try (EditSession editSession = session.createEditSession(player, current.toString())) {
|
||||
@ -484,7 +496,8 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean actSecondary(Platform server, LocalConfiguration config, Player player, LocalSession session) {
|
||||
public boolean actSecondary(Platform server, LocalConfiguration config, Player player,
|
||||
LocalSession session) {
|
||||
return act(BrushAction.SECONDARY, player, session);
|
||||
}
|
||||
|
||||
@ -506,7 +519,9 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
|
||||
}
|
||||
|
||||
public void setVisualMode(Player player, VisualMode visualMode) {
|
||||
if (visualMode == null) visualMode = VisualMode.NONE;
|
||||
if (visualMode == null) {
|
||||
visualMode = VisualMode.NONE;
|
||||
}
|
||||
if (this.visualMode != visualMode) {
|
||||
if (this.visualMode != VisualMode.NONE) {
|
||||
clear(player);
|
||||
@ -563,31 +578,31 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public synchronized void visualize(BrushTool.BrushAction action, Player player) throws WorldEditException {
|
||||
public synchronized void visualize(BrushTool.BrushAction action, Player player)
|
||||
throws WorldEditException {
|
||||
VisualMode mode = getVisualMode();
|
||||
if (mode == VisualMode.NONE) {
|
||||
return;
|
||||
}
|
||||
BrushSettings current = getContext();
|
||||
Brush brush = current.getBrush();
|
||||
if (brush == null) return;
|
||||
if (brush == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
EditSessionBuilder builder = new EditSessionBuilder(player.getWorld())
|
||||
.command(current.toString())
|
||||
.player(player)
|
||||
.allowedRegionsEverywhere()
|
||||
.autoQueue(false)
|
||||
.blockBag(null)
|
||||
.changeSetNull()
|
||||
.fastmode(true)
|
||||
.combineStages(true);
|
||||
EditSessionBuilder builder =
|
||||
new EditSessionBuilder(player.getWorld()).command(current.toString()).player(player)
|
||||
.allowedRegionsEverywhere().autoQueue(false).blockBag(null).changeSetNull()
|
||||
.fastmode(true).combineStages(true);
|
||||
EditSession editSession = builder.build();
|
||||
|
||||
World world = editSession.getWorld();
|
||||
Supplier<Collection<Player>> players = () -> Collections.singleton(player);
|
||||
|
||||
PersistentChunkSendProcessor newVisualExtent = new PersistentChunkSendProcessor(world, this.visualExtent, players);
|
||||
ExtentTraverser<IChunkExtent> traverser = new ExtentTraverser<>(editSession).find(IChunkExtent.class);
|
||||
PersistentChunkSendProcessor newVisualExtent =
|
||||
new PersistentChunkSendProcessor(world, this.visualExtent, players);
|
||||
ExtentTraverser<IChunkExtent> traverser =
|
||||
new ExtentTraverser<>(editSession).find(IChunkExtent.class);
|
||||
if (traverser == null) {
|
||||
throw new IllegalStateException("No queue found");
|
||||
}
|
||||
@ -612,6 +627,8 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
|
||||
brush.build(editSession, position, current.getMaterial(), current.getSize());
|
||||
break;
|
||||
}
|
||||
default:
|
||||
throw new IllegalStateException("Unexpected value: " + mode);
|
||||
}
|
||||
}
|
||||
editSession.flushQueue();
|
||||
|
@ -19,7 +19,6 @@
|
||||
|
||||
package com.sk89q.worldedit.command.tool;
|
||||
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.sk89q.worldedit.LocalConfiguration;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
@ -29,6 +28,7 @@ import com.sk89q.worldedit.function.mask.Mask;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.RegionSelector;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
|
||||
/**
|
||||
* A wand that can be used at a distance.
|
||||
@ -42,7 +42,9 @@ public class DistanceWand extends BrushTool implements DoubleActionTraceTool {
|
||||
@Override
|
||||
public boolean actSecondary(Platform server, LocalConfiguration config, Player player, LocalSession session) {
|
||||
Location target = getTarget(player);
|
||||
if (target == null) return true;
|
||||
if (target == null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
RegionSelector selector = session.getRegionSelector(player.getWorld());
|
||||
BlockVector3 blockPoint = target.toVector().toBlockPoint();
|
||||
@ -55,7 +57,9 @@ public class DistanceWand extends BrushTool implements DoubleActionTraceTool {
|
||||
@Override
|
||||
public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session) {
|
||||
Location target = getTarget(player);
|
||||
if (target == null) return true;
|
||||
if (target == null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
RegionSelector selector = session.getRegionSelector(player.getWorld());
|
||||
BlockVector3 blockPoint = target.toVector().toBlockPoint();
|
||||
|
@ -23,8 +23,13 @@ import com.sk89q.worldedit.LocalConfiguration;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.extension.platform.Platform;
|
||||
import com.sk89q.worldedit.internal.util.DeprecationUtil;
|
||||
import com.sk89q.worldedit.internal.util.NonAbstractForCompatibility;
|
||||
import com.sk89q.worldedit.util.Direction;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* Represents a block tool that also has a secondary/primary function.
|
||||
*/
|
||||
@ -33,13 +38,36 @@ public interface DoubleActionBlockTool extends BlockTool {
|
||||
/**
|
||||
* Perform the secondary action of this block tool.
|
||||
*
|
||||
* @param server
|
||||
* @param config
|
||||
* @param player
|
||||
* @param session
|
||||
* @param clicked
|
||||
* @return true to cancel the original event which triggered this action (if possible)
|
||||
* @deprecated New subclasses must override
|
||||
* {@link #actSecondary(Platform, LocalConfiguration, Player, LocalSession, Location, Direction)}
|
||||
* instead
|
||||
*/
|
||||
boolean actSecondary(Platform server, LocalConfiguration config, Player player, LocalSession session, Location clicked);
|
||||
@Deprecated
|
||||
default boolean actSecondary(Platform server, LocalConfiguration config, Player player, LocalSession session, Location clicked) {
|
||||
return actSecondary(server, config, player, session, clicked, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform the secondary action of this block tool.
|
||||
*
|
||||
* @param server The platform
|
||||
* @param config The config instance
|
||||
* @param player The player
|
||||
* @param session The local session
|
||||
* @param clicked The location that was clicked
|
||||
* @param face The face that was clicked
|
||||
* @return true to cancel the original event which triggered this action (if possible)
|
||||
* @apiNote This must be overridden by new subclasses. See {@link NonAbstractForCompatibility}
|
||||
* for details
|
||||
*/
|
||||
@NonAbstractForCompatibility(
|
||||
delegateName = "actSecondary",
|
||||
delegateParams = { Platform.class, LocalConfiguration.class, Player.class, LocalSession.class, Location.class }
|
||||
)
|
||||
default boolean actSecondary(Platform server, LocalConfiguration config, Player player, LocalSession session, Location clicked, @Nullable Direction face) {
|
||||
DeprecationUtil.checkDelegatingOverride(getClass());
|
||||
return actSecondary(server, config, player, session, clicked);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -32,10 +32,10 @@ public interface DoubleActionTraceTool extends TraceTool {
|
||||
/**
|
||||
* Perform the secondary function of this tool.
|
||||
*
|
||||
* @param server
|
||||
* @param config
|
||||
* @param player
|
||||
* @param session
|
||||
* @param server The platform
|
||||
* @param config The config instance
|
||||
* @param player The player
|
||||
* @param session The local session
|
||||
* @return true to cancel the original event which triggered this action (if possible)
|
||||
*/
|
||||
boolean actSecondary(Platform server, LocalConfiguration config, Player player, LocalSession session);
|
||||
|
@ -19,9 +19,7 @@
|
||||
|
||||
package com.sk89q.worldedit.command.tool;
|
||||
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.boydti.fawe.object.collection.LocalBlockVectorSet;
|
||||
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.LocalConfiguration;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
@ -32,24 +30,26 @@ import com.sk89q.worldedit.extension.platform.Platform;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.util.Direction;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.block.BlockCategories;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* A pickaxe mode that removes floating treetops (logs and leaves not connected
|
||||
* to anything else)
|
||||
* to anything else).
|
||||
*/
|
||||
public class FloatingTreeRemover implements BlockTool {
|
||||
private int rangeSq;
|
||||
private final int rangeSq;
|
||||
|
||||
public FloatingTreeRemover() {
|
||||
rangeSq = 100*100;
|
||||
rangeSq = 100 * 100;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -68,7 +68,8 @@ public class FloatingTreeRemover implements BlockTool {
|
||||
|
||||
@Override
|
||||
public boolean actPrimary(Platform server, LocalConfiguration config,
|
||||
Player player, LocalSession session, Location clicked) {
|
||||
Player player, LocalSession session, Location clicked,
|
||||
@Nullable Direction face) {
|
||||
|
||||
final World world = (World) clicked.getExtent();
|
||||
final BlockState state = world.getBlock(clicked.toVector().toBlockPoint());
|
||||
@ -102,7 +103,7 @@ public class FloatingTreeRemover implements BlockTool {
|
||||
return true;
|
||||
}
|
||||
|
||||
private BlockVector3[] recurseDirections = {
|
||||
private final BlockVector3[] recurseDirections = {
|
||||
Direction.NORTH.toBlockVector(),
|
||||
Direction.EAST.toBlockVector(),
|
||||
Direction.SOUTH.toBlockVector(),
|
||||
@ -139,7 +140,8 @@ public class FloatingTreeRemover implements BlockTool {
|
||||
|
||||
if (visited.add(next)) {
|
||||
BlockState state = world.getBlock(next);
|
||||
if (state.getBlockType().getMaterial().isAir() || state.getBlockType() == BlockTypes.SNOW) {
|
||||
if (state.getBlockType().getMaterial().isAir()
|
||||
|| state.getBlockType() == BlockTypes.SNOW) {
|
||||
continue;
|
||||
}
|
||||
if (isTreeBlock(state.getBlockType())) {
|
||||
@ -147,7 +149,8 @@ public class FloatingTreeRemover implements BlockTool {
|
||||
} else {
|
||||
// we hit something solid - evaluate where we came from
|
||||
final BlockType currentType = world.getBlock(current).getBlockType();
|
||||
if (!BlockCategories.LEAVES.contains(currentType) && currentType != BlockTypes.VINE) {
|
||||
if (!BlockCategories.LEAVES.contains(currentType)
|
||||
&& currentType != BlockTypes.VINE) {
|
||||
// log/shroom touching a wall/the ground => this is not a floating tree, bail out
|
||||
return null;
|
||||
}
|
||||
|
@ -32,11 +32,13 @@ import com.sk89q.worldedit.function.operation.Operations;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.function.visitor.RecursiveVisitor;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.util.Direction;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
@ -45,8 +47,8 @@ import java.util.Set;
|
||||
*/
|
||||
public class FloodFillTool implements BlockTool {
|
||||
|
||||
private int range;
|
||||
private Pattern pattern;
|
||||
private final int range;
|
||||
private final Pattern pattern;
|
||||
|
||||
public FloodFillTool(int range, Pattern pattern) {
|
||||
this.range = range;
|
||||
@ -59,7 +61,7 @@ public class FloodFillTool implements BlockTool {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, Location clicked) {
|
||||
public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, Location clicked, @Nullable Direction face) {
|
||||
World world = (World) clicked.getExtent();
|
||||
|
||||
BlockVector3 origin = clicked.toVector().toBlockPoint();
|
||||
|
@ -19,7 +19,6 @@
|
||||
|
||||
package com.sk89q.worldedit.command.tool;
|
||||
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.LocalConfiguration;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
@ -32,6 +31,7 @@ import com.sk89q.worldedit.function.mask.Mask;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
|
||||
/**
|
||||
@ -39,8 +39,8 @@ import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
*/
|
||||
public class LongRangeBuildTool extends BrushTool implements DoubleActionTraceTool {
|
||||
|
||||
private Pattern primary;
|
||||
private Pattern secondary;
|
||||
private final Pattern primary;
|
||||
private final Pattern secondary;
|
||||
|
||||
public LongRangeBuildTool(Pattern secondary, Pattern primary) {
|
||||
super("worldedit.tool.lrbuild");
|
||||
@ -56,7 +56,9 @@ public class LongRangeBuildTool extends BrushTool implements DoubleActionTraceTo
|
||||
@Override
|
||||
public boolean actSecondary(Platform server, LocalConfiguration config, Player player, LocalSession session) {
|
||||
Location pos = getTargetFace(player);
|
||||
if (pos == null) return false;
|
||||
if (pos == null) {
|
||||
return false;
|
||||
}
|
||||
BlockBag bag = session.getBlockBag(player);
|
||||
|
||||
try (EditSession editSession = session.createEditSession(player, "LongRangeBuildTool")) {
|
||||
@ -84,7 +86,9 @@ public class LongRangeBuildTool extends BrushTool implements DoubleActionTraceTo
|
||||
@Override
|
||||
public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session) {
|
||||
Location pos = getTargetFace(player);
|
||||
if (pos == null) return false;
|
||||
if (pos == null) {
|
||||
return false;
|
||||
}
|
||||
BlockBag bag = session.getBlockBag(player);
|
||||
|
||||
try (EditSession editSession = session.createEditSession(player, "LongRangeBuildTool")) {
|
||||
|
@ -27,6 +27,7 @@ import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.extension.platform.Platform;
|
||||
import com.sk89q.worldedit.internal.block.BlockStateIdAccess;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.util.Direction;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
@ -35,8 +36,7 @@ import com.sk89q.worldedit.util.formatting.text.format.TextColor;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
import com.sk89q.worldedit.world.registry.LegacyMapper;
|
||||
|
||||
import java.util.OptionalInt;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Looks up information about a block.
|
||||
@ -49,7 +49,8 @@ public class QueryTool implements BlockTool {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, Location clicked) {
|
||||
public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, Location clicked, @Nullable
|
||||
Direction face) {
|
||||
|
||||
World world = (World) clicked.getExtent();
|
||||
EditSession editSession = session.createEditSession(player);
|
||||
@ -60,21 +61,21 @@ public class QueryTool implements BlockTool {
|
||||
builder.append(TextComponent.of("@" + clicked.toVector().toBlockPoint() + ": ", TextColor.BLUE));
|
||||
builder.append(TextComponent.of(block.getBlockType().getName(), TextColor.YELLOW));
|
||||
builder.append(TextComponent.of(" (" + block + ") ", TextColor.GRAY)
|
||||
.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TranslatableComponent.of("worldedit.tool.info.blockstate.hover"))));
|
||||
.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TranslatableComponent.of("worldedit.tool.info.blockstate.hover"))));
|
||||
final int internalId = BlockStateIdAccess.getBlockStateId(block.toImmutableState());
|
||||
if (BlockStateIdAccess.isValidInternalId(internalId)) {
|
||||
builder.append(TextComponent.of(" (" + internalId+ ") ", TextColor.DARK_GRAY)
|
||||
.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TranslatableComponent.of("worldedit.tool.info.internalid.hover"))));
|
||||
builder.append(TextComponent.of(" (" + internalId + ") ", TextColor.DARK_GRAY)
|
||||
.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TranslatableComponent.of("worldedit.tool.info.internalid.hover"))));
|
||||
}
|
||||
final int[] legacy = LegacyMapper.getInstance().getLegacyFromBlock(block.toImmutableState());
|
||||
if (legacy != null) {
|
||||
builder.append(TextComponent.of(" (" + legacy[0] + ":" + legacy[1] + ") ", TextColor.DARK_GRAY)
|
||||
.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TranslatableComponent.of("worldedit.tool.info.legacy.hover"))));
|
||||
.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TranslatableComponent.of("worldedit.tool.info.legacy.hover"))));
|
||||
}
|
||||
|
||||
builder.append(TextComponent.of(" (" + world.getBlockLightLevel(blockPoint) + "/"
|
||||
+ world.getBlockLightLevel(blockPoint.add(0, 1, 0)) + ")", TextColor.WHITE)
|
||||
.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TranslatableComponent.of("worldedit.tool.info.light.hover"))));
|
||||
+ world.getBlockLightLevel(blockPoint.add(0, 1, 0)) + ")", TextColor.WHITE)
|
||||
.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TranslatableComponent.of("worldedit.tool.info.light.hover"))));
|
||||
|
||||
player.print(builder.build());
|
||||
|
||||
|
@ -28,14 +28,14 @@ import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.extension.platform.Platform;
|
||||
import com.sk89q.worldedit.function.block.BlockReplace;
|
||||
import com.sk89q.worldedit.function.operation.Operations;
|
||||
import com.sk89q.worldedit.function.visitor.RecursiveVisitor;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.util.Direction;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
@ -45,7 +45,7 @@ import java.util.Set;
|
||||
*/
|
||||
public class RecursivePickaxe implements BlockTool {
|
||||
|
||||
private double range;
|
||||
private final double range;
|
||||
|
||||
public RecursivePickaxe(double range) {
|
||||
this.range = range;
|
||||
@ -57,7 +57,7 @@ public class RecursivePickaxe implements BlockTool {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, Location clicked) {
|
||||
public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, Location clicked, @Nullable Direction face) {
|
||||
World world = (World) clicked.getExtent();
|
||||
final BlockVector3 pos = clicked.toBlockPoint();
|
||||
|
||||
@ -94,7 +94,7 @@ public class RecursivePickaxe implements BlockTool {
|
||||
BlockVector3 origin, double size, BlockType initialType, Set<BlockVector3> visited) throws MaxChangedBlocksException {
|
||||
|
||||
final double distanceSq = origin.distanceSq(pos);
|
||||
if (distanceSq > size*size || visited.contains(pos)) {
|
||||
if (distanceSq > size * size || visited.contains(pos)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,6 @@ import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.extension.platform.Platform;
|
||||
import com.sk89q.worldedit.extension.platform.PlatformManager;
|
||||
import com.sk89q.worldedit.extension.platform.permission.ActorSelectorLimits;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.RegionSelector;
|
||||
|
@ -30,7 +30,7 @@ public interface Tool {
|
||||
/**
|
||||
* Checks to see if the player can still be using this tool (considering
|
||||
* permissions and such).
|
||||
*
|
||||
*
|
||||
* @param actor the actor
|
||||
* @return true if use is permitted
|
||||
*/
|
||||
|
@ -29,10 +29,10 @@ public interface TraceTool extends Tool {
|
||||
/**
|
||||
* Perform the primary action of this trace tool.
|
||||
*
|
||||
* @param server
|
||||
* @param config
|
||||
* @param player
|
||||
* @param session
|
||||
* @param server The platform
|
||||
* @param config The config instance
|
||||
* @param player The player
|
||||
* @param session The local session
|
||||
* @return true to cancel the original event which triggered this action (if possible)
|
||||
*/
|
||||
boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session);
|
||||
|
@ -31,12 +31,12 @@ public interface Brush {
|
||||
|
||||
/**
|
||||
* Build the object.
|
||||
*
|
||||
*
|
||||
* @param editSession the {@code EditSession}
|
||||
* @param position the position
|
||||
* @param pattern the pattern
|
||||
* @param size the size of the brush
|
||||
* @throws MaxChangedBlocksException
|
||||
* @throws MaxChangedBlocksException if the maximum block change limit is exceeded
|
||||
*/
|
||||
void build(EditSession editSession, BlockVector3 position, Pattern pattern, double size) throws MaxChangedBlocksException;
|
||||
|
||||
|
@ -23,12 +23,6 @@ import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.util.LocatedBlock;
|
||||
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
import com.sk89q.worldedit.util.collection.LocatedBlockList;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
|
||||
|
@ -33,10 +33,10 @@ import com.sk89q.worldedit.util.task.FutureForwardingTask;
|
||||
import com.sk89q.worldedit.util.task.Supervisor;
|
||||
import org.enginehub.piston.exception.CommandException;
|
||||
import org.enginehub.piston.exception.CommandExecutionException;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
@ -133,6 +133,7 @@ public final class AsyncCommandBuilder<T> {
|
||||
return future;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private T runTask() {
|
||||
T result = null;
|
||||
try {
|
||||
@ -183,6 +184,7 @@ public final class AsyncCommandBuilder<T> {
|
||||
// com.sk89q.minecraft.util.commands.CommandException. the ExceptionConverter currently expects converted
|
||||
// exceptions to be org.enginehub.piston.CommandException, throw it wraps the resulting InvocationTargetException in
|
||||
// a CommandExecutionException. here, we unwrap those layers to retrieve the original WG error message
|
||||
@SuppressWarnings("deprecation")
|
||||
private Component tryExtractOldCommandException(CommandException converted) {
|
||||
Component message = null;
|
||||
if (converted instanceof CommandExecutionException) {
|
||||
|
@ -51,7 +51,9 @@ public class CreatureButcher {
|
||||
}
|
||||
|
||||
public void or(int flag, boolean on) {
|
||||
if (on) flags |= flag;
|
||||
if (on) {
|
||||
flags |= flag;
|
||||
}
|
||||
}
|
||||
|
||||
public void or(int flag, boolean on, String permission) {
|
||||
|
@ -23,8 +23,8 @@ import com.boydti.fawe.util.TaskManager;
|
||||
import com.sk89q.worldedit.entity.metadata.EntityProperties;
|
||||
import com.sk89q.worldedit.function.EntityFunction;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.regex.Pattern;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
|
@ -19,8 +19,6 @@
|
||||
|
||||
package com.sk89q.worldedit.command.util;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
import com.google.common.util.concurrent.MoreExecutors;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
@ -29,6 +27,8 @@ import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
|
||||
import java.util.Timer;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
public class FutureProgressListener implements Runnable {
|
||||
|
||||
private static final Timer timer = new Timer();
|
||||
|
@ -33,27 +33,27 @@ public @interface Logging {
|
||||
|
||||
enum LogMode {
|
||||
/**
|
||||
* Player position
|
||||
* Player position.
|
||||
*/
|
||||
POSITION,
|
||||
|
||||
/**
|
||||
* Region selection
|
||||
* Region selection.
|
||||
*/
|
||||
REGION,
|
||||
|
||||
/**
|
||||
* Player orientation and region selection
|
||||
* Player orientation and region selection.
|
||||
*/
|
||||
ORIENTATION_REGION,
|
||||
|
||||
/**
|
||||
* Either the player position or pos1, depending on the placeAtPos1 flag
|
||||
* Either the player position or pos1, depending on the placeAtPos1 flag.
|
||||
*/
|
||||
PLACEMENT,
|
||||
|
||||
/**
|
||||
* Log all information available
|
||||
* Log all information available.
|
||||
*/
|
||||
ALL
|
||||
}
|
||||
|
@ -19,14 +19,14 @@
|
||||
|
||||
package com.sk89q.worldedit.command.util;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.util.formatting.text.Component;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
|
||||
import java.util.TimerTask;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
public class MessageTimerTask extends TimerTask {
|
||||
|
||||
private final Actor sender;
|
||||
|
@ -48,8 +48,8 @@ public class PermissionCondition implements Command.Condition {
|
||||
|
||||
@Override
|
||||
public boolean satisfied(InjectedValueAccess context) {
|
||||
return permissions.isEmpty() ||
|
||||
context.injectedValue(ACTOR_KEY)
|
||||
return permissions.isEmpty()
|
||||
|| context.injectedValue(ACTOR_KEY)
|
||||
.map(actor -> permissions.stream().anyMatch(actor::hasPermission))
|
||||
.orElse(false);
|
||||
}
|
||||
|
@ -19,10 +19,6 @@
|
||||
|
||||
package com.sk89q.worldedit.command.util;
|
||||
|
||||
import static com.sk89q.worldedit.internal.command.CommandUtil.byCleanName;
|
||||
import static com.sk89q.worldedit.internal.command.CommandUtil.getSubCommands;
|
||||
import static java.util.stream.Collectors.toList;
|
||||
|
||||
import com.google.common.base.Joiner;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.Iterables;
|
||||
@ -42,6 +38,10 @@ import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static com.sk89q.worldedit.internal.command.CommandUtil.byCleanName;
|
||||
import static com.sk89q.worldedit.internal.command.CommandUtil.getSubCommands;
|
||||
import static java.util.stream.Collectors.toList;
|
||||
|
||||
/**
|
||||
* Implementation of the //help command.
|
||||
*/
|
||||
|
@ -24,8 +24,8 @@ import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.util.formatting.text.Component;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.concurrent.Callable;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* For internal WorldEdit use only.
|
||||
|
@ -1,7 +1,6 @@
|
||||
package com.sk89q.worldedit.command.util.annotation;
|
||||
|
||||
import com.boydti.fawe.config.Caption;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.boydti.fawe.util.task.InterruptableCondition;
|
||||
import com.sk89q.worldedit.IncompleteRegionException;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
@ -15,6 +14,7 @@ import com.sk89q.worldedit.internal.util.Substring;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import org.enginehub.piston.exception.StopExecutionException;
|
||||
import org.enginehub.piston.inject.InjectAnnotation;
|
||||
import org.enginehub.piston.inject.InjectedValueAccess;
|
||||
@ -33,7 +33,10 @@ import java.util.stream.Stream;
|
||||
* Indicates how the affected blocks should be hinted at in the log.
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ElementType.PARAMETER, ElementType.METHOD})
|
||||
@Target({
|
||||
ElementType.PARAMETER,
|
||||
ElementType.METHOD
|
||||
})
|
||||
@InjectAnnotation
|
||||
public @interface Confirm {
|
||||
Processor value() default Processor.ALWAYS;
|
||||
@ -45,10 +48,11 @@ public @interface Confirm {
|
||||
Region region = context.injectedValue(Key.of(Region.class, Selection.class)).orElseThrow(IncompleteRegionException::new);
|
||||
BlockVector3 pos1 = region.getMinimumPoint();
|
||||
BlockVector3 pos2 = region.getMaximumPoint();
|
||||
long area = (pos2.getX() - pos1.getX()) * (pos2.getZ() - pos1.getZ() + 1) * (long) value;
|
||||
long area = (pos2.getX() - pos1.getX()) * (pos2.getZ() - pos1.getZ() + 1)
|
||||
* (long) value;
|
||||
long max = 2 << 18;
|
||||
if (max != -1 && area > max) {
|
||||
actor.print(Caption.of("fawe.cancel.worldedit.cancel.reason.confirm.region" , pos1, pos2, getArgs(context)));
|
||||
actor.print(Caption.of("fawe.cancel.worldedit.cancel.reason.confirm.region", pos1, pos2, getArgs(context)));
|
||||
return confirm(actor, context);
|
||||
}
|
||||
return true;
|
||||
@ -59,7 +63,7 @@ public @interface Confirm {
|
||||
public boolean passes(Actor actor, InjectedValueAccess context, double value) {
|
||||
int max = WorldEdit.getInstance().getConfiguration().maxRadius;
|
||||
if (max != -1 && value > max) {
|
||||
actor.print(Caption.of("fawe.cancel.worldedit.cancel.reason.confirm.region" , value, max, getArgs(context)));
|
||||
actor.print(Caption.of("fawe.cancel.worldedit.cancel.reason.confirm.region", value, max, getArgs(context)));
|
||||
return Processor.confirm(actor, context);
|
||||
}
|
||||
return true;
|
||||
@ -68,9 +72,9 @@ public @interface Confirm {
|
||||
LIMIT {
|
||||
@Override
|
||||
public boolean passes(Actor actor, InjectedValueAccess context, double value) {
|
||||
int max = 50;// TODO configurable, get Key.of(Method.class) @Limit
|
||||
int max = 50; //TODO configurable, get Key.of(Method.class) @Limit
|
||||
if (max != -1 && value > max) {
|
||||
actor.print(Caption.of("fawe.cancel.worldedit.cancel.reason.confirm.region" , value, max, getArgs(context)));
|
||||
actor.print(Caption.of("fawe.cancel.worldedit.cancel.reason.confirm.region", value, max, getArgs(context)));
|
||||
return Processor.confirm(actor, context);
|
||||
}
|
||||
return true;
|
||||
@ -82,10 +86,11 @@ public @interface Confirm {
|
||||
actor.print(TranslatableComponent.of("fawe.cancel.worldedit.cancel.reason.confirm"));
|
||||
return confirm(actor, context);
|
||||
}
|
||||
}
|
||||
;
|
||||
};
|
||||
|
||||
public boolean passes(Actor actor, InjectedValueAccess context, double value){return true;}
|
||||
public boolean passes(Actor actor, InjectedValueAccess context, double value) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public <T extends Number> T check(Actor actor, InjectedValueAccess context, T value) {
|
||||
if (!passes(actor, context, value.doubleValue())) {
|
||||
@ -125,8 +130,8 @@ public @interface Confirm {
|
||||
if (condition.await(15, TimeUnit.SECONDS)) {
|
||||
return true;
|
||||
}
|
||||
} catch (InterruptedException e) {}
|
||||
finally {
|
||||
} catch (InterruptedException ignored) {
|
||||
} finally {
|
||||
if (actor.getMeta("cmdConfirm") == wait) {
|
||||
actor.deleteMeta("cmdConfirm");
|
||||
}
|
||||
|
@ -19,8 +19,6 @@
|
||||
|
||||
package com.sk89q.worldedit.entity;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
@ -30,6 +28,8 @@ import com.sk89q.worldedit.world.entity.EntityTypes;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
/**
|
||||
* Represents a mutable "snapshot" of an entity.
|
||||
*
|
||||
|
@ -23,6 +23,7 @@ import com.sk89q.worldedit.extension.platform.Locatable;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.util.Faceted;
|
||||
import com.sk89q.worldedit.world.entity.EntityType;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
|
@ -5,8 +5,8 @@ import com.boydti.fawe.util.TaskManager;
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.worldedit.world.entity.EntityType;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.function.Supplier;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class LazyBaseEntity extends BaseEntity {
|
||||
private Supplier<CompoundTag> saveTag;
|
||||
|
@ -1,8 +1,9 @@
|
||||
package com.sk89q.worldedit.entity;
|
||||
|
||||
import java.util.Map;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public interface MapMetadatable extends Metadatable {
|
||||
|
||||
Map<String, Object> getRawMeta();
|
||||
|
@ -25,7 +25,6 @@ import com.boydti.fawe.object.brush.visualization.VirtualWorld;
|
||||
import com.boydti.fawe.object.clipboard.DiskOptimizedClipboard;
|
||||
import com.boydti.fawe.regions.FaweMaskManager;
|
||||
import com.boydti.fawe.util.MainUtil;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.EmptyClipboardException;
|
||||
import com.sk89q.worldedit.IncompleteRegionException;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
@ -43,7 +42,6 @@ import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.regions.RegionSelector;
|
||||
import com.sk89q.worldedit.session.ClipboardHolder;
|
||||
import com.sk89q.worldedit.session.request.Request;
|
||||
import com.sk89q.worldedit.util.Direction;
|
||||
import com.sk89q.worldedit.util.HandSide;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
@ -53,9 +51,8 @@ import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.gamemode.GameMode;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* Represents a player
|
||||
|
@ -27,7 +27,7 @@ import com.sk89q.worldedit.WorldEdit;
|
||||
public abstract class Event {
|
||||
|
||||
/**
|
||||
* Returns true if this event was called and not cancelled
|
||||
* Returns true if this event was called and not cancelled.
|
||||
* @return !isCancelled
|
||||
*/
|
||||
public boolean call() {
|
||||
|
@ -1,6 +1,5 @@
|
||||
package com.sk89q.worldedit.event.extent;
|
||||
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.event.Cancellable;
|
||||
import com.sk89q.worldedit.event.Event;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
@ -11,7 +10,8 @@ import java.net.URI;
|
||||
public class ActorSaveClipboardEvent extends Event implements Cancellable {
|
||||
private final Actor actor;
|
||||
private final Clipboard clipboard;
|
||||
private final URI source, destination;
|
||||
private final URI source;
|
||||
private final URI destination;
|
||||
private boolean cancelled;
|
||||
|
||||
public ActorSaveClipboardEvent(Actor actor, Clipboard clipboard, URI source, URI destination) {
|
||||
|
@ -19,9 +19,7 @@
|
||||
|
||||
package com.sk89q.worldedit.event.extent;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import static com.sk89q.worldedit.EditSession.Stage;
|
||||
import com.sk89q.worldedit.event.Cancellable;
|
||||
import com.sk89q.worldedit.event.Event;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
@ -32,6 +30,9 @@ import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static com.sk89q.worldedit.EditSession.Stage;
|
||||
|
||||
/**
|
||||
* Raised (several times) when a new {@link EditSession} is being instantiated.
|
||||
*
|
||||
|
@ -19,16 +19,17 @@
|
||||
|
||||
package com.sk89q.worldedit.event.extent;
|
||||
|
||||
import static com.sk89q.worldedit.EditSession.Stage;
|
||||
|
||||
import com.sk89q.worldedit.event.Cancellable;
|
||||
import com.sk89q.worldedit.event.Event;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
import static com.sk89q.worldedit.EditSession.Stage;
|
||||
|
||||
public class PasteEvent extends Event implements Cancellable {
|
||||
|
||||
private final Actor actor;
|
||||
|
@ -19,13 +19,16 @@
|
||||
|
||||
package com.sk89q.worldedit.event.platform;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.sk89q.worldedit.event.Cancellable;
|
||||
import com.sk89q.worldedit.event.Event;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.util.Direction;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
/**
|
||||
* Called when a block is interacted with.
|
||||
*/
|
||||
@ -34,6 +37,7 @@ public class BlockInteractEvent extends Event implements Cancellable {
|
||||
private final Actor cause;
|
||||
private final Location location;
|
||||
private final Interaction type;
|
||||
private final Direction face;
|
||||
private boolean cancelled;
|
||||
|
||||
/**
|
||||
@ -43,12 +47,26 @@ public class BlockInteractEvent extends Event implements Cancellable {
|
||||
* @param location the location of the block
|
||||
* @param type the type of interaction
|
||||
*/
|
||||
@Deprecated
|
||||
public BlockInteractEvent(Actor cause, Location location, Interaction type) {
|
||||
this(cause, location, null, type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new event.
|
||||
*
|
||||
* @param cause the causing actor
|
||||
* @param location the location of the block
|
||||
* @param face the face of the block that was interacted with
|
||||
* @param type the type of interaction
|
||||
*/
|
||||
public BlockInteractEvent(Actor cause, Location location, @Nullable Direction face, Interaction type) {
|
||||
checkNotNull(cause);
|
||||
checkNotNull(location);
|
||||
checkNotNull(type);
|
||||
this.cause = cause;
|
||||
this.location = location;
|
||||
this.face = face;
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@ -70,6 +88,16 @@ public class BlockInteractEvent extends Event implements Cancellable {
|
||||
return location;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the face of the block that was interacted with.
|
||||
*
|
||||
* @return The interacted face
|
||||
*/
|
||||
@Nullable
|
||||
public Direction getFace() {
|
||||
return face;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the type of interaction.
|
||||
*
|
||||
|
@ -18,6 +18,7 @@
|
||||
*/
|
||||
|
||||
package com.sk89q.worldedit.event.platform;
|
||||
|
||||
import com.sk89q.worldedit.event.Event;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.internal.util.Substring;
|
||||
|
@ -19,11 +19,11 @@
|
||||
|
||||
package com.sk89q.worldedit.event.platform;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.sk89q.worldedit.LocalConfiguration;
|
||||
import com.sk89q.worldedit.event.Event;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
/**
|
||||
* Raised when the configuration has been loaded or re-loaded.
|
||||
*/
|
||||
|
@ -19,12 +19,12 @@
|
||||
|
||||
package com.sk89q.worldedit.event.platform;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.event.Cancellable;
|
||||
import com.sk89q.worldedit.event.Event;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
/**
|
||||
* Raised whenever a player sends input.
|
||||
*/
|
||||
|
@ -20,7 +20,27 @@
|
||||
package com.sk89q.worldedit.extension.factory;
|
||||
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.extension.factory.parser.mask.*;
|
||||
import com.sk89q.worldedit.extension.factory.parser.mask.AirMaskParser;
|
||||
import com.sk89q.worldedit.extension.factory.parser.mask.AngleMaskParser;
|
||||
import com.sk89q.worldedit.extension.factory.parser.mask.BiomeMaskParser;
|
||||
import com.sk89q.worldedit.extension.factory.parser.mask.BlockCategoryMaskParser;
|
||||
import com.sk89q.worldedit.extension.factory.parser.mask.BlockStateMaskParser;
|
||||
import com.sk89q.worldedit.extension.factory.parser.mask.BlocksMaskParser;
|
||||
import com.sk89q.worldedit.extension.factory.parser.mask.ExistingMaskParser;
|
||||
import com.sk89q.worldedit.extension.factory.parser.mask.ExpressionMaskParser;
|
||||
import com.sk89q.worldedit.extension.factory.parser.mask.FalseMaskParser;
|
||||
import com.sk89q.worldedit.extension.factory.parser.mask.LazyRegionMaskParser;
|
||||
import com.sk89q.worldedit.extension.factory.parser.mask.LiquidMaskParser;
|
||||
import com.sk89q.worldedit.extension.factory.parser.mask.NegateMaskParser;
|
||||
import com.sk89q.worldedit.extension.factory.parser.mask.NoiseMaskParser;
|
||||
import com.sk89q.worldedit.extension.factory.parser.mask.OffsetMaskParser;
|
||||
import com.sk89q.worldedit.extension.factory.parser.mask.RegionMaskParser;
|
||||
import com.sk89q.worldedit.extension.factory.parser.mask.SimplexMaskParser;
|
||||
import com.sk89q.worldedit.extension.factory.parser.mask.SolidMaskParser;
|
||||
import com.sk89q.worldedit.extension.factory.parser.mask.TrueMaskParser;
|
||||
import com.sk89q.worldedit.extension.factory.parser.mask.XAxisMaskParser;
|
||||
import com.sk89q.worldedit.extension.factory.parser.mask.YAxisMaskParser;
|
||||
import com.sk89q.worldedit.extension.factory.parser.mask.ZAxisMaskParser;
|
||||
import com.sk89q.worldedit.extension.input.InputParseException;
|
||||
import com.sk89q.worldedit.extension.input.NoMatchException;
|
||||
import com.sk89q.worldedit.extension.input.ParserContext;
|
||||
|
@ -20,13 +20,11 @@
|
||||
package com.sk89q.worldedit.extension.factory.parser;
|
||||
|
||||
import com.boydti.fawe.config.Caption;
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
import com.boydti.fawe.jnbt.JSON2NBT;
|
||||
import com.boydti.fawe.jnbt.NBTException;
|
||||
import com.boydti.fawe.util.MathMan;
|
||||
import com.boydti.fawe.util.StringMan;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.worldedit.IncompleteRegionException;
|
||||
import com.sk89q.worldedit.NotABlockException;
|
||||
@ -58,14 +56,13 @@ import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
import com.sk89q.worldedit.world.block.FuzzyBlockState;
|
||||
import com.sk89q.worldedit.world.entity.EntityType;
|
||||
import com.sk89q.worldedit.world.entity.EntityTypes;
|
||||
import com.sk89q.worldedit.world.registry.LegacyMapper;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import com.sk89q.worldedit.world.entity.EntityType;
|
||||
import com.sk89q.worldedit.world.entity.EntityTypes;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
|
@ -1,12 +1,12 @@
|
||||
package com.sk89q.worldedit.extension.factory.parser.mask;
|
||||
|
||||
import com.boydti.fawe.function.mask.AirMask;
|
||||
import com.boydti.fawe.function.mask.LiquidMask;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.extension.input.ParserContext;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
import com.sk89q.worldedit.internal.registry.SimpleInputParser;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class AirMaskParser extends SimpleInputParser<Mask> {
|
||||
|
@ -21,7 +21,6 @@ package com.sk89q.worldedit.extension.factory.parser.mask;
|
||||
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.extension.input.InputParseException;
|
||||
import com.sk89q.worldedit.extension.input.NoMatchException;
|
||||
import com.sk89q.worldedit.extension.input.ParserContext;
|
||||
import com.sk89q.worldedit.function.mask.BlockMask;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
|
@ -5,7 +5,6 @@ import com.google.common.collect.ImmutableList;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.extension.input.ParserContext;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
import com.sk89q.worldedit.function.mask.SolidBlockMask;
|
||||
import com.sk89q.worldedit.internal.registry.SimpleInputParser;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -19,7 +19,6 @@
|
||||
|
||||
package com.sk89q.worldedit.extension.factory.parser.mask;
|
||||
|
||||
import com.boydti.fawe.function.mask.XAxisMask;
|
||||
import com.boydti.fawe.function.mask.YAxisMask;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user