mirror of
https://github.com/ME1312/SubServers-2.git
synced 2025-01-25 09:01:23 +01:00
Fix SubData's log stream
This commit is contained in:
parent
361acf7b17
commit
7158e0a3da
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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));
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user