refactor: replaced deprecated calls

This commit is contained in:
cattyn
2025-11-07 21:02:29 +03:00
parent 63c06f0005
commit b92a51eb1c
@@ -20,11 +20,11 @@ public class ModuleCommand
if (commands.length == 1) { if (commands.length == 1) {
ModuleCommand.sendMessage("Modules: "); ModuleCommand.sendMessage("Modules: ");
for (Module.Category category : OyVey.moduleManager.getCategories()) { for (Module.Category category : OyVey.moduleManager.getCategories()) {
String modules = category.getName() + ": "; StringBuilder modules = new StringBuilder(category.getName() + ": ");
for (Module module1 : OyVey.moduleManager.getModulesByCategory(category)) { for (Module module : OyVey.moduleManager.getModulesByCategory(category)) {
modules = modules + (module1.isEnabled() ? Formatting.GREEN : Formatting.RED) + module1.getName() + Formatting.WHITE + ", "; modules.append(module.isEnabled() ? Formatting.GREEN : Formatting.RED).append(module.getName()).append(Formatting.WHITE).append(", ");
} }
ModuleCommand.sendMessage(modules); ModuleCommand.sendMessage(modules.toString());
} }
return; return;
} }
@@ -62,7 +62,6 @@ public class ModuleCommand
return; return;
} }
if (commands.length == 5 && (setting = module.getSettingByName(commands[2])) != null) { if (commands.length == 5 && (setting = module.getSettingByName(commands[2])) != null) {
JsonParser jp = new JsonParser();
if (setting.getType().equalsIgnoreCase("String")) { if (setting.getType().equalsIgnoreCase("String")) {
setting.setValue(commands[3]); setting.setValue(commands[3]);
ModuleCommand.sendMessage("{dark_gray} %s %s has been set to %s.", module.getName(), setting.getName(), commands[3]); ModuleCommand.sendMessage("{dark_gray} %s %s has been set to %s.", module.getName(), setting.getName(), commands[3]);
@@ -77,7 +76,7 @@ public class ModuleCommand
module.disable(); module.disable();
} }
} }
ConfigManager.setValueFromJson(module, setting, jp.parse(commands[3])); ConfigManager.setValueFromJson(module, setting, JsonParser.parseString(commands[3]));
} catch (Exception e) { } catch (Exception e) {
ModuleCommand.sendMessage("Bad Value! This setting requires a: %s value.", setting.getType()); ModuleCommand.sendMessage("Bad Value! This setting requires a: %s value.", setting.getType());
return; return;