mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-12-27 19:19:07 +00:00
Destroy everything
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
package com.volmit.iris.util;
|
||||
|
||||
import com.google.common.util.concurrent.AtomicDoubleArray;
|
||||
import com.volmit.iris.Iris;
|
||||
|
||||
/**
|
||||
* Provides an incredibly fast averaging object. It swaps values from a sum
|
||||
@@ -71,7 +72,8 @@ public class AtomicAverage {
|
||||
lastSum = (lastSum - current) + i;
|
||||
values.set(cursor, i);
|
||||
cursor = cursor + 1 < size() ? cursor + 1 : 0;
|
||||
} catch (Throwable ignored) {
|
||||
} catch (Throwable e) {
|
||||
Iris.reportError(e);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ public class B {
|
||||
Material mm = Material.valueOf(bx);
|
||||
materialCache.put(bx, mm);
|
||||
return mm;
|
||||
} catch (Throwable e) {
|
||||
} catch (Throwable e) {Iris.reportError(e);
|
||||
nullMaterialCache.add(bx);
|
||||
return null;
|
||||
}
|
||||
@@ -108,7 +108,7 @@ public class B {
|
||||
}
|
||||
|
||||
return bdx;
|
||||
} catch (Throwable e) {
|
||||
} catch (Throwable e) {Iris.reportError(e);
|
||||
Iris.warn("Unknown Block Data '" + bdxf + "'");
|
||||
}
|
||||
|
||||
@@ -140,7 +140,7 @@ public class B {
|
||||
BlockData bx = Bukkit.createBlockData(ix);
|
||||
blockDataCache.put(ix, bx);
|
||||
return bx;
|
||||
} catch (Throwable ignored) {
|
||||
} catch (Throwable e) {Iris.reportError(e);
|
||||
|
||||
}
|
||||
|
||||
@@ -151,7 +151,7 @@ public class B {
|
||||
try {
|
||||
BlockData bd = Material.valueOf(i).createBlockData();
|
||||
blockDataCache.put(ix, bd);
|
||||
} catch (Throwable ignored) {
|
||||
} catch (Throwable e) {Iris.reportError(e);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package com.volmit.iris.util;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Color;
|
||||
@@ -373,6 +374,7 @@ public enum C {
|
||||
try {
|
||||
return BY_CHAR.get(code);
|
||||
} catch (Exception e) {
|
||||
Iris.reportError(e);
|
||||
return C.WHITE;
|
||||
}
|
||||
}
|
||||
@@ -390,7 +392,7 @@ public enum C {
|
||||
Validate.isTrue(code.length() > 0, "Code must have at least one char");
|
||||
|
||||
return BY_CHAR.get(code.charAt(0));
|
||||
} catch (Exception e) {
|
||||
} catch (Exception e) {Iris.reportError(e);
|
||||
return C.WHITE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package com.volmit.iris.util;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
import java.util.Optional;
|
||||
@@ -66,6 +67,7 @@ public final class FastReflection {
|
||||
try {
|
||||
return Optional.of(Class.forName(className));
|
||||
} catch (ClassNotFoundException e) {
|
||||
Iris.reportError(e);
|
||||
return Optional.empty();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
|
||||
package com.volmit.iris.util;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ForkJoinPool;
|
||||
@@ -87,6 +89,7 @@ public class GroupedExecutor {
|
||||
try {
|
||||
r.run();
|
||||
} catch (Throwable e) {
|
||||
Iris.reportError(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
|
||||
package com.volmit.iris.util;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
|
||||
import java.io.*;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.DigestInputStream;
|
||||
@@ -95,6 +97,7 @@ public class IO {
|
||||
MessageDigest d = MessageDigest.getInstance("SHA-256");
|
||||
return bytesToHex(d.digest(b.getBytes(StandardCharsets.UTF_8)));
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
Iris.reportError(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -108,7 +111,7 @@ public class IO {
|
||||
fullTransfer(din, new VoidOutputStream(), 8192);
|
||||
din.close();
|
||||
return bytesToHex(din.getMessageDigest().digest());
|
||||
} catch (Throwable e) {
|
||||
} catch (Throwable e) {Iris.reportError(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -304,7 +307,7 @@ public class IO {
|
||||
v.accept(in);
|
||||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
} catch (Exception ex) {Iris.reportError(ex);
|
||||
x = ex.getCause();
|
||||
} finally {
|
||||
file.close();
|
||||
@@ -326,7 +329,7 @@ public class IO {
|
||||
FileReader fr;
|
||||
try {
|
||||
fr = new FileReader(f);
|
||||
} catch (IOException e) {
|
||||
} catch (IOException e) {Iris.reportError(e);
|
||||
throw e;
|
||||
}
|
||||
BufferedReader bu = new BufferedReader(fr);
|
||||
@@ -481,7 +484,7 @@ public class IO {
|
||||
if (input != null) {
|
||||
input.close();
|
||||
}
|
||||
} catch (IOException ioe) {
|
||||
} catch (IOException e) {Iris.reportError(e);
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
@@ -499,7 +502,7 @@ public class IO {
|
||||
if (output != null) {
|
||||
output.close();
|
||||
}
|
||||
} catch (IOException ioe) {
|
||||
} catch (IOException e) {Iris.reportError(e);
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
@@ -517,7 +520,7 @@ public class IO {
|
||||
if (input != null) {
|
||||
input.close();
|
||||
}
|
||||
} catch (IOException ioe) {
|
||||
} catch (IOException e) {Iris.reportError(e);
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
@@ -535,7 +538,7 @@ public class IO {
|
||||
if (output != null) {
|
||||
output.close();
|
||||
}
|
||||
} catch (IOException ioe) {
|
||||
} catch (IOException e) {Iris.reportError(e);
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package com.volmit.iris.util;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
@@ -47,7 +48,8 @@ public class IrisLock {
|
||||
}
|
||||
try {
|
||||
lock.unlock();
|
||||
} catch (Throwable ignored) {
|
||||
} catch (Throwable e) {
|
||||
Iris.reportError(e);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ public class J {
|
||||
g.run();
|
||||
return true;
|
||||
}
|
||||
} catch (NullPointerException e) {
|
||||
} catch (NullPointerException e) {Iris.reportError(e);
|
||||
// TODO: Fix this because this is just a suppression for an NPE on g
|
||||
return false;
|
||||
}
|
||||
@@ -70,7 +70,7 @@ public class J {
|
||||
e.submit(() -> {
|
||||
try {
|
||||
a.run();
|
||||
} catch (Throwable e) {
|
||||
} catch (Throwable e) {Iris.reportError(e);
|
||||
System.out.println("Failed to run async task");
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -81,7 +81,7 @@ public class J {
|
||||
e.submit(() -> {
|
||||
try {
|
||||
a.run();
|
||||
} catch (Throwable e) {
|
||||
} catch (Throwable e) {Iris.reportError(e);
|
||||
System.out.println("Failed to run async task");
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -99,7 +99,7 @@ public class J {
|
||||
public static <R> R attemptResult(NastyFuture<R> r, R onError) {
|
||||
try {
|
||||
return r.run();
|
||||
} catch (Throwable e) {
|
||||
} catch (Throwable e) {Iris.reportError(e);
|
||||
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ public class J {
|
||||
public static <T, R> R attemptFunction(NastyFunction<T, R> r, T param, R onError) {
|
||||
try {
|
||||
return r.run(param);
|
||||
} catch (Throwable e) {
|
||||
} catch (Throwable e) {Iris.reportError(e);
|
||||
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@ public class J {
|
||||
public static Throwable attemptCatch(NastyRunnable r) {
|
||||
try {
|
||||
r.run();
|
||||
} catch (Throwable e) {
|
||||
} catch (Throwable e) {Iris.reportError(e);
|
||||
return e;
|
||||
}
|
||||
|
||||
@@ -137,7 +137,7 @@ public class J {
|
||||
public static <T> T attempt(Supplier<T> t, T i) {
|
||||
try {
|
||||
return t.get();
|
||||
} catch (Throwable e) {
|
||||
} catch (Throwable e) {Iris.reportError(e);
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
package com.volmit.iris.util;
|
||||
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.StringWriter;
|
||||
import java.io.Writer;
|
||||
@@ -222,6 +224,7 @@ public class JSONArray implements Iterable<Object> {
|
||||
try {
|
||||
return object instanceof Number ? ((Number) object).doubleValue() : Double.parseDouble((String) object);
|
||||
} catch (Exception e) {
|
||||
Iris.reportError(e);
|
||||
throw new JSONException("JSONArray[" + index + "] is not a number.");
|
||||
}
|
||||
}
|
||||
@@ -258,7 +261,7 @@ public class JSONArray implements Iterable<Object> {
|
||||
Object object = this.get(index);
|
||||
try {
|
||||
return new BigDecimal(object.toString());
|
||||
} catch (Exception e) {
|
||||
} catch (Exception e) {Iris.reportError(e);
|
||||
throw new JSONException("JSONArray[" + index + "] could not convert to BigDecimal.");
|
||||
}
|
||||
}
|
||||
@@ -275,7 +278,7 @@ public class JSONArray implements Iterable<Object> {
|
||||
Object object = this.get(index);
|
||||
try {
|
||||
return new BigInteger(object.toString());
|
||||
} catch (Exception e) {
|
||||
} catch (Exception e) {Iris.reportError(e);
|
||||
throw new JSONException("JSONArray[" + index + "] could not convert to BigInteger.");
|
||||
}
|
||||
}
|
||||
@@ -291,7 +294,7 @@ public class JSONArray implements Iterable<Object> {
|
||||
Object object = this.get(index);
|
||||
try {
|
||||
return object instanceof Number ? ((Number) object).intValue() : Integer.parseInt((String) object);
|
||||
} catch (Exception e) {
|
||||
} catch (Exception e) {Iris.reportError(e);
|
||||
throw new JSONException("JSONArray[" + index + "] is not a number.");
|
||||
}
|
||||
}
|
||||
@@ -340,7 +343,7 @@ public class JSONArray implements Iterable<Object> {
|
||||
Object object = this.get(index);
|
||||
try {
|
||||
return object instanceof Number ? ((Number) object).longValue() : Long.parseLong((String) object);
|
||||
} catch (Exception e) {
|
||||
} catch (Exception e) {Iris.reportError(e);
|
||||
throw new JSONException("JSONArray[" + index + "] is not a number.");
|
||||
}
|
||||
}
|
||||
@@ -435,7 +438,7 @@ public class JSONArray implements Iterable<Object> {
|
||||
public boolean optBoolean(int index, boolean defaultValue) {
|
||||
try {
|
||||
return this.getBoolean(index);
|
||||
} catch (Exception e) {
|
||||
} catch (Exception e) {Iris.reportError(e);
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
@@ -464,7 +467,7 @@ public class JSONArray implements Iterable<Object> {
|
||||
public double optDouble(int index, double defaultValue) {
|
||||
try {
|
||||
return this.getDouble(index);
|
||||
} catch (Exception e) {
|
||||
} catch (Exception e) {Iris.reportError(e);
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
@@ -493,7 +496,7 @@ public class JSONArray implements Iterable<Object> {
|
||||
public int optInt(int index, int defaultValue) {
|
||||
try {
|
||||
return this.getInt(index);
|
||||
} catch (Exception e) {
|
||||
} catch (Exception e) {Iris.reportError(e);
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
@@ -531,9 +534,9 @@ public class JSONArray implements Iterable<Object> {
|
||||
return myE;
|
||||
}
|
||||
return Enum.valueOf(clazz, val.toString());
|
||||
} catch (IllegalArgumentException e) {
|
||||
} catch (IllegalArgumentException e) {Iris.reportError(e);
|
||||
return defaultValue;
|
||||
} catch (NullPointerException e) {
|
||||
} catch (NullPointerException e) {Iris.reportError(e);
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
@@ -550,7 +553,7 @@ public class JSONArray implements Iterable<Object> {
|
||||
public BigInteger optBigInteger(int index, BigInteger defaultValue) {
|
||||
try {
|
||||
return this.getBigInteger(index);
|
||||
} catch (Exception e) {
|
||||
} catch (Exception e) {Iris.reportError(e);
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
@@ -567,7 +570,7 @@ public class JSONArray implements Iterable<Object> {
|
||||
public BigDecimal optBigDecimal(int index, BigDecimal defaultValue) {
|
||||
try {
|
||||
return this.getBigDecimal(index);
|
||||
} catch (Exception e) {
|
||||
} catch (Exception e) {Iris.reportError(e);
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
@@ -621,7 +624,7 @@ public class JSONArray implements Iterable<Object> {
|
||||
public long optLong(int index, long defaultValue) {
|
||||
try {
|
||||
return this.getLong(index);
|
||||
} catch (Exception e) {
|
||||
} catch (Exception e) {Iris.reportError(e);
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
@@ -934,7 +937,7 @@ public class JSONArray implements Iterable<Object> {
|
||||
public String toString() {
|
||||
try {
|
||||
return this.toString(0);
|
||||
} catch (Exception e) {
|
||||
} catch (Exception e) {Iris.reportError(e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
|
||||
package com.volmit.iris.util;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.StringWriter;
|
||||
import java.io.Writer;
|
||||
@@ -157,7 +159,8 @@ public class JSONObject {
|
||||
for (int i = 0; i < names.length; i += 1) {
|
||||
try {
|
||||
this.putOnce(names[i], jo.opt(names[i]));
|
||||
} catch (Exception ignore) {
|
||||
} catch (Exception e) {
|
||||
Iris.reportError(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -280,7 +283,7 @@ public class JSONObject {
|
||||
String name = names[i];
|
||||
try {
|
||||
this.putOpt(name, c.getField(name).get(object));
|
||||
} catch (Exception ignore) {
|
||||
} catch (Exception e) {Iris.reportError(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -488,7 +491,7 @@ public class JSONObject {
|
||||
Object object = this.get(key);
|
||||
try {
|
||||
return new BigInteger(object.toString());
|
||||
} catch (Exception e) {
|
||||
} catch (Exception e) {Iris.reportError(e);
|
||||
throw new JSONException("JSONObject[" + quote(key) + "] could not be converted to BigInteger.");
|
||||
}
|
||||
}
|
||||
@@ -505,7 +508,7 @@ public class JSONObject {
|
||||
Object object = this.get(key);
|
||||
try {
|
||||
return new BigDecimal(object.toString());
|
||||
} catch (Exception e) {
|
||||
} catch (Exception e) {Iris.reportError(e);
|
||||
throw new JSONException("JSONObject[" + quote(key) + "] could not be converted to BigDecimal.");
|
||||
}
|
||||
}
|
||||
@@ -522,7 +525,7 @@ public class JSONObject {
|
||||
Object object = this.get(key);
|
||||
try {
|
||||
return object instanceof Number ? ((Number) object).doubleValue() : Double.parseDouble((String) object);
|
||||
} catch (Exception e) {
|
||||
} catch (Exception e) {Iris.reportError(e);
|
||||
throw new JSONException("JSONObject[" + quote(key) + "] is not a number.");
|
||||
}
|
||||
}
|
||||
@@ -539,7 +542,7 @@ public class JSONObject {
|
||||
Object object = this.get(key);
|
||||
try {
|
||||
return object instanceof Number ? ((Number) object).intValue() : Integer.parseInt((String) object);
|
||||
} catch (Exception e) {
|
||||
} catch (Exception e) {Iris.reportError(e);
|
||||
throw new JSONException("JSONObject[" + quote(key) + "] is not an int.");
|
||||
}
|
||||
}
|
||||
@@ -586,7 +589,7 @@ public class JSONObject {
|
||||
Object object = this.get(key);
|
||||
try {
|
||||
return object instanceof Number ? ((Number) object).longValue() : Long.parseLong((String) object);
|
||||
} catch (Exception e) {
|
||||
} catch (Exception e) {Iris.reportError(e);
|
||||
throw new JSONException("JSONObject[" + quote(key) + "] is not a long.");
|
||||
}
|
||||
}
|
||||
@@ -815,9 +818,9 @@ public class JSONObject {
|
||||
return myE;
|
||||
}
|
||||
return Enum.valueOf(clazz, val.toString());
|
||||
} catch (IllegalArgumentException e) {
|
||||
} catch (IllegalArgumentException e) {Iris.reportError(e);
|
||||
return defaultValue;
|
||||
} catch (NullPointerException e) {
|
||||
} catch (NullPointerException e) {Iris.reportError(e);
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
@@ -845,7 +848,7 @@ public class JSONObject {
|
||||
public boolean optBoolean(String key, boolean defaultValue) {
|
||||
try {
|
||||
return this.getBoolean(key);
|
||||
} catch (Exception e) {
|
||||
} catch (Exception e) {Iris.reportError(e);
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
@@ -874,7 +877,7 @@ public class JSONObject {
|
||||
public BigInteger optBigInteger(String key, BigInteger defaultValue) {
|
||||
try {
|
||||
return this.getBigInteger(key);
|
||||
} catch (Exception e) {
|
||||
} catch (Exception e) {Iris.reportError(e);
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
@@ -891,7 +894,7 @@ public class JSONObject {
|
||||
public BigDecimal optBigDecimal(String key, BigDecimal defaultValue) {
|
||||
try {
|
||||
return this.getBigDecimal(key);
|
||||
} catch (Exception e) {
|
||||
} catch (Exception e) {Iris.reportError(e);
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
@@ -908,7 +911,7 @@ public class JSONObject {
|
||||
public double optDouble(String key, double defaultValue) {
|
||||
try {
|
||||
return this.getDouble(key);
|
||||
} catch (Exception e) {
|
||||
} catch (Exception e) {Iris.reportError(e);
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
@@ -937,7 +940,7 @@ public class JSONObject {
|
||||
public int optInt(String key, int defaultValue) {
|
||||
try {
|
||||
return this.getInt(key);
|
||||
} catch (Exception e) {
|
||||
} catch (Exception e) {Iris.reportError(e);
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
@@ -990,7 +993,7 @@ public class JSONObject {
|
||||
public long optLong(String key, long defaultValue) {
|
||||
try {
|
||||
return this.getLong(key);
|
||||
} catch (Exception e) {
|
||||
} catch (Exception e) {Iris.reportError(e);
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
@@ -1056,7 +1059,7 @@ public class JSONObject {
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception ignore) {
|
||||
} catch (Exception e) {Iris.reportError(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1217,7 +1220,7 @@ public class JSONObject {
|
||||
synchronized (sw.getBuffer()) {
|
||||
try {
|
||||
return quote(string, sw).toString();
|
||||
} catch (IOException ignored) {
|
||||
} catch (IOException e) {Iris.reportError(e);
|
||||
// will never happen - we are writing to a string writer
|
||||
return "";
|
||||
}
|
||||
@@ -1328,7 +1331,7 @@ public class JSONObject {
|
||||
}
|
||||
}
|
||||
return true;
|
||||
} catch (Throwable exception) {
|
||||
} catch (Throwable e) {Iris.reportError(e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1378,7 +1381,7 @@ public class JSONObject {
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception ignore) {
|
||||
} catch (Exception e) {Iris.reportError(e);
|
||||
}
|
||||
}
|
||||
return string;
|
||||
@@ -1439,7 +1442,7 @@ public class JSONObject {
|
||||
public String toString() {
|
||||
try {
|
||||
return this.toString(0);
|
||||
} catch (Exception e) {
|
||||
} catch (Exception e) {Iris.reportError(e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1493,7 +1496,7 @@ public class JSONObject {
|
||||
Object object;
|
||||
try {
|
||||
object = ((JSONString) value).toJSONString();
|
||||
} catch (Exception e) {
|
||||
} catch (Exception e) {Iris.reportError(e);
|
||||
throw new JSONException(e);
|
||||
}
|
||||
if (object instanceof String) {
|
||||
@@ -1562,7 +1565,7 @@ public class JSONObject {
|
||||
return object.toString();
|
||||
}
|
||||
return new JSONObject(object);
|
||||
} catch (Exception exception) {
|
||||
} catch (Exception e) {Iris.reportError(e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1605,7 +1608,7 @@ public class JSONObject {
|
||||
Object o;
|
||||
try {
|
||||
o = ((JSONString) value).toJSONString();
|
||||
} catch (Exception e) {
|
||||
} catch (Exception e) {Iris.reportError(e);
|
||||
throw new JSONException(e);
|
||||
}
|
||||
writer.write(o != null ? o.toString() : quote(value.toString()));
|
||||
@@ -1671,8 +1674,8 @@ public class JSONObject {
|
||||
}
|
||||
writer.write('}');
|
||||
return writer;
|
||||
} catch (IOException exception) {
|
||||
throw new JSONException(exception);
|
||||
} catch (IOException e) {Iris.reportError(e);
|
||||
throw new JSONException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
package com.volmit.iris.util;
|
||||
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
|
||||
import java.io.*;
|
||||
|
||||
/**
|
||||
@@ -140,8 +142,9 @@ public class JSONTokener {
|
||||
} else {
|
||||
try {
|
||||
c = this.reader.read();
|
||||
} catch (IOException exception) {
|
||||
throw new JSONException(exception);
|
||||
} catch (IOException e) {
|
||||
Iris.reportError(e);
|
||||
throw new JSONException(e);
|
||||
}
|
||||
|
||||
if (c <= 0) { // End of stream
|
||||
@@ -395,8 +398,8 @@ public class JSONTokener {
|
||||
return c;
|
||||
}
|
||||
} while (c != to);
|
||||
} catch (IOException exception) {
|
||||
throw new JSONException(exception);
|
||||
} catch (IOException e) {Iris.reportError(e);
|
||||
throw new JSONException(e);
|
||||
}
|
||||
this.back();
|
||||
return c;
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
package com.volmit.iris.util;
|
||||
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
|
||||
@@ -114,6 +116,7 @@ public class JSONWriter {
|
||||
}
|
||||
this.writer.write(string);
|
||||
} catch (IOException e) {
|
||||
Iris.reportError(e);
|
||||
throw new JSONException(e);
|
||||
}
|
||||
if (this.mode == 'o') {
|
||||
@@ -160,7 +163,7 @@ public class JSONWriter {
|
||||
this.pop(mode);
|
||||
try {
|
||||
this.writer.write(c);
|
||||
} catch (IOException e) {
|
||||
} catch (IOException e) {Iris.reportError(e);
|
||||
throw new JSONException(e);
|
||||
}
|
||||
this.comma = true;
|
||||
@@ -213,7 +216,7 @@ public class JSONWriter {
|
||||
this.comma = false;
|
||||
this.mode = 'o';
|
||||
return this;
|
||||
} catch (IOException e) {
|
||||
} catch (IOException e) {Iris.reportError(e);
|
||||
throw new JSONException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
|
||||
package com.volmit.iris.util;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
@@ -63,6 +65,7 @@ public class JarScanner {
|
||||
Class<?> clazz = Class.forName(c);
|
||||
classes.add(clazz);
|
||||
} catch (ClassNotFoundException e) {
|
||||
Iris.reportError(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
|
||||
package com.volmit.iris.util;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.Enumeration;
|
||||
@@ -57,6 +59,7 @@ public class KMap<K, V> extends ConcurrentHashMap<K, V> {
|
||||
|
||||
s.get(k).add(vs);
|
||||
} catch (Throwable e) {
|
||||
Iris.reportError(e);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ public class LinkedTerrainChunk implements TerrainChunk {
|
||||
private ChunkData createChunkData(int maxHeight) {
|
||||
try {
|
||||
return Bukkit.createChunkData(new HeightedFakeWorld(maxHeight));
|
||||
} catch (Throwable e) {
|
||||
} catch (Throwable e) {Iris.reportError(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
@@ -33,9 +33,9 @@ public abstract class Looper extends Thread {
|
||||
|
||||
//noinspection BusyWait
|
||||
Thread.sleep(m);
|
||||
} catch (InterruptedException e) {
|
||||
} catch (InterruptedException e) {Iris.reportError(e);
|
||||
break;
|
||||
} catch (Throwable e) {
|
||||
} catch (Throwable e) {Iris.reportError(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.google.gson.JsonPrimitive;
|
||||
import com.volmit.iris.Iris;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -135,7 +136,8 @@ public class Metrics {
|
||||
).copyDefaults(true);
|
||||
try {
|
||||
config.save(configFile);
|
||||
} catch (IOException ignored) {
|
||||
} catch (IOException e) {
|
||||
Iris.reportError(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -154,7 +156,7 @@ public class Metrics {
|
||||
service.getField("B_STATS_VERSION"); // Our identifier :)
|
||||
found = true; // We aren't the first
|
||||
break;
|
||||
} catch (NoSuchFieldException ignored) {
|
||||
} catch (NoSuchFieldException e) {Iris.reportError(e);
|
||||
}
|
||||
}
|
||||
// Register our service
|
||||
@@ -253,7 +255,7 @@ public class Metrics {
|
||||
playerAmount = onlinePlayersMethod.getReturnType().equals(Collection.class)
|
||||
? ((Collection<?>) onlinePlayersMethod.invoke(Bukkit.getServer())).size()
|
||||
: ((Player[]) onlinePlayersMethod.invoke(Bukkit.getServer())).length;
|
||||
} catch (Exception e) {
|
||||
} catch (Exception e) {Iris.reportError(e);
|
||||
playerAmount = Bukkit.getOnlinePlayers().size(); // Just use the new method if the Reflection failed
|
||||
}
|
||||
int onlineMode = Bukkit.getOnlineMode() ? 1 : 0;
|
||||
@@ -312,17 +314,19 @@ public class Metrics {
|
||||
JsonObject object = new JsonParser().parse(jsonString).getAsJsonObject();
|
||||
pluginData.add(object);
|
||||
}
|
||||
} catch (ClassNotFoundException e) {
|
||||
} catch (ClassNotFoundException e) {Iris.reportError(e);
|
||||
// minecraft version 1.14+
|
||||
|
||||
if (logFailedRequests) {
|
||||
this.plugin.getLogger().log(Level.SEVERE, "Encountered unexpected exception", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (NullPointerException | NoSuchMethodException | IllegalAccessException | InvocationTargetException ignored) {
|
||||
Iris.reportError(ignored);
|
||||
}
|
||||
}
|
||||
} catch (NoSuchFieldException ignored) {
|
||||
} catch (NoSuchFieldException e) {Iris.reportError(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -333,7 +337,7 @@ public class Metrics {
|
||||
try {
|
||||
// Send the data
|
||||
sendData(plugin, data);
|
||||
} catch (Exception e) {
|
||||
} catch (Exception e) {Iris.reportError(e);
|
||||
// Something went wrong! :(
|
||||
if (logFailedRequests) {
|
||||
plugin.getLogger().log(Level.WARNING, "Could not submit plugin stats of " + plugin.getName(), e);
|
||||
@@ -440,7 +444,7 @@ public class Metrics {
|
||||
return null;
|
||||
}
|
||||
chart.add("data", data);
|
||||
} catch (Throwable t) {
|
||||
} catch (Throwable t) {Iris.reportError(t);
|
||||
if (logFailedRequests) {
|
||||
Bukkit.getLogger().log(Level.WARNING, "Failed to get data for custom chart with id " + chartId, t);
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ package com.volmit.iris.util;
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.volmit.iris.Iris;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -132,7 +133,8 @@ public class MetricsLite {
|
||||
Check out https://bStats.org/ to learn more :)""").copyDefaults(true);
|
||||
try {
|
||||
config.save(configFile);
|
||||
} catch (IOException ignored) {
|
||||
} catch (IOException e) {
|
||||
Iris.reportError(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -150,7 +152,7 @@ public class MetricsLite {
|
||||
service.getField("B_STATS_VERSION"); // Our identifier :)
|
||||
found = true; // We aren't the first
|
||||
break;
|
||||
} catch (NoSuchFieldException ignored) {
|
||||
} catch (NoSuchFieldException e) {Iris.reportError(e);
|
||||
}
|
||||
}
|
||||
// Register our service
|
||||
@@ -230,7 +232,7 @@ public class MetricsLite {
|
||||
// org.bukkit.Bukkit.getOnlinePlayers()Ljava/util/Collection;
|
||||
Method onlinePlayersMethod = Class.forName("org.bukkit.Server").getMethod("getOnlinePlayers");
|
||||
playerAmount = onlinePlayersMethod.getReturnType().equals(Collection.class) ? ((Collection<?>) onlinePlayersMethod.invoke(Bukkit.getServer())).size() : ((Player[]) onlinePlayersMethod.invoke(Bukkit.getServer())).length;
|
||||
} catch (Exception e) {
|
||||
} catch (Exception e) {Iris.reportError(e);
|
||||
playerAmount = Bukkit.getOnlinePlayers().size(); // Just use the new method if the Reflection failed
|
||||
}
|
||||
int onlineMode = Bukkit.getOnlineMode() ? 1 : 0;
|
||||
@@ -289,7 +291,7 @@ public class MetricsLite {
|
||||
JsonObject object = new JsonParser().parse(jsonString).getAsJsonObject();
|
||||
pluginData.add(object);
|
||||
}
|
||||
} catch (ClassNotFoundException e) {
|
||||
} catch (ClassNotFoundException e) {Iris.reportError(e);
|
||||
// minecraft version 1.14+
|
||||
if (logFailedRequests) {
|
||||
this.plugin.getLogger().log(Level.SEVERE, "Encountered unexpected exception ", e);
|
||||
@@ -297,9 +299,10 @@ public class MetricsLite {
|
||||
}
|
||||
}
|
||||
} catch (NullPointerException | NoSuchMethodException | IllegalAccessException | InvocationTargetException ignored) {
|
||||
Iris.reportError(ignored);
|
||||
}
|
||||
}
|
||||
} catch (NoSuchFieldException ignored) {
|
||||
} catch (NoSuchFieldException e) {Iris.reportError(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -311,7 +314,7 @@ public class MetricsLite {
|
||||
try {
|
||||
// Send the data
|
||||
sendData(plugin, data);
|
||||
} catch (Exception e) {
|
||||
} catch (Exception e) {Iris.reportError(e);
|
||||
// Something went wrong! :(
|
||||
if (logFailedRequests) {
|
||||
plugin.getLogger().log(Level.WARNING, "Could not submit plugin stats of " + plugin.getName(), e);
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package com.volmit.iris.util;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.IrisSettings;
|
||||
import org.bukkit.Sound;
|
||||
|
||||
@@ -188,6 +189,7 @@ public abstract class MortarCommand implements ICommand {
|
||||
|
||||
p.add(pc);
|
||||
} catch (IllegalArgumentException | IllegalAccessException | InstantiationException | InvocationTargetException | NoSuchMethodException | SecurityException e) {
|
||||
Iris.reportError(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package com.volmit.iris.util;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
@@ -36,6 +37,7 @@ public abstract class MortarPermission {
|
||||
i.set(Modifier.isStatic(i.getModifiers()) ? null : this, px);
|
||||
} catch (IllegalArgumentException | IllegalAccessException | InstantiationException | InvocationTargetException | NoSuchMethodException | SecurityException e) {
|
||||
e.printStackTrace();
|
||||
Iris.reportError(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -50,6 +52,7 @@ public abstract class MortarPermission {
|
||||
p.add((MortarPermission) i.get(Modifier.isStatic(i.getModifiers()) ? null : this));
|
||||
} catch (IllegalArgumentException | IllegalAccessException | SecurityException e) {
|
||||
e.printStackTrace();
|
||||
Iris.reportError(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
|
||||
package com.volmit.iris.util;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -129,7 +131,8 @@ public enum NMSVersion {
|
||||
try {
|
||||
Class.forName("org.bukkit.craftbukkit.v" + v + ".CraftWorld");
|
||||
return true;
|
||||
} catch (Throwable ignored) {
|
||||
} catch (Throwable e) {
|
||||
Iris.reportError(e);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -116,6 +116,7 @@ public class ObjectResourceLoader extends ResourceLoader<IrisObject> {
|
||||
lock.unlock();
|
||||
return t;
|
||||
} catch (Throwable e) {
|
||||
Iris.reportError(e);
|
||||
lock.unlock();
|
||||
Iris.warn("Couldn't read " + resourceTypeName + " file: " + j.getPath() + ": " + e.getMessage());
|
||||
return null;
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package com.volmit.iris.util;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.Particle;
|
||||
@@ -74,6 +75,7 @@ interface ParticleSender {
|
||||
try {
|
||||
return Particle.valueOf(particle.toString());
|
||||
} catch (IllegalArgumentException e) {
|
||||
Iris.reportError(e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package com.volmit.iris.util;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -129,6 +130,7 @@ class ParticleSenderLegacy implements ParticleSender {
|
||||
SEND_PACKET.invoke(playerConnection, packet);
|
||||
}
|
||||
} catch (ReflectiveOperationException e) {
|
||||
Iris.reportError(e);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
@@ -146,7 +148,7 @@ class ParticleSenderLegacy implements ParticleSender {
|
||||
|
||||
try {
|
||||
return getEnumParticle(particle);
|
||||
} catch (IllegalArgumentException e) {
|
||||
} catch (IllegalArgumentException e) {Iris.reportError(e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package com.volmit.iris.util;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.material.MaterialData;
|
||||
@@ -175,6 +176,7 @@ public enum ParticleType {
|
||||
try {
|
||||
return ParticleType.valueOf(particleName.toUpperCase());
|
||||
} catch (IllegalArgumentException e) {
|
||||
Iris.reportError(e);
|
||||
for (ParticleType particle : values()) {
|
||||
if (particle.getName().equalsIgnoreCase(particleName)) {
|
||||
return particle;
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
|
||||
package com.volmit.iris.util;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
|
||||
public class QueueExecutor extends Looper {
|
||||
private final Queue<Runnable> queue;
|
||||
private boolean shutdown;
|
||||
@@ -37,6 +39,7 @@ public class QueueExecutor extends Looper {
|
||||
try {
|
||||
queue.next().run();
|
||||
} catch (Throwable e) {
|
||||
Iris.reportError(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ public class ResourceLoader<T extends IrisRegistrant> {
|
||||
t.setLoader(manager);
|
||||
lock.unlock();
|
||||
return t;
|
||||
} catch (Throwable e) {
|
||||
} catch (Throwable e) {Iris.reportError(e);
|
||||
lock.unlock();
|
||||
failLoad(j, e);
|
||||
return null;
|
||||
|
||||
@@ -24,6 +24,7 @@ import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat;
|
||||
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats;
|
||||
import com.sk89q.worldedit.extent.clipboard.io.ClipboardReader;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.object.IrisObject;
|
||||
|
||||
import java.io.File;
|
||||
@@ -48,6 +49,7 @@ public class SKConversion {
|
||||
|
||||
o.write(out);
|
||||
} catch (IOException e) {
|
||||
Iris.reportError(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package com.volmit.iris.util;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
@@ -191,8 +192,9 @@ public class TaskExecutor {
|
||||
try {
|
||||
task.run();
|
||||
state = TaskState.COMPLETED;
|
||||
} catch (Throwable ex) {
|
||||
} catch (Throwable ex) {Iris.reportError(ex);
|
||||
ex.printStackTrace();
|
||||
Iris.reportError(ex);
|
||||
state = TaskState.FAILED;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -60,7 +60,7 @@ public class ThreadMonitor extends Thread {
|
||||
if (cl.flip()) {
|
||||
Iris.info("Cycles: " + Form.f(cycles) + " (" + Form.duration(sq.getAverage(), 2) + ")");
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
} catch (Throwable e) {Iris.reportError(e);
|
||||
running = false;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
|
||||
package com.volmit.iris.util;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
|
||||
/**
|
||||
* A generic 2-element tuple that is represented by double-precision
|
||||
* floating point x,y coordinates.
|
||||
@@ -294,6 +296,7 @@ public abstract class Tuple2d implements java.io.Serializable, Cloneable {
|
||||
try {
|
||||
return (this.x == t1.x && this.y == t1.y);
|
||||
} catch (NullPointerException e2) {
|
||||
Iris.reportError(e2);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -312,6 +315,7 @@ public abstract class Tuple2d implements java.io.Serializable, Cloneable {
|
||||
Tuple2d t2 = (Tuple2d) t1;
|
||||
return (this.x == t2.x && this.y == t2.y);
|
||||
} catch (NullPointerException | ClassCastException e2) {
|
||||
Iris.reportError(e2);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -504,7 +508,7 @@ public abstract class Tuple2d implements java.io.Serializable, Cloneable {
|
||||
// Since there are no arrays we can just use Object.clone()
|
||||
try {
|
||||
return super.clone();
|
||||
} catch (CloneNotSupportedException e) {
|
||||
} catch (CloneNotSupportedException e) {Iris.reportError(e);
|
||||
// this shouldn't happen, since we are Cloneable
|
||||
throw new InternalError();
|
||||
}
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
|
||||
package com.volmit.iris.util;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
|
||||
/**
|
||||
* A generic 2-element tuple that is represented by single-precision
|
||||
* floating point x,y coordinates.
|
||||
@@ -296,6 +298,7 @@ public abstract class Tuple2f implements java.io.Serializable, Cloneable {
|
||||
try {
|
||||
return (this.x == t1.x && this.y == t1.y);
|
||||
} catch (NullPointerException e2) {
|
||||
Iris.reportError(e2);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -314,6 +317,7 @@ public abstract class Tuple2f implements java.io.Serializable, Cloneable {
|
||||
Tuple2f t2 = (Tuple2f) t1;
|
||||
return (this.x == t2.x && this.y == t2.y);
|
||||
} catch (NullPointerException | ClassCastException e2) {
|
||||
Iris.reportError(e2);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -508,7 +512,7 @@ public abstract class Tuple2f implements java.io.Serializable, Cloneable {
|
||||
// Since there are no arrays we can just use Object.clone()
|
||||
try {
|
||||
return super.clone();
|
||||
} catch (CloneNotSupportedException e) {
|
||||
} catch (CloneNotSupportedException e) {Iris.reportError(e);
|
||||
// this shouldn't happen, since we are Cloneable
|
||||
throw new InternalError();
|
||||
}
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
|
||||
package com.volmit.iris.util;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
|
||||
/**
|
||||
* A generic 3-element tuple that is represented by double-precision
|
||||
* floating point x,y,z coordinates.
|
||||
@@ -345,6 +347,7 @@ public abstract class Tuple3d implements java.io.Serializable, Cloneable {
|
||||
try {
|
||||
return (this.x == t1.x && this.y == t1.y && this.z == t1.z);
|
||||
} catch (NullPointerException e2) {
|
||||
Iris.reportError(e2);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -362,6 +365,7 @@ public abstract class Tuple3d implements java.io.Serializable, Cloneable {
|
||||
Tuple3d t2 = (Tuple3d) t1;
|
||||
return (this.x == t2.x && this.y == t2.y && this.z == t2.z);
|
||||
} catch (ClassCastException | NullPointerException e1) {
|
||||
Iris.reportError(e1);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -635,6 +639,7 @@ public abstract class Tuple3d implements java.io.Serializable, Cloneable {
|
||||
try {
|
||||
return super.clone();
|
||||
} catch (CloneNotSupportedException e) {
|
||||
Iris.reportError(e);
|
||||
// this shouldn't happen, since we are Cloneable
|
||||
throw new InternalError();
|
||||
}
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
|
||||
package com.volmit.iris.util;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
|
||||
/**
|
||||
* A generic 3-element tuple that is represented by single precision-floating
|
||||
* point x,y,z coordinates.
|
||||
@@ -330,6 +332,7 @@ public abstract class Tuple3f implements java.io.Serializable, Cloneable {
|
||||
try {
|
||||
return (this.x == t1.x && this.y == t1.y && this.z == t1.z);
|
||||
} catch (NullPointerException e2) {
|
||||
Iris.reportError(e2);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -347,6 +350,7 @@ public abstract class Tuple3f implements java.io.Serializable, Cloneable {
|
||||
Tuple3f t2 = (Tuple3f) t1;
|
||||
return (this.x == t2.x && this.y == t2.y && this.z == t2.z);
|
||||
} catch (NullPointerException | ClassCastException e2) {
|
||||
Iris.reportError(e2);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -578,7 +582,7 @@ public abstract class Tuple3f implements java.io.Serializable, Cloneable {
|
||||
// Since there are no arrays we can just use Object.clone()
|
||||
try {
|
||||
return super.clone();
|
||||
} catch (CloneNotSupportedException e) {
|
||||
} catch (CloneNotSupportedException e) {Iris.reportError(e);
|
||||
// this shouldn't happen, since we are Cloneable
|
||||
throw new InternalError();
|
||||
}
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
|
||||
package com.volmit.iris.util;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
|
||||
/**
|
||||
* A 4 element tuple represented by double precision floating point
|
||||
* x,y,z,w coordinates.
|
||||
@@ -369,6 +371,7 @@ public abstract class Tuple4d implements java.io.Serializable, Cloneable {
|
||||
return (this.x == t1.x && this.y == t1.y && this.z == t1.z
|
||||
&& this.w == t1.w);
|
||||
} catch (NullPointerException e2) {
|
||||
Iris.reportError(e2);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -388,6 +391,7 @@ public abstract class Tuple4d implements java.io.Serializable, Cloneable {
|
||||
return (this.x == t2.x && this.y == t2.y &&
|
||||
this.z == t2.z && this.w == t2.w);
|
||||
} catch (NullPointerException | ClassCastException e2) {
|
||||
Iris.reportError(e2);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -709,7 +713,7 @@ public abstract class Tuple4d implements java.io.Serializable, Cloneable {
|
||||
// Since there are no arrays we can just use Object.clone()
|
||||
try {
|
||||
return super.clone();
|
||||
} catch (CloneNotSupportedException e) {
|
||||
} catch (CloneNotSupportedException e) {Iris.reportError(e);
|
||||
// this shouldn't happen, since we are Cloneable
|
||||
throw new InternalError();
|
||||
}
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
|
||||
package com.volmit.iris.util;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
|
||||
/**
|
||||
* A 4-element tuple represented by single-precision floating point x,y,z,w
|
||||
* coordinates.
|
||||
@@ -357,6 +359,7 @@ public abstract class Tuple4f implements java.io.Serializable, Cloneable {
|
||||
return (this.x == t1.x && this.y == t1.y && this.z == t1.z
|
||||
&& this.w == t1.w);
|
||||
} catch (NullPointerException e2) {
|
||||
Iris.reportError(e2);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -375,6 +378,7 @@ public abstract class Tuple4f implements java.io.Serializable, Cloneable {
|
||||
return (this.x == t2.x && this.y == t2.y &&
|
||||
this.z == t2.z && this.w == t2.w);
|
||||
} catch (NullPointerException | ClassCastException e2) {
|
||||
Iris.reportError(e2);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -633,7 +637,7 @@ public abstract class Tuple4f implements java.io.Serializable, Cloneable {
|
||||
// Since there are no arrays we can just use Object.clone()
|
||||
try {
|
||||
return super.clone();
|
||||
} catch (CloneNotSupportedException e) {
|
||||
} catch (CloneNotSupportedException e) {Iris.reportError(e);
|
||||
// this shouldn't happen, since we are Cloneable
|
||||
throw new InternalError();
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package com.volmit.iris.util;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@@ -159,9 +160,10 @@ public class UIElement implements Element {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
} catch (NullPointerException ignored) {
|
||||
} catch (NullPointerException e) {
|
||||
Iris.reportError(e);
|
||||
|
||||
} catch (Throwable e) {
|
||||
} catch (Throwable e) {Iris.reportError(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -211,7 +213,7 @@ public class UIElement implements Element {
|
||||
|
||||
is.setItemMeta(im);
|
||||
return is;
|
||||
} catch (Throwable e) {
|
||||
} catch (Throwable e) {Iris.reportError(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
|
||||
package com.volmit.iris.util;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
|
||||
public class V {
|
||||
@@ -50,6 +52,7 @@ public class V {
|
||||
try {
|
||||
return local ? Violator.getDeclaredAnnotation(o.getClass(), t) : Violator.getAnnotation(o.getClass(), t);
|
||||
} catch (Throwable e) {
|
||||
Iris.reportError(e);
|
||||
if (!suppress) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -61,7 +64,7 @@ public class V {
|
||||
public <T extends Annotation> T get(Class<? extends T> t, String mn, Class<?>... pars) {
|
||||
try {
|
||||
return local ? Violator.getDeclaredAnnotation(Violator.getDeclaredMethod(o.getClass(), mn, pars), t) : Violator.getAnnotation(Violator.getMethod(o.getClass(), mn, pars), t);
|
||||
} catch (Throwable e) {
|
||||
} catch (Throwable e) {Iris.reportError(e);
|
||||
if (!suppress) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -73,7 +76,7 @@ public class V {
|
||||
public <T extends Annotation> T get(Class<? extends T> t, String mn) {
|
||||
try {
|
||||
return local ? Violator.getDeclaredAnnotation(Violator.getDeclaredField(o.getClass(), mn), t) : Violator.getAnnotation(Violator.getField(o.getClass(), mn), t);
|
||||
} catch (Throwable e) {
|
||||
} catch (Throwable e) {Iris.reportError(e);
|
||||
if (!suppress) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -86,7 +89,7 @@ public class V {
|
||||
public <T> T get(String field) {
|
||||
try {
|
||||
return (T) (local ? Violator.getDeclaredField(o.getClass(), field) : Violator.getField(o.getClass(), field)).get(o);
|
||||
} catch (Throwable e) {
|
||||
} catch (Throwable e) {Iris.reportError(e);
|
||||
if (!suppress) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -108,7 +111,7 @@ public class V {
|
||||
|
||||
try {
|
||||
return (local ? Violator.getDeclaredMethod(o.getClass(), method, par.toArray(new Class<?>[0])) : Violator.getMethod(o.getClass(), method, par.toArray(new Class<?>[0]))).invoke(o, parameters);
|
||||
} catch (Throwable e) {
|
||||
} catch (Throwable e) {Iris.reportError(e);
|
||||
if (!suppress) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -121,7 +124,7 @@ public class V {
|
||||
try {
|
||||
// https://github.com/VolmitSoftware/Mortar/issues/5
|
||||
(local ? Violator.getDeclaredField(o.getClass(), field) : Violator.getField(o.getClass(), field)).set(o, value);
|
||||
} catch (Throwable e) {
|
||||
} catch (Throwable e) {Iris.reportError(e);
|
||||
if (!suppress) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
|
||||
package com.volmit.iris.util;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.Field;
|
||||
@@ -111,6 +113,7 @@ public class Violator {
|
||||
f.setAccessible(true);
|
||||
p(id(c, null) + "." + name, f);
|
||||
} catch (NoSuchFieldException e) {
|
||||
Iris.reportError(e);
|
||||
Class s = c.getSuperclass();
|
||||
if (null == s) {
|
||||
throw e;
|
||||
@@ -131,7 +134,7 @@ public class Violator {
|
||||
Field f = c.getDeclaredField(name);
|
||||
f.setAccessible(true);
|
||||
p(id(c, null) + "." + name, f);
|
||||
} catch (NoSuchFieldException e) {
|
||||
} catch (NoSuchFieldException e) {Iris.reportError(e);
|
||||
Class s = c.getSuperclass();
|
||||
if (null == s) {
|
||||
throw e;
|
||||
@@ -176,7 +179,7 @@ public class Violator {
|
||||
try {
|
||||
Constructor<?> co = getConstructor(c, cv.toArray(new Class<?>[0]));
|
||||
return (T) co.newInstance(parameters);
|
||||
} catch (Exception e) {
|
||||
} catch (Exception e) {Iris.reportError(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ public class VirtualCommand {
|
||||
ICommand cmd = (ICommand) i.getType().getConstructor().newInstance();
|
||||
new V(command, true, true).set(i.getName(), cmd);
|
||||
children.put(cmd.getAllNodes(), new VirtualCommand(cmd, cc.value().trim().isEmpty() ? tag : cc.value().trim()));
|
||||
} catch (Exception e) {
|
||||
} catch (Exception e) {Iris.reportError(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ public abstract class VolmitPlugin extends JavaPlugin implements Listener {
|
||||
listenersField.setAccessible(true);
|
||||
//noinspection unchecked
|
||||
listeners = (Map<Event, SortedSet<RegisteredListener>>) listenersField.get(getServer().getPluginManager());
|
||||
} catch (Throwable ignored) {
|
||||
} catch (Throwable e) {Iris.reportError(e);
|
||||
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ public abstract class VolmitPlugin extends JavaPlugin implements Listener {
|
||||
//noinspection unchecked
|
||||
commands = (Map<String, Command>) knownCommandsField.get(commandMap);
|
||||
|
||||
} catch (Throwable ignored) {
|
||||
} catch (Throwable e) {Iris.reportError(e);
|
||||
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ public abstract class VolmitPlugin extends JavaPlugin implements Listener {
|
||||
if (cl instanceof URLClassLoader) {
|
||||
try {
|
||||
((URLClassLoader) cl).close();
|
||||
} catch (IOException ignored) {
|
||||
} catch (IOException e) {Iris.reportError(e);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -187,7 +187,7 @@ public abstract class VolmitPlugin extends JavaPlugin implements Listener {
|
||||
outputPluginInfo();
|
||||
outputCommandInfo();
|
||||
outputPermissionInfo();
|
||||
} catch (Throwable ignored) {
|
||||
} catch (Throwable e) {Iris.reportError(e);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -259,6 +259,7 @@ public abstract class VolmitPlugin extends JavaPlugin implements Listener {
|
||||
permissionCache.add(pc);
|
||||
v("Registered Permissions " + pc.getFullNode() + " (" + i.getName() + ")");
|
||||
} catch (IllegalArgumentException | IllegalAccessException | InstantiationException | InvocationTargetException | NoSuchMethodException | SecurityException e) {
|
||||
Iris.reportError(e);
|
||||
w("Failed to register permission (field " + i.getName() + ")");
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -268,7 +269,7 @@ public abstract class VolmitPlugin extends JavaPlugin implements Listener {
|
||||
for (org.bukkit.permissions.Permission i : computePermissions()) {
|
||||
try {
|
||||
Bukkit.getPluginManager().addPermission(i);
|
||||
} catch (Throwable ignored) {
|
||||
} catch (Throwable e) {Iris.reportError(e);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -283,7 +284,7 @@ public abstract class VolmitPlugin extends JavaPlugin implements Listener {
|
||||
g.add(toPermission(x));
|
||||
g.addAll(computePermissions(x));
|
||||
} catch (IllegalArgumentException | IllegalAccessException | SecurityException e) {
|
||||
e.printStackTrace();
|
||||
Iris.reportError(e);e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -363,7 +364,7 @@ public abstract class VolmitPlugin extends JavaPlugin implements Listener {
|
||||
i.tick();
|
||||
} catch (Throwable e) {
|
||||
w("Failed to tick controller " + i.getName());
|
||||
e.printStackTrace();
|
||||
e.printStackTrace();Iris.reportError(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -393,7 +394,7 @@ public abstract class VolmitPlugin extends JavaPlugin implements Listener {
|
||||
v("Registered " + pc.getName() + " (" + i.getName() + ")");
|
||||
} catch (IllegalArgumentException | IllegalAccessException | InstantiationException | InvocationTargetException | NoSuchMethodException | SecurityException e) {
|
||||
w("Failed to register controller (field " + i.getName() + ")");
|
||||
e.printStackTrace();
|
||||
e.printStackTrace();Iris.reportError(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -418,7 +419,7 @@ public abstract class VolmitPlugin extends JavaPlugin implements Listener {
|
||||
v("Started " + pc.getName());
|
||||
} catch (Throwable e) {
|
||||
w("Failed to start controller " + pc.getName());
|
||||
e.printStackTrace();
|
||||
e.printStackTrace();Iris.reportError(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -434,7 +435,7 @@ public abstract class VolmitPlugin extends JavaPlugin implements Listener {
|
||||
v("Registered Instance " + i.getName());
|
||||
} catch (IllegalArgumentException | IllegalAccessException | SecurityException e) {
|
||||
w("Failed to register instance (field " + i.getName() + ")");
|
||||
e.printStackTrace();
|
||||
e.printStackTrace();Iris.reportError(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -452,7 +453,7 @@ public abstract class VolmitPlugin extends JavaPlugin implements Listener {
|
||||
v("Unregistered Instance " + i.getName());
|
||||
} catch (IllegalArgumentException | IllegalAccessException | SecurityException e) {
|
||||
w("Failed to unregister instance (field " + i.getName() + ")");
|
||||
e.printStackTrace();
|
||||
e.printStackTrace();Iris.reportError(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -476,7 +477,7 @@ public abstract class VolmitPlugin extends JavaPlugin implements Listener {
|
||||
v("Registered Commands /" + pc.getNode() + " (" + i.getName() + ")");
|
||||
} catch (IllegalArgumentException | IllegalAccessException | InstantiationException | InvocationTargetException | NoSuchMethodException | SecurityException e) {
|
||||
w("Failed to register command (field " + i.getName() + ")");
|
||||
e.printStackTrace();
|
||||
e.printStackTrace();Iris.reportError(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -584,7 +585,7 @@ public abstract class VolmitPlugin extends JavaPlugin implements Listener {
|
||||
}
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
e.printStackTrace();Iris.reportError(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -623,7 +624,7 @@ public abstract class VolmitPlugin extends JavaPlugin implements Listener {
|
||||
for (VirtualCommand i : commands.v()) {
|
||||
try {
|
||||
unregisterCommand(i.getCommand());
|
||||
} catch (Throwable ignored) {
|
||||
} catch (Throwable e) {Iris.reportError(e);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -648,7 +649,7 @@ public abstract class VolmitPlugin extends JavaPlugin implements Listener {
|
||||
unregisterListener(i);
|
||||
i.stop();
|
||||
v("Stopped " + i.getName());
|
||||
} catch (Throwable e) {
|
||||
} catch (Throwable e) {Iris.reportError(e);
|
||||
w("Failed to stop controller " + i.getName());
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
package com.volmit.iris.util;
|
||||
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
/**
|
||||
@@ -322,12 +324,13 @@ public class XML {
|
||||
}
|
||||
}
|
||||
} catch (Exception ignore) {
|
||||
Iris.reportError(ignore);
|
||||
try {
|
||||
Double value = new Double(string);
|
||||
if (value.toString().equals(string)) {
|
||||
return value;
|
||||
}
|
||||
} catch (Exception ignored) {
|
||||
} catch (Exception e) {Iris.reportError(e);
|
||||
}
|
||||
}
|
||||
return string;
|
||||
|
||||
Reference in New Issue
Block a user