Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void readInKeybinds() {
- try {
- File file = new File(Loader.instance().getConfigDir(), "powersuits-keybinds.cfg");
- if (!file.exists()) {
- MuseLogger.logError("No powersuits keybind file found.");
- return;
- }
- BufferedReader reader = new BufferedReader(new FileReader(file));
- ClickableKeybinding workingKeybinding[] = new ClickableKeybinding[100];
- int i = 0;
- while (reader.ready()) {
- String line = reader.readLine();
- if (line.contains(":")) {
- int j = 0;
- String[] exploded = line.split(":");
- int id = Integer.parseInt(exploded[0]);
- boolean replicate = false;
- MusePoint2D position = new MusePoint2D(Double.parseDouble(exploded[1]), Double.parseDouble(exploded[2]));
- for (ClickableKeybinding keybinding : getInstance().keybindings) {
- if (keybinding.getKeyBinding().keyCode==id) {
- replicate = true;
- }
- }
- while (j<=i) {
- if (workingKeybinding[j] != null) {
- if (workingKeybinding[j].getKeyBinding().keyCode == id) {
- replicate = true;
- }
- }
- j++;
- }
- if (!replicate) {
- boolean free = !KeyBinding.hash.containsItem(id);
- workingKeybinding[i] = new ClickableKeybinding(new KeyBinding(Keyboard.getKeyName(id), id), position, free);
- getInstance().keybindings.add(workingKeybinding[i]);
- } else {
- workingKeybinding[i] = null;
- }
- i++;
- } else if (line.contains("~") && workingKeybinding[i] != 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[i].bindModule(cmodule);
- }
- }
- }
- reader.close();
- } catch (Exception e) {
- MuseLogger.logError("Problem reading in keyconfig :(");
- e.printStackTrace();
- }
- }
- public static void readInKeybinds() {
- try {
- File file = new File(Loader.instance().getConfigDir(), "powersuits-keybinds.cfg");
- 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), 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();
- } catch (Exception e) {
- MuseLogger.logError("Problem reading in keyconfig :(");
- e.printStackTrace();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement