From 4a85bf6754c101b43d2d0d3a6c9ed5744dd0308d Mon Sep 17 00:00:00 2001 From: HackOS <63157139+HackedOS@users.noreply.github.com> Date: Tue, 17 May 2022 23:06:47 +0530 Subject: Dont spam chat with config updates (#62) * Dont spam chat with config updates * Fix bcz im dumb * Show value of setting --- .../configuration/ConfigurationManager.java | 24 ++++++---------------- 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/src/main/java/de/torui/coflsky/configuration/ConfigurationManager.java b/src/main/java/de/torui/coflsky/configuration/ConfigurationManager.java index 7930210..38dd525 100644 --- a/src/main/java/de/torui/coflsky/configuration/ConfigurationManager.java +++ b/src/main/java/de/torui/coflsky/configuration/ConfigurationManager.java @@ -51,26 +51,26 @@ public class ConfigurationManager { case "int": if (f.getInt(old) != f.getInt(newConfiguration)) { - UpdatedProperty(f); + UpdatedProperty(f,newConfiguration); updatedProperties++; } break; case "boolean": if (f.getBoolean(old) != f.getBoolean(newConfiguration)) { - UpdatedProperty(f); + UpdatedProperty(f,newConfiguration); updatedProperties++; } break; case "java.lang.String": if (f.get(old) != null && !f.get(old).equals(f.get(newConfiguration))) { - UpdatedProperty(f); + UpdatedProperty(f,newConfiguration); updatedProperties++; } break; case "java.lang.String[]": if (!Arrays.deepEquals((String[]) f.get(old), (String[]) f.get(newConfiguration))) { - UpdatedProperty(f); + UpdatedProperty(f,newConfiguration); updatedProperties++; } break; @@ -100,20 +100,8 @@ public class ConfigurationManager { } - public void UpdatedProperty(Field propertyName) { - IChatComponent comp; - - comp = new ChatComponentText("The Configuration Setting ") - .setChatStyle(new ChatStyle().setColor(EnumChatFormatting.BLUE)) - .appendSibling(GetNameFormatted(propertyName)) - .appendSibling(new ChatComponentText(" has been updated") - .setChatStyle(new ChatStyle().setColor(EnumChatFormatting.BLUE))); - - - System.out.println("Field " + propertyName.getName() + " has no description!"); - - - Minecraft.getMinecraft().thePlayer.addChatMessage(comp); + public void UpdatedProperty(Field propertyName,Configuration confignew) throws IllegalAccessException { + System.out.println("The Configuration Setting " + propertyName.getName() + " has been updated to " + propertyName.get(confignew)); } } -- cgit