-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pinger's MOTD Placeholder doesn't update as the MOTD updates #2
Comments
3 years and still not fixed :C |
This is still happening. %pinger_motd% returns whatever is in the server.config file in your Minecraft server. |
Pretty sure this can't be fixed at all. Not sure if the MC client sends some specific data that makes it receive diffrent data, including a different MOTD, but it could be exactly that to be honest here. Either way, if you understand a bit of Java code, look at this section here: This is where the expansion retrieves the data from the pinged server, extracts the data from it, converts it to a String, splits it up into sections and then uses each section for the different options (MOTD, Players, etc) If you're pinging a MC server that is part of a MC network AND the MOTD is handled by a BungeeCord plugin could the issue be that you ping the server directly, therefore bypassing the proxy and getting whatever the actual server has. Either way, I have my doubts this issue is actually an issue with the expansion and that it could be fixed. If it was fixable, it probs would've been by now. |
EDIT: I was debugging using a fresh build from the source code, not the eCloud JAR. See this comment for why it matters: #2 (comment) I think it is an issue with this expansion, I stepped through the code with a debugger and found that the expansion runs into an ArrayIndexOutOfBoundsException here: Pinger-Expansion/src/main/java/com/extendedclip/papi/expansion/pinger/PingerExpansion.java Line 308 in 34d9492
The exception is just swallowed here: Pinger-Expansion/src/main/java/com/extendedclip/papi/expansion/pinger/PingerExpansion.java Lines 63 to 64 in 34d9492
The ArrayIndexOutOfBoundsException was because of the fact that the Why was the delimiter ever |
In addition to splitting on I think the current code is trying to support two different ping formats. If the packet starts with I probably have time tomorrow to do some more testing to make sure everything really works now, and then I could submit a PR to fix this issue. |
Huh, okay, this issue is weirder than I originally thought. I've now done some more testing, and the problem is definitely that diff --git a/src/main/java/com/extendedclip/papi/expansion/pinger/PingerExpansion.java b/src/main/java/com/extendedclip/papi/expansion/pinger/PingerExpansion.java
index 9a13260..c15b926 100644
--- a/src/main/java/com/extendedclip/papi/expansion/pinger/PingerExpansion.java
+++ b/src/main/java/com/extendedclip/papi/expansion/pinger/PingerExpansion.java
@@ -294,7 +294,7 @@ public class PingerExpansion extends PlaceholderExpansion implements Cacheable,
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]));
@@ -303,7 +303,7 @@ public class PingerExpansion extends PlaceholderExpansion implements Cacheable,
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]));
That is to say, the old eCloud version actually correctly uses the But okay, if the eCloud version correctly uses the The bug was fixed in Spigot for Minecraft 1.13.2+ in this commit: https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/commits/a3c2ec03148f9f38d4d27d045b1afee2fc6ff173 So, what's the conclusion?
|
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
I have now provided a fix for the packet decoding in #8, as well as some code cleanup and comments to explain what the current code is doing. As far as fixing this issue goes (again, it only happens on Minecraft 1.8 - 1.12), the main solution I see is to change the code to use the Minecraft 1.7+ ping request format, which is not affected by the Spigot MOTD bug. I am not interested in working on this, especially since there is already an alternative plugin (based on, or at least inspired by Pinger, it seems), which uses the 1.7+ ping format to fix this issue: https://github.com/HappyAreaBean/ServerPinger-PAPI-Expansion. It uses this library to send the ping requests: https://github.com/lucaazalim/minecraft-server-ping. Or actually, I'm not sure, that library might be using Query: https://wiki.vg/Query, which should also work. On second thought, I don't think they're using Query, it looks like it's just the 1.7+ server ping list request. |
Hey
So, my problem is, that the
%pinger_motd%
doesn't update/just gets the server.properties' motd.Imagine, you want to have the motd be the motd set by a plugin, for example BedwarsRel, which sets it to something like
<status> <players>/<maxplayers>
e.g.ready 0/10
.Well, unfortunetely that doesn't work for some reason. (In my case it just returns
A Minecraft Server
)Please fix, thanks!
The text was updated successfully, but these errors were encountered: