Add 1.14.1 and 1.14.2 + cleaner error messages for network API

This commit is contained in:
Marc Baloup 2019-06-01 20:58:54 +02:00
parent 8a56e6a50e
commit 71fefda597
2 changed files with 20 additions and 2 deletions

View File

@ -27,7 +27,9 @@ public enum MinecraftVersion {
v1_13(393, "1.13"), v1_13(393, "1.13"),
v1_13_1(401, "1.13.1"), v1_13_1(401, "1.13.1"),
v1_13_2(404, "1.13.2"), 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; // IMPORTANT: don't forget to update the versionMergeDisplay value when adding a new version;
private static Map<EnumSet<MinecraftVersion>, List<String>> versionMergeDisplay; private static Map<EnumSet<MinecraftVersion>, List<String>> versionMergeDisplay;
@ -68,6 +70,13 @@ public enum MinecraftVersion {
versionMergeDisplay.put(EnumSet.of(v1_13_1, v1_13_2), versionMergeDisplay.put(EnumSet.of(v1_13_1, v1_13_2),
ImmutableList.of("1.13.1", "1.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"));
} }

View File

@ -5,6 +5,7 @@ import java.io.PrintStream;
import java.net.Socket; import java.net.Socket;
import fr.pandacube.java.util.Log; 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 * 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())); rep.sendPacket(new PrintStream(socket.getOutputStream()));
} catch (IOException e1) {} } catch (IOException e1) {}
if (e instanceof IOException) 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 else
Log.severe(e); Log.severe(e);
} }