Changed naming schem. Added message for Legacy Ping

This commit is contained in:
LOOHP 2020-08-09 23:27:04 +08:00
parent c711f8cea6
commit 620327d64d
3 changed files with 5 additions and 3 deletions

View File

@ -49,6 +49,7 @@
</configuration>
</plugin>
</plugins>
<finalName>${project.artifactId}-${project.version}-1.16.1</finalName>
</build>
<repositories>

View File

@ -78,7 +78,7 @@ public class Console implements CommandSender {
out.println(message);
}
public void run() {
protected void run() {
BufferedReader reader = new BufferedReader(new InputStreamReader(in));
while (true) {
try {

View File

@ -172,10 +172,11 @@ public class ClientConnection extends Thread {
if (handShakeSize == 0xFE) {
state = ClientState.LEGACY;
output.writeByte(255);
String str = client_socket.getInetAddress().getHostName() + ":" + client_socket.getPort();
Limbo.getInstance().getConsole().sendMessage("[/" + str + "] <-> Legacy Status has pinged");
ServerProperties p = Limbo.getInstance().getServerProperties();
StatusPingEvent event = (StatusPingEvent) Limbo.getInstance().getEventsManager().callEvent(new StatusPingEvent(this, p.getVersionString(), p.getProtocol(), ComponentSerializer.parse(p.getMotdJson()), p.getMaxPlayers(), Limbo.getInstance().getPlayers().size(), p.getFavicon().orElse(null)));
String response = Limbo.getInstance().buildLegacyPingResponse(event.getVersion(), event.getMotd(), event.getMaxPlayers(), event.getPlayersOnline());
System.out.println(response);
byte[] bytes = response.getBytes(StandardCharsets.UTF_16BE);
output.writeShort(response.length());
output.write(bytes);