Selective upstream merge

Signed-off-by: MattBDev <4009945+MattBDev@users.noreply.github.com>
This commit is contained in:
MattBDev
2019-06-04 11:48:30 -04:00
parent c73fc28847
commit 6c94cca15e
75 changed files with 1039 additions and 1182 deletions

View File

@ -50,13 +50,11 @@ public final class BrushCache {
tool.setHolder(item);
brushCache.put(key, tool);
return tool;
} catch (Throwable ignore) {
ignore.printStackTrace();
} catch (Exception throwable) {
throwable.printStackTrace();
Fawe.debug("Invalid brush for " + player + " holding " + item.getType() + ": " + json.getValue());
if (item != null) {
item.setNbtData(null);
brushCache.remove(key);
}
item.setNbtData(null);
brushCache.remove(key);
} finally {
RECURSION.remove();
}
@ -123,4 +121,4 @@ public final class BrushCache {
}
return tool;
}
}
}

View File

@ -77,7 +77,7 @@ public class CachedMathMan {
add = 0.0f;
}
float invDiv = 1.0f / (((x < y) ? y : x) * INV_ATAN2_DIM_MINUS_1);
float invDiv = 1.0f / ((Math.max(x, y)) * INV_ATAN2_DIM_MINUS_1);
int xi = (int) (x * invDiv);
int yi = (int) (y * invDiv);

View File

@ -26,7 +26,7 @@ public class ColorUtil {
: Float.parseFloat(color));
switch (type) {
case PARSE_ALPHA:
return (c < 0f) ? 0f : ((c > 1f) ? 1f : c);
return (c < 0f) ? 0f : (Math.min(c, 1f));
case PARSE_PERCENT:
return (c <= 0f) ? 0f : ((c >= 100f) ? 1f : (c / 100f));
case PARSE_COMPONENT:

View File

@ -54,7 +54,7 @@ public class EditSessionBuilder {
public EditSessionBuilder(@Nonnull World world) {
checkNotNull(world);
this.world = world;
this.worldName = Fawe.imp().getWorldName(world);
this.worldName = world.getName();
}
public EditSessionBuilder(@Nonnull String worldName) {

View File

@ -81,11 +81,11 @@ public class MathMan {
}
public static int clamp(int check, int min, int max) {
return check > max ? max : (check < min ? min : check);
return check > max ? max : (Math.max(check, min));
}
public static float clamp(float check, float min, float max) {
return check > max ? max : (check < min ? min : check);
return check > max ? max : (Math.max(check, min));
}
public static double hypot(final double... pars) {
@ -104,7 +104,7 @@ public class MathMan {
return sum;
}
public static final int wrap(int value, int min, int max) {
public static int wrap(int value, int min, int max) {
if (max < min) {
return value;
}

View File

@ -7,11 +7,7 @@ import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.*;
import sun.reflect.ConstructorAccessor;
import sun.reflect.FieldAccessor;
@ -126,7 +122,7 @@ public class ReflectionUtils {
Class<?>[] additionalTypes, Object[] additionalValues) throws Exception {
Object[] parms = new Object[additionalValues.length + 2];
parms[0] = value;
parms[1] = Integer.valueOf(ordinal);
parms[1] = ordinal;
System.arraycopy(additionalValues, 0, parms, 2, additionalValues.length);
return enumClass.cast(getConstructorAccessor(enumClass, additionalTypes).newInstance(parms));
}
@ -332,12 +328,12 @@ public class ReflectionUtils {
}
public static Method[] sortMethods(Method[] methods) {
Arrays.sort(methods, (o1, o2) -> o1.getName().compareTo(o2.getName()));
Arrays.sort(methods, Comparator.comparing(Method::getName));
return methods;
}
public static Field[] sortFields(Field[] fields) {
Arrays.sort(fields, (o1, o2) -> o1.getName().compareTo(o2.getName()));
Arrays.sort(fields, Comparator.comparing(Field::getName));
return fields;
}