Fix SubData's log stream

This commit is contained in:
ME1312 2019-01-22 12:48:47 -05:00
parent 361acf7b17
commit 7158e0a3da
No known key found for this signature in database
GPG Key ID: FEFFE2F698E88FA8
12 changed files with 24 additions and 24 deletions

View File

@ -23,7 +23,7 @@ public class Version implements Serializable, Comparable<Version> {
* @param string Version String
*/
public Version(String string) {
this(VersionType.RELEASE, string);
this(VersionType.VERSION, string);
}
/**
@ -43,7 +43,7 @@ public class Version implements Serializable, Comparable<Version> {
* @param string Version String
*/
public Version(Version parent, String string) {
this(parent, VersionType.RELEASE, string);
this(parent, VersionType.VERSION, string);
}
/**
@ -66,7 +66,7 @@ public class Version implements Serializable, Comparable<Version> {
* @param ints Version Numbers (Will be separated with dots)
*/
public Version(int... ints) {
this(VersionType.RELEASE, ints);
this(VersionType.VERSION, ints);
}
/**
@ -86,7 +86,7 @@ public class Version implements Serializable, Comparable<Version> {
* @param ints Version Numbers (Will be separated with dots)
*/
public Version(Version parent, int... ints) {
this(parent, VersionType.RELEASE, ints);
this(parent, VersionType.VERSION, ints);
}
/**

View File

@ -89,7 +89,7 @@ public class PacketOutRunEvent implements Listener, PacketOut {
args.set("host", event.getHost().getName());
args.set("name", event.getName());
args.set("template", event.getTemplate().getName());
args.set("version", event.getVersion().toString());
args.set("version", event.getVersion());
args.set("port", event.getPort());
plugin.subdata.broadcastPacket(new PacketOutRunEvent(event.getClass(), args));
}

View File

@ -432,13 +432,13 @@ public final class SubDataServer {
YAMLSection section = new YAMLSection();
if (!pOut.keySet().contains(packet.getClass())) throw new IllegalPacketException(packet.getClass().getCanonicalName() + ": Unknown PacketOut Channel: " + packet.getClass().getCanonicalName());
if (packet.getVersion().toString() == null) throw new NullPointerException(packet.getClass().getCanonicalName() + ": PacketOut getVersion() cannot be null: " + packet.getClass().getCanonicalName());
if (packet.getVersion() == null) throw new NullPointerException(packet.getClass().getCanonicalName() + ": PacketOut getVersion() cannot be null: " + packet.getClass().getCanonicalName());
try {
YAMLSection contents = packet.generate();
section.set("n", pOut.get(packet.getClass()).name());
section.set("h", pOut.get(packet.getClass()).get());
section.set("v", packet.getVersion().toString());
section.set("v", packet.getVersion());
if (contents != null) section.set("c", contents);
return section;
} catch (Throwable e) {
@ -462,7 +462,7 @@ public final class SubDataServer {
if (packet.isCompatible(data.getVersion("v"))) {
list.add(packet);
} else {
new IllegalPacketException(client.getAddress().toString() + ": Packet Version Mismatch in " + data.getRawString("h") + ": " + data.getRawString("v") + " =/= " + packet.getVersion().toString()).printStackTrace();
new IllegalPacketException(client.getAddress().toString() + ": Packet Version Mismatch in " + data.getRawString("h") + ": " + data.getRawString("v") + " =/= " + packet.getVersion().toFullString()).printStackTrace();
}
}

View File

@ -374,7 +374,7 @@ public final class SubDataClient {
YAMLSection data = new YAMLSection();
if (!pOut.keySet().contains(packet.getClass())) throw new IllegalPacketException("Unknown PacketOut Channel: " + packet.getClass().getCanonicalName());
if (packet.getVersion().toString() == null) throw new NullPointerException("PacketOut Version cannot be null: " + packet.getClass().getCanonicalName());
if (packet.getVersion() == null) throw new NullPointerException("PacketOut Version cannot be null: " + packet.getClass().getCanonicalName());
try {
YAMLSection contents = packet.generate();
@ -405,7 +405,7 @@ public final class SubDataClient {
if (packet.isCompatible(data.getVersion("v"))) {
list.add(packet);
} else {
new IllegalPacketException("Packet Version Mismatch in " + data.getRawString("h") + ": " + data.getRawString("v") + " -> " + packet.getVersion().toString()).printStackTrace();
new IllegalPacketException("Packet Version Mismatch in " + data.getRawString("h") + ": " + data.getRawString("v") + " -> " + packet.getVersion().toFullString()).printStackTrace();
}
}

View File

@ -21,7 +21,7 @@ public final class PacketAuthorization implements PacketIn, PacketOut {
public PacketAuthorization(SubPlugin plugin) {
if (Util.isNull(plugin)) throw new NullPointerException();
this.plugin = plugin;
Util.isException(() -> Util.reflect(SubDataClient.class.getDeclaredField("log"), null));
Util.isException(() -> this.log = Util.reflect(SubDataClient.class.getDeclaredField("log"), null));
}
@Override

View File

@ -28,7 +28,7 @@ public class PacketDownloadLang implements PacketIn, PacketOut {
public PacketDownloadLang(SubPlugin plugin) {
if (Util.isNull(plugin)) throw new NullPointerException();
this.plugin = plugin;
Util.isException(() -> Util.reflect(SubDataClient.class.getDeclaredField("log"), null));
Util.isException(() -> this.log = Util.reflect(SubDataClient.class.getDeclaredField("log"), null));
}
/**

View File

@ -24,7 +24,7 @@ public class PacketInReload implements PacketIn {
*/
public PacketInReload(SubPlugin plugin) {
this.plugin = plugin;
Util.isException(() -> Util.reflect(SubDataClient.class.getDeclaredField("log"), null));
Util.isException(() -> this.log = Util.reflect(SubDataClient.class.getDeclaredField("log"), null));
}
@Override

View File

@ -20,7 +20,7 @@ public class PacketInReset implements PacketIn {
* New PacketInReset
*/
public PacketInReset() {
Util.isException(() -> Util.reflect(SubDataClient.class.getDeclaredField("log"), null));
Util.isException(() -> this.log = Util.reflect(SubDataClient.class.getDeclaredField("log"), null));
}
@Override

View File

@ -27,7 +27,7 @@ public class PacketLinkServer implements PacketIn, PacketOut {
public PacketLinkServer(SubPlugin plugin) {
if (Util.isNull(plugin)) throw new NullPointerException();
this.plugin = plugin;
Util.isException(() -> Util.reflect(SubDataClient.class.getDeclaredField("log"), null));
Util.isException(() -> this.log = Util.reflect(SubDataClient.class.getDeclaredField("log"), null));
}
@Override

View File

@ -36,7 +36,7 @@ public final class SubDataClient {
private static HashMap<String, HashMap<String, List<PacketIn>>> pIn = new HashMap<String, HashMap<String, List<PacketIn>>>();
private static HashMap<String, Cipher> ciphers = new HashMap<String, Cipher>();
private static boolean defaults = false;
protected static Logger log;
protected static Logger log = LoggerFactory.getLogger("SubData");
private MessagePacker out;
private NamedContainer<Boolean, Socket> socket;
private String name;
@ -378,7 +378,7 @@ public final class SubDataClient {
YAMLSection data = new YAMLSection();
if (!pOut.keySet().contains(packet.getClass())) throw new IllegalPacketException("Unknown PacketOut Channel: " + packet.getClass().getCanonicalName());
if (packet.getVersion().toString() == null) throw new NullPointerException("PacketOut Version cannot be null: " + packet.getClass().getCanonicalName());
if (packet.getVersion() == null) throw new NullPointerException("PacketOut Version cannot be null: " + packet.getClass().getCanonicalName());
try {
YAMLSection contents = packet.generate();
@ -409,7 +409,7 @@ public final class SubDataClient {
if (packet.isCompatible(data.getVersion("v"))) {
list.add(packet);
} else {
new IllegalPacketException("Packet Version Mismatch in " + data.getRawString("h") + ": " + data.getRawString("v") + " -> " + packet.getVersion().toString()).printStackTrace();
new IllegalPacketException("Packet Version Mismatch in " + data.getRawString("h") + ": " + data.getRawString("v") + " -> " + packet.getVersion()).printStackTrace();
}
}

View File

@ -498,13 +498,13 @@ public final class SubDataClient {
YAMLSection json = new YAMLSection();
if (!pOut.keySet().contains(packet.getClass())) throw new IllegalPacketException("Unknown PacketOut Channel: " + packet.getClass().getCanonicalName());
if (packet.getVersion().toString() == null) throw new NullPointerException("PacketOut Version cannot be null: " + packet.getClass().getCanonicalName());
if (packet.getVersion() == null) throw new NullPointerException("PacketOut Version cannot be null: " + packet.getClass().getCanonicalName());
try {
YAMLSection contents = packet.generate();
json.set("n", pOut.get(packet.getClass()).name());
json.set("h", pOut.get(packet.getClass()).get());
json.set("v", packet.getVersion().toString());
json.set("v", packet.getVersion());
if (contents != null) json.set("c", contents);
} catch (Throwable e) {
throw new InvocationTargetException(e, "Exception while encoding packet");
@ -530,7 +530,7 @@ public final class SubDataClient {
if (packet.isCompatible(data.getVersion("v"))) {
list.add(packet);
} else {
SubAPI.getInstance().getInternals().log.error.println(new IllegalPacketException("Packet Version Mismatch in " + data.getRawString("h") + ": " + data.getRawString("v") + " -> " + packet.getVersion().toString()));
SubAPI.getInstance().getInternals().log.error.println(new IllegalPacketException("Packet Version Mismatch in " + data.getRawString("h") + ": " + data.getRawString("v") + " -> " + packet.getVersion().toFullString()));
}
}

View File

@ -416,13 +416,13 @@ public final class SubDataClient {
YAMLSection json = new YAMLSection();
if (!pOut.keySet().contains(packet.getClass())) throw new IllegalPacketException("Unknown PacketOut Channel: " + packet.getClass().getCanonicalName());
if (packet.getVersion().toString() == null) throw new NullPointerException("PacketOut Version cannot be null: " + packet.getClass().getCanonicalName());
if (packet.getVersion() == null) throw new NullPointerException("PacketOut Version cannot be null: " + packet.getClass().getCanonicalName());
try {
YAMLSection contents = packet.generate();
json.set("n", pOut.get(packet.getClass()).name());
json.set("h", pOut.get(packet.getClass()).get());
json.set("v", packet.getVersion().toString());
json.set("v", packet.getVersion());
if (contents != null) json.set("c", contents);
return json;
} catch (Throwable e) {
@ -447,7 +447,7 @@ public final class SubDataClient {
if (packet.isCompatible(data.getVersion("v"))) {
list.add(packet);
} else {
new IllegalPacketException("Packet Version Mismatch in " + data.getRawString("h") + ": " + data.getRawString("v") + " -> " + packet.getVersion().toString()).printStackTrace();
new IllegalPacketException("Packet Version Mismatch in " + data.getRawString("h") + ": " + data.getRawString("v") + " -> " + packet.getVersion().toFullString()).printStackTrace();
}
}