Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-12-26 00:00:28 +01:00
Use new JSONParsers or they all implode.
Dieser Commit ist enthalten in:
Ursprung
2704611977
Commit
a42b113618
@ -26,8 +26,6 @@ import java.util.*;
|
|||||||
import static us.myles.ViaVersion.util.PacketUtil.*;
|
import static us.myles.ViaVersion.util.PacketUtil.*;
|
||||||
|
|
||||||
public class OutgoingTransformer {
|
public class OutgoingTransformer {
|
||||||
private static JSONParser parser = new JSONParser();
|
|
||||||
|
|
||||||
private final ConnectionInfo info;
|
private final ConnectionInfo info;
|
||||||
private final ViaVersionPlugin plugin = (ViaVersionPlugin) ViaVersion.getInstance();
|
private final ViaVersionPlugin plugin = (ViaVersionPlugin) ViaVersion.getInstance();
|
||||||
private boolean cancel = false;
|
private boolean cancel = false;
|
||||||
@ -240,7 +238,7 @@ public class OutgoingTransformer {
|
|||||||
if (packet == PacketType.STATUS_RESPONSE) {
|
if (packet == PacketType.STATUS_RESPONSE) {
|
||||||
String original = PacketUtil.readString(input);
|
String original = PacketUtil.readString(input);
|
||||||
try {
|
try {
|
||||||
JSONObject json = (JSONObject) parser.parse(original);
|
JSONObject json = (JSONObject) new JSONParser().parse(original);
|
||||||
JSONObject version = (JSONObject) json.get("version");
|
JSONObject version = (JSONObject) json.get("version");
|
||||||
version.put("protocol", info.getProtocol());
|
version.put("protocol", info.getProtocol());
|
||||||
PacketUtil.writeString(json.toJSONString(), output);
|
PacketUtil.writeString(json.toJSONString(), output);
|
||||||
@ -597,9 +595,9 @@ public class OutgoingTransformer {
|
|||||||
line = "{\"text\":" + line + "}";
|
line = "{\"text\":" + line + "}";
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
parser.parse(line);
|
new JSONParser().parse(line);
|
||||||
} catch (org.json.simple.parser.ParseException e) {
|
} catch (Exception e) {
|
||||||
System.out.println("Invalid JSON String: \"" + line + "\" Please report this issue to the ViaVersion Github!");
|
System.out.println("Invalid JSON String: \"" + line + "\" Please report this issue to the ViaVersion Github: " + e.getMessage());
|
||||||
return "{\"text\":\"\"}";
|
return "{\"text\":\"\"}";
|
||||||
}
|
}
|
||||||
return line;
|
return line;
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren