summaryrefslogtreecommitdiff
path: root/src/main/java/cuchaz/enigma/Main.java
diff options
context:
space:
mode:
authorGravatar Joseph Burton2020-05-03 21:06:38 +0100
committerGravatar GitHub2020-05-03 21:06:38 +0100
commit854f4d49407e45d67dd5754afd21a7e59970ca5b (patch)
tree582e3245786f9723b5895b0c8d41087b0e6bb416 /src/main/java/cuchaz/enigma/Main.java
parentRewrite search dialog (#233) (diff)
downloadenigma-fork-854f4d49407e45d67dd5754afd21a7e59970ca5b.tar.gz
enigma-fork-854f4d49407e45d67dd5754afd21a7e59970ca5b.tar.xz
enigma-fork-854f4d49407e45d67dd5754afd21a7e59970ca5b.zip
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 <doublecraft.official@gmail.com> Co-authored-by: 2xsaiko <git@dblsaiko.net>
Diffstat (limited to 'src/main/java/cuchaz/enigma/Main.java')
-rw-r--r--src/main/java/cuchaz/enigma/Main.java22
1 files changed, 3 insertions, 19 deletions
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;
17 17
18import joptsimple.*; 18import joptsimple.*;
19 19
20import java.io.BufferedReader;
21import java.io.IOException; 20import java.io.IOException;
22import java.io.InputStreamReader;
23import java.nio.charset.StandardCharsets;
24import java.nio.file.Files; 21import java.nio.file.Files;
25import java.nio.file.Path; 22import java.nio.file.Path;
26import java.nio.file.Paths; 23import java.nio.file.Paths;
@@ -54,20 +51,7 @@ public class Main {
54 return; 51 return;
55 } 52 }
56 53
57 EnigmaProfile parsedProfile; 54 EnigmaProfile parsedProfile = EnigmaProfile.read(options.valueOf(profile));
58 if (options.has(profile)) {
59 Path profilePath = options.valueOf(profile);
60 try (BufferedReader reader = Files.newBufferedReader(profilePath)) {
61 parsedProfile = EnigmaProfile.parse(reader);
62 }
63 } else {
64 try (BufferedReader reader = new BufferedReader(new InputStreamReader(Main.class.getResourceAsStream("/profile.json"), StandardCharsets.UTF_8))){
65 parsedProfile = EnigmaProfile.parse(reader);
66 } catch (IOException ex) {
67 System.out.println("Failed to load default profile, will use empty profile: " + ex.getMessage());
68 parsedProfile = EnigmaProfile.EMPTY;
69 }
70 }
71 55
72 Gui gui = new Gui(parsedProfile); 56 Gui gui = new Gui(parsedProfile);
73 GuiController controller = gui.getController(); 57 GuiController controller = gui.getController();
@@ -95,8 +79,8 @@ public class Main {
95 } 79 }
96 } 80 }
97 81
98 private static class PathConverter implements ValueConverter<Path> { 82 public static class PathConverter implements ValueConverter<Path> {
99 static final ValueConverter<Path> INSTANCE = new PathConverter(); 83 public static final ValueConverter<Path> INSTANCE = new PathConverter();
100 84
101 PathConverter() { 85 PathConverter() {
102 } 86 }