From 854f4d49407e45d67dd5754afd21a7e59970ca5b Mon Sep 17 00:00:00 2001 From: Joseph Burton Date: Sun, 3 May 2020 21:06:38 +0100 Subject: Multiplayer support (#221) * First pass on multiplayer * Apply review suggestions * Dedicated Enigma server * Don't jump to references when other users do stuff * Better UI + translations * french translation * Apply review suggestions * Document the protocol * Fix most issues with scrolling. * Apply review suggestions * Fix zip hash issues + add a bit more logging * Optimize zip hash * Fix a couple of login bugs * Add message log and user list * Make Message an abstract class * Make status bar work, add chat box * Hide message log/users list when not connected * Fix status bar not resetting entirely * Run stop server task on server thread to prevent multithreading race conditions * Add c2s message to packet id list * Fix message scroll bar not scrolling to the end * Formatting * User list size -> ushort * Combine contains and remove check * Check removal before sending packet * Add password to login packet * Fix the GUI closing the rename text field when someone else renames something * Update fr_fr.json * oups * Make connection/server create dialogs not useless if it fails once * Refactor UI state updating * Fix imports * Fix Collab menu * Fix NPE when rename not allowed * Make the log file a configurable option * Don't use modified UTF * Update fr_fr.json * Bump version to 0.15.4 * Apparently I can't spell neither words nor semantic versions Co-authored-by: Yanis48 Co-authored-by: 2xsaiko --- src/main/java/cuchaz/enigma/Main.java | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) (limited to 'src/main/java/cuchaz/enigma/Main.java') diff --git a/src/main/java/cuchaz/enigma/Main.java b/src/main/java/cuchaz/enigma/Main.java index 1d63ec1..7c87669 100644 --- a/src/main/java/cuchaz/enigma/Main.java +++ b/src/main/java/cuchaz/enigma/Main.java @@ -17,10 +17,7 @@ import cuchaz.enigma.translation.mapping.serde.MappingFormat; import joptsimple.*; -import java.io.BufferedReader; import java.io.IOException; -import java.io.InputStreamReader; -import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; @@ -54,20 +51,7 @@ public class Main { return; } - EnigmaProfile parsedProfile; - if (options.has(profile)) { - Path profilePath = options.valueOf(profile); - try (BufferedReader reader = Files.newBufferedReader(profilePath)) { - parsedProfile = EnigmaProfile.parse(reader); - } - } else { - try (BufferedReader reader = new BufferedReader(new InputStreamReader(Main.class.getResourceAsStream("/profile.json"), StandardCharsets.UTF_8))){ - parsedProfile = EnigmaProfile.parse(reader); - } catch (IOException ex) { - System.out.println("Failed to load default profile, will use empty profile: " + ex.getMessage()); - parsedProfile = EnigmaProfile.EMPTY; - } - } + EnigmaProfile parsedProfile = EnigmaProfile.read(options.valueOf(profile)); Gui gui = new Gui(parsedProfile); GuiController controller = gui.getController(); @@ -95,8 +79,8 @@ public class Main { } } - private static class PathConverter implements ValueConverter { - static final ValueConverter INSTANCE = new PathConverter(); + public static class PathConverter implements ValueConverter { + public static final ValueConverter INSTANCE = new PathConverter(); PathConverter() { } -- cgit v1.2.3