if (!file.exists()) {
MuseLogger.logError("No powersuits keybind file found.");
return;
}
BufferedReader reader = new BufferedReader(new FileReader(file));
ClickableKeybinding workingKeybinding = null;
while (reader.ready()) {
String line = reader.readLine();
if (line.contains(":")) {
String[] exploded = line.split(":");
int id = Integer.parseInt(exploded[0]);
if (!KeyBinding.hash.containsItem(id)) {
MusePoint2D position = new MusePoint2D(Double.parseDouble(exploded[1]), Double.parseDouble(exploded[2]));
boolean free = !KeyBinding.hash.containsItem(id);
workingKeybinding = new ClickableKeybinding(new KeyBinding(Keyboard.getKeyName(id), id, KeybindKeyHandler.mps), position, free);
getInstance().keybindings.add(workingKeybinding);
} else {
workingKeybinding = null;
}
} else if (line.contains("~") && workingKeybinding != null) {
String[] exploded = line.split("~");
MusePoint2D position = new MusePoint2D(Double.parseDouble(exploded[1]), Double.parseDouble(exploded[2]));
IPowerModule module = ModuleManager.getModule(exploded[0]);
if (module != null) {
ClickableModule cmodule = new ClickableModule(module, position);
workingKeybinding.bindModule(cmodule);
}
}
}
reader.close();