49 lines
1.8 KiB
Java
49 lines
1.8 KiB
Java
package keystrokesmod.utility.profile;
|
|
|
|
import keystrokesmod.Raven;
|
|
import keystrokesmod.module.Module;
|
|
import keystrokesmod.module.setting.impl.ButtonSetting;
|
|
import keystrokesmod.utility.ScaffoldBlockCount;
|
|
import keystrokesmod.utility.Utils;
|
|
|
|
import java.awt.*;
|
|
import java.io.IOException;
|
|
|
|
public class Manager extends Module {
|
|
private ButtonSetting loadProfiles, openFolder, createProfile;
|
|
|
|
public Manager() {
|
|
super("Manager", category.profiles);
|
|
this.registerSetting(createProfile = new ButtonSetting("Create profile", () -> {
|
|
if (Utils.nullCheck() && Raven.profileManager != null) {
|
|
String name = "profile-";
|
|
for (int i = 1; i <= 100; i++) {
|
|
if (Raven.profileManager.getProfile(name + i) != null) {
|
|
continue;
|
|
}
|
|
name += i;
|
|
Raven.profileManager.saveProfile(new Profile(name, 0));
|
|
Utils.sendMessage("&7Created profile: &b" + name);
|
|
Raven.profileManager.loadProfiles();
|
|
break;
|
|
}
|
|
}
|
|
}));
|
|
this.registerSetting(loadProfiles = new ButtonSetting("Load profiles", () -> {
|
|
if (Utils.nullCheck() && Raven.profileManager != null) {
|
|
Raven.profileManager.loadProfiles();
|
|
}
|
|
}));
|
|
this.registerSetting(openFolder = new ButtonSetting("Open folder", () -> {
|
|
try {
|
|
Desktop.getDesktop().open(Raven.profileManager.directory);
|
|
}
|
|
catch (IOException ex) {
|
|
Raven.profileManager.directory.mkdirs();
|
|
Utils.sendMessage("&cError locating folder, recreated.");
|
|
}
|
|
}));
|
|
ignoreOnSave = true;
|
|
canBeEnabled = false;
|
|
}
|
|
} |