mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-02 19:36:41 +00:00
Part 1 of upstream merge and format
This commit is contained in:
@ -38,7 +38,6 @@ import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
import java.nio.file.StandardOpenOption;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
@ -23,9 +23,9 @@ import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.registry.BlockRegistry;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.BitSet;
|
||||
import java.util.OptionalInt;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkState;
|
||||
|
||||
|
@ -22,13 +22,13 @@ package com.sk89q.worldedit.internal.command;
|
||||
import com.sk89q.worldedit.command.util.annotation.Confirm;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import java.util.Optional;
|
||||
import org.enginehub.piston.CommandParameters;
|
||||
import org.enginehub.piston.exception.StopExecutionException;
|
||||
import org.enginehub.piston.gen.CommandCallListener;
|
||||
import org.enginehub.piston.inject.Key;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* Logs called commands to a logger.
|
||||
|
@ -2,13 +2,11 @@ package com.sk89q.worldedit.internal.command;
|
||||
|
||||
import org.enginehub.piston.CommandParameters;
|
||||
import org.enginehub.piston.gen.CommandCallListener;
|
||||
import org.enginehub.piston.inject.InjectedValueAccess;
|
||||
import org.enginehub.piston.inject.InjectedValueStore;
|
||||
import org.enginehub.piston.inject.Key;
|
||||
import org.enginehub.piston.util.ValueProvider;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Optional;
|
||||
|
||||
public class MethodInjector implements CommandCallListener {
|
||||
@Override
|
||||
|
@ -38,7 +38,6 @@ import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
|
@ -30,7 +30,6 @@ import it.unimi.dsi.fastutil.doubles.Double2ObjectMaps;
|
||||
import org.antlr.v4.runtime.ParserRuleContext;
|
||||
import org.antlr.v4.runtime.Token;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.lang.invoke.MethodHandle;
|
||||
import java.lang.invoke.MethodHandles;
|
||||
import java.lang.invoke.MethodType;
|
||||
@ -38,6 +37,7 @@ import java.util.Objects;
|
||||
import java.util.function.DoubleBinaryOperator;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import static com.sk89q.worldedit.internal.expression.ExpressionHelper.check;
|
||||
import static com.sk89q.worldedit.internal.expression.ExpressionHelper.checkIterations;
|
||||
|
@ -22,9 +22,11 @@ package com.sk89q.worldedit.internal.expression.invoke;
|
||||
/**
|
||||
* Thrown when a return is encountered, to pop the stack frames and return the value easily.
|
||||
*
|
||||
* <p>
|
||||
* Should be caught by the executor.
|
||||
* </p>
|
||||
*/
|
||||
class ReturnException extends RuntimeException {
|
||||
public class ReturnException extends RuntimeException {
|
||||
|
||||
private final Double result;
|
||||
|
||||
|
@ -19,8 +19,6 @@
|
||||
|
||||
package com.sk89q.worldedit.internal.registry;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.extension.input.InputParseException;
|
||||
import com.sk89q.worldedit.extension.input.NoMatchException;
|
||||
@ -31,6 +29,8 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
/**
|
||||
* An abstract implementation of a factory for internal usage.
|
||||
*
|
||||
@ -58,7 +58,9 @@ public abstract class AbstractFactory<E> {
|
||||
/**
|
||||
* Gets an immutable list of parsers.
|
||||
*
|
||||
* <p>
|
||||
* To add parsers, use the register method.
|
||||
* </p>
|
||||
*
|
||||
* @return the parsers
|
||||
*/
|
||||
@ -82,12 +84,12 @@ public abstract class AbstractFactory<E> {
|
||||
|
||||
public List<String> getSuggestions(String input) {
|
||||
return parsers.stream().flatMap(
|
||||
p -> p.getSuggestions(input)
|
||||
p -> p.getSuggestions(input)
|
||||
).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers an InputParser to this factory
|
||||
* Registers an InputParser to this factory.
|
||||
*
|
||||
* @param inputParser The input parser
|
||||
*/
|
||||
|
@ -25,7 +25,7 @@ public class BiomeMath {
|
||||
|
||||
// From BiomeArray / BiomeContainer
|
||||
public static final int HORIZONTAL_SECTION_COUNT = (int) Math.round(Math.log(16.0D) / Math.log(2.0D)) - 2;
|
||||
public static final int VERTICAL_SECTION_COUNT = (int)Math.round(Math.log(256.0D) / Math.log(2.0D)) - 2;
|
||||
public static final int VERTICAL_SECTION_COUNT = (int) Math.round(Math.log(256.0D) / Math.log(2.0D)) - 2;
|
||||
public static final int HORIZONTAL_BIT_MASK = (1 << HORIZONTAL_SECTION_COUNT) - 1;
|
||||
public static final int VERTICAL_BIT_MASK = (1 << VERTICAL_SECTION_COUNT) - 1;
|
||||
|
||||
@ -41,9 +41,9 @@ public class BiomeMath {
|
||||
* @return the index into the standard MC biome array
|
||||
*/
|
||||
public static int computeBiomeIndex(int x, int y, int z) {
|
||||
int l = x & HORIZONTAL_BIT_MASK;
|
||||
int m = MathHelper.clamp(y, 0, VERTICAL_BIT_MASK);
|
||||
int n = z & HORIZONTAL_BIT_MASK;
|
||||
int l = (x >> 2) & HORIZONTAL_BIT_MASK;
|
||||
int m = MathHelper.clamp(y >> 2, 0, VERTICAL_BIT_MASK);
|
||||
int n = (z >> 2) & HORIZONTAL_BIT_MASK;
|
||||
return m << HORIZONTAL_SECTION_COUNT + HORIZONTAL_SECTION_COUNT
|
||||
| n << HORIZONTAL_SECTION_COUNT
|
||||
| l;
|
||||
|
@ -21,6 +21,9 @@ package com.sk89q.worldedit.internal.util;
|
||||
|
||||
import com.google.common.base.Joiner;
|
||||
import com.google.common.base.Throwables;
|
||||
import com.sk89q.worldedit.world.block.BlockCategories;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.stream.Stream;
|
||||
@ -73,13 +76,13 @@ public class DeprecationUtil {
|
||||
throw new AssertionError("Caller class missing?", e);
|
||||
}
|
||||
for (Method declaredMethod : declaredMethods) {
|
||||
if (declaredMethod.isAnnotationPresent(NonAbstractForCompatibility.class) &&
|
||||
declaredMethod.getName().equals(callerInfo.getMethodName())) {
|
||||
if (declaredMethod.isAnnotationPresent(NonAbstractForCompatibility.class)
|
||||
&& declaredMethod.getName().equals(callerInfo.getMethodName())) {
|
||||
return declaredMethod;
|
||||
}
|
||||
}
|
||||
throw new IllegalStateException("Failed to find caller method " +
|
||||
callerInfo.getMethodName() + " annotated with " + NonAbstractForCompatibility.class);
|
||||
throw new IllegalStateException("Failed to find caller method "
|
||||
+ callerInfo.getMethodName() + " annotated with " + NonAbstractForCompatibility.class);
|
||||
}
|
||||
|
||||
private static String methodToString(Method method) {
|
||||
@ -94,4 +97,13 @@ public class DeprecationUtil {
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
public static boolean isSign(BlockType blockType) {
|
||||
@SuppressWarnings("deprecation")
|
||||
BlockType sign = BlockTypes.SIGN;
|
||||
@SuppressWarnings("deprecation")
|
||||
BlockType wallSign = BlockTypes.WALL_SIGN;
|
||||
return blockType == sign || blockType == wallSign
|
||||
|| BlockCategories.SIGNS.contains(blockType);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -77,12 +77,16 @@ public final class Substring {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
Substring substring1 = (Substring) o;
|
||||
return start == substring1.start &&
|
||||
end == substring1.end &&
|
||||
substring.equals(substring1.substring);
|
||||
return start == substring1.start
|
||||
&& end == substring1.end
|
||||
&& substring.equals(substring1.substring);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -92,10 +96,10 @@ public final class Substring {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Substring{" +
|
||||
"substring='" + substring + "'" +
|
||||
",start=" + start +
|
||||
",end=" + end +
|
||||
"}";
|
||||
return "Substring{"
|
||||
+ "substring='" + substring + "'"
|
||||
+ ",start=" + start
|
||||
+ ",end=" + end
|
||||
+ "}";
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user