diff --git a/pom.xml b/pom.xml index e4be042..57901bf 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ net.rubeta LegacyPing - 2.0 + 2.1 jar LegacyPing diff --git a/src/main/java/net/rubeta/legacyping/LegacyPing.java b/src/main/java/net/rubeta/legacyping/LegacyPing.java index 050d286..fc15d1d 100644 --- a/src/main/java/net/rubeta/legacyping/LegacyPing.java +++ b/src/main/java/net/rubeta/legacyping/LegacyPing.java @@ -26,7 +26,7 @@ public final class LegacyPing extends JavaPlugin { final String host = config.getString("host", "0.0.0.0"); final List ports = config.getIntegerList("port"); final String version = config.getString("displayedVersion", "b1.7.3"); - final int protocol = config.getInt("displayedProtocol", 17); + final int protocol = config.getInt("displayedProtocol", 14); for (int port : ports) { try { this.threads.add(new ServerThread(this, host, port, version, protocol)); diff --git a/src/main/java/net/rubeta/legacyping/ServerThread.java b/src/main/java/net/rubeta/legacyping/ServerThread.java index cfeea8f..ef59f93 100644 --- a/src/main/java/net/rubeta/legacyping/ServerThread.java +++ b/src/main/java/net/rubeta/legacyping/ServerThread.java @@ -17,9 +17,10 @@ public class ServerThread extends Thread { "{\"version\": {\"name\": \"%version%\",\"protocol\": %protocol%}," + "\"players\": {\"max\": %max%,\"online\": %now%}," + "\"description\": {\"text\": \"%motd%\"}," + - "\"enforcesSecureChat\": false,\"previewsChat\": true}"; + "\"enforcesSecureChat\": false,\"previewsChat\": false}"; private static final String DISCONNECT_REASON = "[\"\",{\"text\":\"This is b1.7.3 server. Visit \"}," + "{\"text\":\"https://rubeta.net\",\"underlined\":true},{\"text\":\" for more information.\"}]"; + private static final String SLOWSTACK_ID = "slowstack.tv"; private final AtomicBoolean working = new AtomicBoolean(false); private final Server minecraftServer; private final String version; @@ -85,10 +86,15 @@ public class ServerThread extends Thread { final int port = inputStream.readShort(); final int status = this.readVarInt(inputStream); this.logger.info("Ping from " + socket.getRemoteSocketAddress() + " to " + hostname + ":" + port); -// System.out.println(packetLength + "; Protocol version: " + protocolVersion + ", host: " + hostname -// + ", port: " + port + ", status: " + status); + boolean slowstack = hostname.equalsIgnoreCase(SLOWSTACK_ID); if (status != 2) { - this.responseForModernPing(outputStream, MODERN_RESPONSE); + if (slowstack) { + this.responseForModernPing(outputStream, MODERN_RESPONSE.replace( + "%motd%", "%motd% \nHello, slowstack.tv!" + )); + } else { + this.responseForModernPing(outputStream, MODERN_RESPONSE); + } } else { this.responseForModernPing(outputStream, DISCONNECT_REASON); socket.close();