Search in sources :

Example 1 with ModuleButton

use of dev.hypnotic.ui.clickgui.ModuleButton in project Hypnotic-Client by Hypnotic-Development.

the class SaveLoad method load.

public void load() {
    ArrayList<String> lines = new ArrayList<String>();
    try {
        BufferedReader reader = new BufferedReader(new FileReader(this.dataFile));
        String line = reader.readLine();
        while (line != null) {
            lines.add(line);
            line = reader.readLine();
        }
        reader.close();
    } catch (Exception e) {
        e.printStackTrace();
    }
    for (String s : lines) {
        String[] args = s.split(":");
        if (s.toLowerCase().startsWith("mod:")) {
            Mod m = ModuleManager.INSTANCE.getModuleByName(args[1]);
            if (m != null) {
                m.setKey(Integer.parseInt(args[3]));
            }
        } else if (s.toLowerCase().startsWith("friend:")) {
            FriendManager.INSTANCE.add(new Friend(args[1]));
        } else if (s.toLowerCase().startsWith("frame:")) {
            for (Frame frame : ClickGUI.INSTANCE.frames) {
                if (frame.name.equalsIgnoreCase(args[1])) {
                    frame.setX(Integer.parseInt(args[2]));
                    frame.setY(Integer.parseInt(args[3]));
                    frame.setExtended(Boolean.parseBoolean(args[4]));
                }
            }
            HudEditorScreen.INSTANCE.frame.setX(Integer.parseInt(args[2]));
            HudEditorScreen.INSTANCE.frame.setY(Integer.parseInt(args[3]));
            HudEditorScreen.INSTANCE.frame.setExtended(Boolean.parseBoolean(args[4]));
        } else if (s.toLowerCase().startsWith("waypoint:")) {
            for (Waypoint waypoint : WaypointManager.INSTANCE.waypoints) {
                if (waypoint.getName().equalsIgnoreCase(args[1])) {
                    int x = Integer.parseInt(args[2]);
                    int y = Integer.parseInt(args[3]);
                    int z = Integer.parseInt(args[4]);
                    waypoint.setX(x);
                    waypoint.setY(y);
                    waypoint.setZ(z);
                    waypoint.setPos(new BlockPos(x, y, z));
                }
            }
        } else if (s.toLowerCase().startsWith("clickgui:")) {
            dev.hypnotic.ui.clickgui.ClickGUI.INSTANCE.x = Integer.parseInt(args[2]);
            dev.hypnotic.ui.clickgui.ClickGUI.INSTANCE.y = Integer.parseInt(args[4]);
        } else if (s.toLowerCase().startsWith("settingpos:")) {
            for (ModuleButton mb : dev.hypnotic.ui.clickgui.ClickGUI.INSTANCE.buttons) {
                if (mb.mod.name.equalsIgnoreCase(args[1])) {
                    mb.settingsWindow.x = Integer.parseInt(args[3]);
                    mb.settingsWindow.y = Integer.parseInt(args[5]);
                }
            }
        }
    /*else if (s.toLowerCase().startsWith("message:")) {
            	ModuleManager.INSTANCE.chatSpammer.custom.add(args[1]);
            }*/
    }
}
Also used : Frame(dev.hypnotic.ui.clickgui2.frame.Frame) Mod(dev.hypnotic.module.Mod) ArrayList(java.util.ArrayList) IOException(java.io.IOException) FileNotFoundException(java.io.FileNotFoundException) Friend(dev.hypnotic.config.friends.Friend) ModuleButton(dev.hypnotic.ui.clickgui.ModuleButton) BufferedReader(java.io.BufferedReader) FileReader(java.io.FileReader) Waypoint(dev.hypnotic.waypoint.Waypoint) BlockPos(net.minecraft.util.math.BlockPos)

Aggregations

Friend (dev.hypnotic.config.friends.Friend)1 Mod (dev.hypnotic.module.Mod)1 ModuleButton (dev.hypnotic.ui.clickgui.ModuleButton)1 Frame (dev.hypnotic.ui.clickgui2.frame.Frame)1 Waypoint (dev.hypnotic.waypoint.Waypoint)1 BufferedReader (java.io.BufferedReader)1 FileNotFoundException (java.io.FileNotFoundException)1 FileReader (java.io.FileReader)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 BlockPos (net.minecraft.util.math.BlockPos)1