diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/makamys/neodymium/Compat.java | 8 | ||||
-rw-r--r-- | src/main/java/makamys/neodymium/command/NeodymiumCommand.java | 10 |
2 files changed, 10 insertions, 8 deletions
diff --git a/src/main/java/makamys/neodymium/Compat.java b/src/main/java/makamys/neodymium/Compat.java index 47a3dfb..2d39d2f 100644 --- a/src/main/java/makamys/neodymium/Compat.java +++ b/src/main/java/makamys/neodymium/Compat.java @@ -40,7 +40,7 @@ public class Compat { public static void getCompatibilityWarnings(List<Warning> warns, List<Warning> criticalWarns, boolean statusCommand){ if(Minecraft.getMinecraft().gameSettings.advancedOpengl) { - warns.add(new Warning("Advanced OpenGL is enabled, performance may be poor." + (statusCommand ? " Click here to disable it." : "")).action(Compat::disableAdvancedOpenGL)); + warns.add(new Warning("Advanced OpenGL is enabled, performance may be poor." + (statusCommand ? " Click here to disable it." : "")).chatAction("neodymium disable_advanced_opengl")); } try { @@ -131,14 +131,14 @@ public class Compat { public static class Warning { public String text; - public Runnable action; + public String chatAction; public Warning(String text) { this.text = text; } - public Warning action(Runnable action) { - this.action = action; + public Warning chatAction(String command) { + this.chatAction = command; return this; } } diff --git a/src/main/java/makamys/neodymium/command/NeodymiumCommand.java b/src/main/java/makamys/neodymium/command/NeodymiumCommand.java index 3040ba9..dcab050 100644 --- a/src/main/java/makamys/neodymium/command/NeodymiumCommand.java +++ b/src/main/java/makamys/neodymium/command/NeodymiumCommand.java @@ -113,17 +113,19 @@ public class NeodymiumCommand extends CommandBase { List<Warning> warns = allWarns.getLeft(); List<Warning> criticalWarns = allWarns.getRight(); for(Warning line : warns) { - addColoredChatMessageWithAction(sender, "* " + line.text, HELP_WARNING_COLOR, line.action); + addColoredChatMessageWithAction(sender, "* " + line.text, HELP_WARNING_COLOR, line.chatAction); } for(Warning line : criticalWarns) { - addColoredChatMessageWithAction(sender, "* " + line.text, ERROR_COLOR, line.action); + addColoredChatMessageWithAction(sender, "* " + line.text, ERROR_COLOR, line.chatAction); } } - private void addColoredChatMessageWithAction(ICommandSender sender, String text, EnumChatFormatting color, Runnable action) { + private void addColoredChatMessageWithAction(ICommandSender sender, String text, EnumChatFormatting color, String command) { ChatComponentText msg = new ChatComponentText(text); msg.getChatStyle().setColor(color); - msg.getChatStyle().setChatClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "neodymium disable_advanced_opengl")); + if(command != null) { + msg.getChatStyle().setChatClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, command)); + } sender.addChatMessage(msg); } |