use of dev.hypnotic.settings.settingtypes.KeybindSetting in project Hypnotic-Client by Hypnotic-Development.
the class Config method serialize.
public String serialize() {
Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().setPrettyPrinting().create();
for (Mod module : ModuleManager.INSTANCE.getAllModules()) {
List<ConfigSetting> settings = new ArrayList<>();
for (Setting setting : module.settings) {
if (setting instanceof KeybindSetting)
continue;
ConfigSetting cfgSetting = new ConfigSetting(null, null);
cfgSetting.name = setting.name;
if (setting instanceof BooleanSetting) {
cfgSetting.value = ((BooleanSetting) setting).isEnabled();
}
if (setting instanceof ModeSetting) {
cfgSetting.value = ((ModeSetting) setting).getSelected();
}
if (setting instanceof NumberSetting) {
cfgSetting.value = ((NumberSetting) setting).getValue();
}
if (setting instanceof ColorSetting) {
cfgSetting.value = ((ColorSetting) setting).getHex();
}
settings.add(cfgSetting);
}
module.cfgSettings = settings.toArray(new ConfigSetting[0]);
}
return gson.toJson(ModuleManager.INSTANCE.getAllModules());
}
use of dev.hypnotic.settings.settingtypes.KeybindSetting in project Hypnotic-Client by Hypnotic-Development.
the class ConfigManager method serialize.
public String serialize() {
Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().setPrettyPrinting().create();
for (Mod module : ModuleManager.INSTANCE.getAllModules()) {
List<ConfigSetting> settings = new ArrayList<>();
for (Setting setting : module.settings) {
if (setting instanceof KeybindSetting)
continue;
ConfigSetting cfgSetting = new ConfigSetting(null, null);
cfgSetting.name = setting.name;
if (setting instanceof BooleanSetting) {
cfgSetting.value = ((BooleanSetting) setting).isEnabled();
}
if (setting instanceof ModeSetting) {
cfgSetting.value = ((ModeSetting) setting).getSelected();
}
if (setting instanceof NumberSetting) {
cfgSetting.value = ((NumberSetting) setting).getValue();
}
if (setting instanceof ColorSetting) {
ColorSetting colorSet = (ColorSetting) setting;
cfgSetting.value = colorSet.getHex();
}
settings.add(cfgSetting);
}
module.cfgSettings = settings.toArray(new ConfigSetting[0]);
}
return gson.toJson(ModuleManager.INSTANCE.getAllModules());
}
Aggregations