Skip to content

Commit

Permalink
Fix ping packet decoding
Browse files Browse the repository at this point in the history
Previously, the ampersand character was incorrectly used instead of the
section sign character, which is clearly the right character according
to https://wiki.vg/Server_List_Ping#1.6 .

The mistake seems to have been introduced when the source code was first
published, but went unnoticed since an older version (which didn't
contain the mistake) was published as the final release JAR.

See also: PlaceholderAPI#2
  • Loading branch information
0dinD committed Mar 3, 2023
1 parent 34d9492 commit 0128494
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ public boolean fetchData() {
return false;
}
String string = new String(chars);
if (string.startsWith("&")) {
if (string.startsWith("§")) {
String[] data = string.split("\000");
setPingVersion(Integer.parseInt(data[0].substring(1)));
setProtocolVersion(Integer.parseInt(data[1]));
Expand All @@ -303,7 +303,7 @@ public boolean fetchData() {
setPlayersOnline(Integer.parseInt(data[4]));
setMaxPlayers(Integer.parseInt(data[5]));
} else {
String[] data = string.split("&");
String[] data = string.split("§");
setMotd(data[0]);
setPlayersOnline(Integer.parseInt(data[1]));
setMaxPlayers(Integer.parseInt(data[2]));
Expand Down

0 comments on commit 0128494

Please sign in to comment.