mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-01 02:46:41 +00:00
More deprecation removal
This commit is contained in:
@ -37,7 +37,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
||||
/**
|
||||
* Adapts {@link Platform}s into the legacy {@link ServerInterface}.
|
||||
*/
|
||||
@SuppressWarnings("ALL")
|
||||
public class ServerInterfaceAdapter extends ServerInterface {
|
||||
|
||||
private final Platform platform;
|
||||
|
@ -99,7 +99,7 @@ public class CommandLoggingHandler extends AbstractInvokeListener implements Inv
|
||||
}
|
||||
|
||||
if (logMode != null && sender.isPlayer()) {
|
||||
Vector position = player.getPosition().toVector();
|
||||
Vector position = player.getLocation().toVector();
|
||||
LocalSession session = worldEdit.getSessionManager().get(player);
|
||||
|
||||
switch (logMode) {
|
||||
|
@ -56,7 +56,7 @@ public class UserCommandCompleter implements CommandCompleter {
|
||||
public List<String> getSuggestions(String arguments, CommandLocals locals) throws CommandException {
|
||||
Platform platform = platformManager.queryCapability(Capability.USER_COMMANDS);
|
||||
if (platform instanceof MultiUserPlatform) {
|
||||
List<String> suggestions = new ArrayList<String>();
|
||||
List<String> suggestions = new ArrayList<>();
|
||||
Collection<Actor> users = ((MultiUserPlatform) platform).getConnectedUsers();
|
||||
for (Actor user : users) {
|
||||
if (user.getName().toLowerCase().startsWith(arguments.toLowerCase().trim())) {
|
||||
|
@ -68,9 +68,9 @@ import java.util.Stack;
|
||||
*/
|
||||
public class Expression {
|
||||
|
||||
private static final ThreadLocal<Stack<Expression>> instance = new ThreadLocal<Stack<Expression>>();
|
||||
private static final ThreadLocal<Stack<Expression>> instance = new ThreadLocal<>();
|
||||
|
||||
private final Map<String, RValue> variables = new HashMap<String, RValue>();
|
||||
private final Map<String, RValue> variables = new HashMap<>();
|
||||
private final String[] variableNames;
|
||||
private RValue root;
|
||||
private final Functions functions = new Functions();
|
||||
@ -148,7 +148,7 @@ public class Expression {
|
||||
private void pushInstance() {
|
||||
Stack<Expression> foo = instance.get();
|
||||
if (foo == null) {
|
||||
instance.set(foo = new Stack<Expression>());
|
||||
instance.set(foo = new Stack<>());
|
||||
}
|
||||
|
||||
foo.push(this);
|
||||
|
@ -102,7 +102,7 @@ public class Lexer {
|
||||
)
|
||||
);
|
||||
|
||||
private static final Set<Character> characterTokens = new HashSet<Character>();
|
||||
private static final Set<Character> characterTokens = new HashSet<>();
|
||||
static {
|
||||
characterTokens.add(',');
|
||||
characterTokens.add('(');
|
||||
@ -114,13 +114,14 @@ public class Lexer {
|
||||
characterTokens.add(':');
|
||||
}
|
||||
|
||||
private static final Set<String> keywords = new HashSet<String>(Arrays.asList("if", "else", "while", "do", "for", "break", "continue", "return", "switch", "case", "default"));
|
||||
private static final Set<String> keywords =
|
||||
new HashSet<>(Arrays.asList("if", "else", "while", "do", "for", "break", "continue", "return", "switch", "case", "default"));
|
||||
|
||||
private static final Pattern numberPattern = Pattern.compile("^([0-9]*(?:\\.[0-9]+)?(?:[eE][+-]?[0-9]+)?)");
|
||||
private static final Pattern identifierPattern = Pattern.compile("^([A-Za-z][0-9A-Za-z_]*)");
|
||||
|
||||
private List<Token> tokenize() throws LexerException {
|
||||
List<Token> tokens = new ArrayList<Token>();
|
||||
List<Token> tokens = new ArrayList<>();
|
||||
|
||||
do {
|
||||
skipWhitespace();
|
||||
@ -189,7 +190,7 @@ public class Lexer {
|
||||
|
||||
public class DecisionTree {
|
||||
private final String tokenName;
|
||||
private final Map<Character, DecisionTree> subTrees = new HashMap<Character, Lexer.DecisionTree>();
|
||||
private final Map<Character, DecisionTree> subTrees = new HashMap<>();
|
||||
|
||||
private DecisionTree(String tokenName, Object... args) {
|
||||
this.tokenName = tokenName;
|
||||
|
@ -92,7 +92,7 @@ public class Parser {
|
||||
}
|
||||
|
||||
private RValue parseStatements(boolean singleStatement) throws ParserException {
|
||||
List<RValue> statements = new ArrayList<RValue>();
|
||||
List<RValue> statements = new ArrayList<>();
|
||||
loop: while (position < tokens.size()) {
|
||||
boolean expectSemicolon = false;
|
||||
|
||||
@ -227,8 +227,8 @@ public class Parser {
|
||||
case 's': // switch
|
||||
++position;
|
||||
final RValue parameter = parseBracket();
|
||||
final List<Double> values = new ArrayList<Double>();
|
||||
final List<RValue> caseStatements = new ArrayList<RValue>();
|
||||
final List<Double> values = new ArrayList<>();
|
||||
final List<RValue> caseStatements = new ArrayList<>();
|
||||
RValue defaultCase = null;
|
||||
|
||||
consumeCharacter('{');
|
||||
@ -310,7 +310,7 @@ public class Parser {
|
||||
}
|
||||
|
||||
private RValue parseExpression(boolean canBeEmpty) throws ParserException {
|
||||
LinkedList<Identifiable> halfProcessed = new LinkedList<Identifiable>();
|
||||
LinkedList<Identifiable> halfProcessed = new LinkedList<>();
|
||||
|
||||
// process brackets, numbers, functions, variables and detect prefix operators
|
||||
boolean expressionStart = true;
|
||||
@ -397,7 +397,7 @@ public class Parser {
|
||||
return Functions.getFunction(identifierToken.getPosition(), identifierToken.value);
|
||||
}
|
||||
|
||||
List<RValue> args = new ArrayList<RValue>();
|
||||
List<RValue> args = new ArrayList<>();
|
||||
|
||||
loop: while (true) {
|
||||
args.add(parseExpression(false));
|
||||
|
@ -33,7 +33,7 @@ import java.util.*;
|
||||
*/
|
||||
public final class ParserProcessors {
|
||||
|
||||
private static final Map<String, String> unaryOpMap = new HashMap<String, String>();
|
||||
private static final Map<String, String> unaryOpMap = new HashMap<>();
|
||||
|
||||
private static final Map<String, String>[] binaryOpMapsLA;
|
||||
private static final Map<String, String>[] binaryOpMapsRA;
|
||||
@ -111,7 +111,7 @@ public final class ParserProcessors {
|
||||
break;
|
||||
|
||||
default:
|
||||
Map<String, String> m = lBinaryOpMapsLA[i] = new HashMap<String, String>();
|
||||
Map<String, String> m = lBinaryOpMapsLA[i] = new HashMap<>();
|
||||
for (final Object[] element : a) {
|
||||
m.put((String) element[0], (String) element[1]);
|
||||
}
|
||||
@ -133,7 +133,7 @@ public final class ParserProcessors {
|
||||
break;
|
||||
|
||||
default:
|
||||
Map<String, String> m = lBinaryOpMapsRA[i] = new HashMap<String, String>();
|
||||
Map<String, String> m = lBinaryOpMapsRA[i] = new HashMap<>();
|
||||
for (final Object[] element : a) {
|
||||
m.put((String) element[0], (String) element[1]);
|
||||
}
|
||||
@ -153,8 +153,8 @@ public final class ParserProcessors {
|
||||
return processUnaryOps(input);
|
||||
}
|
||||
|
||||
LinkedList<Identifiable> lhs = new LinkedList<Identifiable>();
|
||||
LinkedList<Identifiable> rhs = new LinkedList<Identifiable>();
|
||||
LinkedList<Identifiable> lhs = new LinkedList<>();
|
||||
LinkedList<Identifiable> rhs = new LinkedList<>();
|
||||
String operator = null;
|
||||
|
||||
for (Iterator<Identifiable> it = input.descendingIterator(); it.hasNext();) {
|
||||
@ -195,8 +195,8 @@ public final class ParserProcessors {
|
||||
return processTernaryOps(input);
|
||||
}
|
||||
|
||||
LinkedList<Identifiable> lhs = new LinkedList<Identifiable>();
|
||||
LinkedList<Identifiable> rhs = new LinkedList<Identifiable>();
|
||||
LinkedList<Identifiable> lhs = new LinkedList<>();
|
||||
LinkedList<Identifiable> rhs = new LinkedList<>();
|
||||
String operator = null;
|
||||
|
||||
for (Identifiable identifiable : input) {
|
||||
@ -232,9 +232,9 @@ public final class ParserProcessors {
|
||||
}
|
||||
|
||||
private static RValue processTernaryOps(LinkedList<Identifiable> input) throws ParserException {
|
||||
LinkedList<Identifiable> lhs = new LinkedList<Identifiable>();
|
||||
LinkedList<Identifiable> mhs = new LinkedList<Identifiable>();
|
||||
LinkedList<Identifiable> rhs = new LinkedList<Identifiable>();
|
||||
LinkedList<Identifiable> lhs = new LinkedList<>();
|
||||
LinkedList<Identifiable> mhs = new LinkedList<>();
|
||||
LinkedList<Identifiable> rhs = new LinkedList<>();
|
||||
|
||||
int partsFound = 0;
|
||||
int conditionalsFound = 0;
|
||||
@ -290,7 +290,7 @@ public final class ParserProcessors {
|
||||
private static RValue processUnaryOps(LinkedList<Identifiable> input) throws ParserException {
|
||||
// Preprocess postfix operators into unary operators
|
||||
final Identifiable center;
|
||||
LinkedList<UnaryOperator> postfixes = new LinkedList<UnaryOperator>();
|
||||
LinkedList<UnaryOperator> postfixes = new LinkedList<>();
|
||||
do {
|
||||
if (input.isEmpty()) {
|
||||
throw new ParserException(-1, "Expression missing.");
|
||||
|
@ -123,7 +123,7 @@ public final class Functions {
|
||||
throw new NoSuchMethodException(); // TODO: return null (check for side-effects first)
|
||||
}
|
||||
|
||||
private static final Map<String, List<Overload>> functions = new HashMap<String, List<Overload>>();
|
||||
private static final Map<String, List<Overload>> functions = new HashMap<>();
|
||||
static {
|
||||
for (Method method : Functions.class.getMethods()) {
|
||||
try {
|
||||
@ -138,10 +138,7 @@ public final class Functions {
|
||||
|
||||
Overload overload = new Overload(method);
|
||||
|
||||
List<Overload> overloads = functions.get(methodName);
|
||||
if (overloads == null) {
|
||||
functions.put(methodName, overloads = new ArrayList<Overload>());
|
||||
}
|
||||
List<Overload> overloads = functions.computeIfAbsent(methodName, k -> new ArrayList<>());
|
||||
|
||||
overloads.add(overload);
|
||||
}
|
||||
@ -279,8 +276,8 @@ public final class Functions {
|
||||
}
|
||||
|
||||
|
||||
private static final Map<Integer, double[]> gmegabuf = new HashMap<Integer, double[]>();
|
||||
private final Map<Integer, double[]> megabuf = new HashMap<Integer, double[]>();
|
||||
private static final Map<Integer, double[]> gmegabuf = new HashMap<>();
|
||||
private final Map<Integer, double[]> megabuf = new HashMap<>();
|
||||
|
||||
public Map<Integer, double[]> getMegabuf() {
|
||||
return megabuf;
|
||||
@ -383,12 +380,7 @@ public final class Functions {
|
||||
return random.nextInt((int) Math.floor(max.getValue()));
|
||||
}
|
||||
|
||||
private static final ThreadLocal<PerlinNoise> localPerlin = new ThreadLocal<PerlinNoise>() {
|
||||
@Override
|
||||
protected PerlinNoise initialValue() {
|
||||
return new PerlinNoise();
|
||||
}
|
||||
};
|
||||
private static final ThreadLocal<PerlinNoise> localPerlin = ThreadLocal.withInitial(PerlinNoise::new);
|
||||
|
||||
public static double perlin(RValue seed, RValue x, RValue y, RValue z, RValue frequency, RValue octaves, RValue persistence) throws EvaluationException {
|
||||
PerlinNoise perlin = localPerlin.get();
|
||||
@ -403,12 +395,7 @@ public final class Functions {
|
||||
return perlin.noise(new Vector(x.getValue(), y.getValue(), z.getValue()));
|
||||
}
|
||||
|
||||
private static final ThreadLocal<VoronoiNoise> localVoronoi = new ThreadLocal<VoronoiNoise>() {
|
||||
@Override
|
||||
protected VoronoiNoise initialValue() {
|
||||
return new VoronoiNoise();
|
||||
}
|
||||
};
|
||||
private static final ThreadLocal<VoronoiNoise> localVoronoi = ThreadLocal.withInitial(VoronoiNoise::new);
|
||||
|
||||
public static double voronoi(RValue seed, RValue x, RValue y, RValue z, RValue frequency) throws EvaluationException {
|
||||
VoronoiNoise voronoi = localVoronoi.get();
|
||||
@ -421,12 +408,7 @@ public final class Functions {
|
||||
return voronoi.noise(new Vector(x.getValue(), y.getValue(), z.getValue()));
|
||||
}
|
||||
|
||||
private static final ThreadLocal<RidgedMultiFractalNoise> localRidgedMulti = new ThreadLocal<RidgedMultiFractalNoise>() {
|
||||
@Override
|
||||
protected RidgedMultiFractalNoise initialValue() {
|
||||
return new RidgedMultiFractalNoise();
|
||||
}
|
||||
};
|
||||
private static final ThreadLocal<RidgedMultiFractalNoise> localRidgedMulti = ThreadLocal.withInitial(RidgedMultiFractalNoise::new);
|
||||
|
||||
public static double ridgedmulti(RValue seed, RValue x, RValue y, RValue z, RValue frequency, RValue octaves) throws EvaluationException {
|
||||
RidgedMultiFractalNoise ridgedMulti = localRidgedMulti.get();
|
||||
|
@ -71,7 +71,7 @@ public class Sequence extends Node {
|
||||
|
||||
@Override
|
||||
public RValue optimize() throws EvaluationException {
|
||||
final List<RValue> newSequence = new ArrayList<RValue>();
|
||||
final List<RValue> newSequence = new ArrayList<>();
|
||||
|
||||
RValue droppedLast = null;
|
||||
for (RValue invokable : sequence) {
|
||||
|
@ -45,7 +45,7 @@ public class Switch extends Node implements RValue {
|
||||
}
|
||||
|
||||
private static Map<Double, Integer> invertList(List<Double> values) {
|
||||
Map<Double, Integer> valueMap = new HashMap<Double, Integer>();
|
||||
Map<Double, Integer> valueMap = new HashMap<>();
|
||||
for (int i = 0; i < values.size(); ++i) {
|
||||
valueMap.put(values.get(i), i);
|
||||
}
|
||||
@ -124,7 +124,7 @@ public class Switch extends Node implements RValue {
|
||||
@Override
|
||||
public RValue optimize() throws EvaluationException {
|
||||
final RValue optimizedParameter = parameter.optimize();
|
||||
final List<RValue> newSequence = new ArrayList<RValue>();
|
||||
final List<RValue> newSequence = new ArrayList<>();
|
||||
|
||||
if (optimizedParameter instanceof Constant) {
|
||||
final double parameter = optimizedParameter.getValue();
|
||||
@ -165,9 +165,9 @@ public class Switch extends Node implements RValue {
|
||||
return new Switch(getPosition(), optimizedParameter, Collections.singletonMap(parameter, 0), newSequence, null);
|
||||
}
|
||||
|
||||
final Map<Double, Integer> newValueMap = new HashMap<Double, Integer>();
|
||||
final Map<Double, Integer> newValueMap = new HashMap<>();
|
||||
|
||||
Map<Integer, Double> backMap = new HashMap<Integer, Double>();
|
||||
Map<Integer, Double> backMap = new HashMap<>();
|
||||
for (Entry<Double, Integer> entry : valueMap.entrySet()) {
|
||||
backMap.put(entry.getValue(), entry.getKey());
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
||||
public abstract class AbstractFactory<E> {
|
||||
|
||||
protected final WorldEdit worldEdit;
|
||||
protected final List<InputParser<E>> parsers = new ArrayList<InputParser<E>>();
|
||||
protected final List<InputParser<E>> parsers = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* Create a new factory.
|
||||
|
@ -59,7 +59,7 @@ public final class DocumentationPrinter {
|
||||
}
|
||||
|
||||
private static List<Class<?>> getCommandClasses(File dir) {
|
||||
List<Class<?>> classes = new ArrayList<Class<?>>();
|
||||
List<Class<?>> classes = new ArrayList<>();
|
||||
|
||||
classes.add(BiomeCommands.class);
|
||||
classes.add(ChunkCommands.class);
|
||||
@ -100,15 +100,9 @@ public final class DocumentationPrinter {
|
||||
|
||||
private static void writePermissionsWikiTable(List<Class<?>> commandClasses)
|
||||
throws IOException {
|
||||
FileOutputStream stream = null;
|
||||
try {
|
||||
stream = new FileOutputStream("wiki_permissions.txt");
|
||||
try (FileOutputStream stream = new FileOutputStream("wiki_permissions.txt")) {
|
||||
PrintStream print = new PrintStream(stream);
|
||||
writePermissionsWikiTable(print, commandClasses, "/");
|
||||
} finally {
|
||||
if (stream != null) {
|
||||
stream.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -180,15 +174,9 @@ public final class DocumentationPrinter {
|
||||
|
||||
private static void writeBukkitYAML()
|
||||
throws IOException {
|
||||
FileOutputStream stream = null;
|
||||
try {
|
||||
stream = new FileOutputStream("plugin.yml");
|
||||
try (FileOutputStream stream = new FileOutputStream("plugin.yml")) {
|
||||
PrintStream print = new PrintStream(stream);
|
||||
writeBukkitYAML(print);
|
||||
} finally {
|
||||
if (stream != null) {
|
||||
stream.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user