From 71fefda5975674372d5fa603752cd1f26a9a1044 Mon Sep 17 00:00:00 2001 From: Marc Baloup Date: Sat, 1 Jun 2019 20:58:54 +0200 Subject: [PATCH] Add 1.14.1 and 1.14.2 + cleaner error messages for network API --- .../java/fr/pandacube/java/util/MinecraftVersion.java | 11 ++++++++++- .../java/util/network_api/server/PacketExecutor.java | 11 ++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/main/java/fr/pandacube/java/util/MinecraftVersion.java b/src/main/java/fr/pandacube/java/util/MinecraftVersion.java index fa12a55..419b0d1 100644 --- a/src/main/java/fr/pandacube/java/util/MinecraftVersion.java +++ b/src/main/java/fr/pandacube/java/util/MinecraftVersion.java @@ -27,7 +27,9 @@ public enum MinecraftVersion { v1_13(393, "1.13"), v1_13_1(401, "1.13.1"), v1_13_2(404, "1.13.2"), - v1_14(477, "1.14"); + v1_14(477, "1.14"), + v1_14_1(480, "1.14.1"), + v1_14_2(485, "1.14.2"); // IMPORTANT: don't forget to update the versionMergeDisplay value when adding a new version; private static Map, List> versionMergeDisplay; @@ -67,6 +69,13 @@ public enum MinecraftVersion { ImmutableList.of("1.13", "1.13.1")); versionMergeDisplay.put(EnumSet.of(v1_13_1, v1_13_2), ImmutableList.of("1.13.1", "1.13.2")); + + versionMergeDisplay.put(EnumSet.of(v1_14, v1_14_1, v1_14_2), + ImmutableList.of("1.14.x")); + versionMergeDisplay.put(EnumSet.of(v1_14, v1_14_1), + ImmutableList.of("1.14", "1.14.1")); + versionMergeDisplay.put(EnumSet.of(v1_14_1, v1_14_2), + ImmutableList.of("1.14.1", "1.14.2")); } diff --git a/src/main/java/fr/pandacube/java/util/network_api/server/PacketExecutor.java b/src/main/java/fr/pandacube/java/util/network_api/server/PacketExecutor.java index 0d9bf01..f75bcd4 100644 --- a/src/main/java/fr/pandacube/java/util/network_api/server/PacketExecutor.java +++ b/src/main/java/fr/pandacube/java/util/network_api/server/PacketExecutor.java @@ -5,6 +5,7 @@ import java.io.PrintStream; import java.net.Socket; import fr.pandacube.java.util.Log; +import fr.pandacube.java.util.network_api.server.RequestAnalyser.BadRequestException; /** * Prends en charge un socket client et le transmet au gestionnaire de paquet @@ -43,7 +44,15 @@ public class PacketExecutor implements Runnable { rep.sendPacket(new PrintStream(socket.getOutputStream())); } catch (IOException e1) {} if (e instanceof IOException) - Log.warning("Impossible de lire le packet reçu sur le socket " + socket + " : " + e.toString()); + Log.warning("Unable to read packet from socket " + socket + ": " + e.toString()); + else if(e instanceof BadRequestException) { + if (e.getMessage().equals("wrong_password")) + Log.warning("Wrong password received from socket " + socket); + else if (e.getMessage().equals("command_not_exists")) + Log.severe("The command requested from the socket " + socket + " does not exist"); + else + Log.severe(e); + } else Log.severe(e); }