From 7ed302d086bb7ec229f39dcbcb3c3370253404b4 Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Mon, 6 Jul 2020 22:32:58 -0400 Subject: Add API key and config Added /setkey [key] and /getkey commands. Created config to store API key and toggled features. --- me/Danker/ToggleCommand.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'me/Danker/ToggleCommand.java') diff --git a/me/Danker/ToggleCommand.java b/me/Danker/ToggleCommand.java index d24c399..8c27da6 100644 --- a/me/Danker/ToggleCommand.java +++ b/me/Danker/ToggleCommand.java @@ -8,8 +8,8 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.ChatComponentText; public class ToggleCommand extends CommandBase implements ICommand { - private static boolean gpartyToggled = true; - private static boolean coordsToggled = true; + public static boolean gpartyToggled; + public static boolean coordsToggled; public boolean getToggle(String type) { if (type.equals("gparty")) { @@ -38,6 +38,7 @@ public class ToggleCommand extends CommandBase implements ICommand { @Override public void processCommand(ICommandSender arg0, String[] arg1) throws CommandException { final EntityPlayer player = (EntityPlayer)arg0; + final ConfigHandler cf = new ConfigHandler(); if (arg1.length == 0) { player.addChatMessage(new ChatComponentText("Usage: /toggle [gparty/coords]")); @@ -46,10 +47,17 @@ public class ToggleCommand extends CommandBase implements ICommand { if (arg1[0].equalsIgnoreCase("gparty")) { gpartyToggled = !gpartyToggled; + cf.writeBooleanConfig("toggles", "GParty", gpartyToggled); player.addChatMessage(new ChatComponentText("Guild party notifications has been set to " + gpartyToggled + ".")); } else if (arg1[0].equalsIgnoreCase("coords")) { coordsToggled = !coordsToggled; + cf.writeBooleanConfig("toggles", "Coords", coordsToggled); player.addChatMessage(new ChatComponentText("Coord/Angle display has been set to " + coordsToggled + ".")); + } else if (arg1[0].equalsIgnoreCase("list")) { + player.addChatMessage(new ChatComponentText("Guild party notifications: " + gpartyToggled)); + player.addChatMessage(new ChatComponentText("Coord/Angle display: " + coordsToggled)); + } else { + player.addChatMessage(new ChatComponentText("Unknown value.")); } } } -- cgit