Skip to content

Commit

Permalink
Fix save / load of controller mappings to optionsvrprofiles.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
StellaArtois committed Feb 13, 2016
1 parent 6a63297 commit e747db6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions src/com/mtbs3d/minecrift/settings/profile/ProfileManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ private static synchronized boolean loadLegacySettings(File settingsFile, JSONOb
Map<String, String> settings = new HashMap<String, String>();
int count = 0;
while ((s = br.readLine()) != null) {
String[] array = s.split(":");
String[] array = splitKeyValue(s);
String setting = array[0];
String value = "";
if (array.length > 1) {
Expand All @@ -238,7 +238,7 @@ private static synchronized boolean loadLegacySettings(String settingStr, JSONOb
Map<String, String> settings = new HashMap<String, String>();
int count = 0;
while ((s = br.readLine()) != null) {
String[] array = s.split(":");
String[] array = splitKeyValue(s);
String setting = array[0];
String value = "";
if (array.length > 1) {
Expand Down Expand Up @@ -460,6 +460,11 @@ public static void loadControllerDefaults()
}
}

public static String[] splitKeyValue(String s) {
String[] array = s.split(":", 2);
return array;
}

// Minecraft XBox controller defaults - TODO: Find a better place for this
public static final String DEFAULT_BINDINGS =
"key.playerlist:b:3:Button 3\n" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public ProfileWriter(String set, JSONObject theProfile)

public void println(String s)
{
String[] array = s.split(":");
String[] array = ProfileManager.splitKeyValue(s);
String setting = array[0];
String value = "";
if (array.length > 1) {
Expand Down

0 comments on commit e747db6

Please sign in to comment.