diff options
author | bowser0000 <bowser0000@gmail.com> | 2020-07-06 22:32:58 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-06 22:32:58 -0400 |
commit | 7ed302d086bb7ec229f39dcbcb3c3370253404b4 (patch) | |
tree | 120c662e201c275fb5de5b970a455091e0400d2d /me/Danker/SetkeyCommand.java | |
parent | c1d2bca1cf22e2ff048ac6f0eb33b585dc3807d9 (diff) | |
download | SkyblockMod-7ed302d086bb7ec229f39dcbcb3c3370253404b4.tar.gz SkyblockMod-7ed302d086bb7ec229f39dcbcb3c3370253404b4.tar.bz2 SkyblockMod-7ed302d086bb7ec229f39dcbcb3c3370253404b4.zip |
Add API key and config
Added /setkey [key] and /getkey commands. Created config to store API key and toggled features.
Diffstat (limited to 'me/Danker/SetkeyCommand.java')
-rw-r--r-- | me/Danker/SetkeyCommand.java | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/me/Danker/SetkeyCommand.java b/me/Danker/SetkeyCommand.java new file mode 100644 index 0000000..6490611 --- /dev/null +++ b/me/Danker/SetkeyCommand.java @@ -0,0 +1,41 @@ +package me.Danker;
+
+import net.minecraft.command.CommandBase;
+import net.minecraft.command.CommandException;
+import net.minecraft.command.ICommand;
+import net.minecraft.command.ICommandSender;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.util.ChatComponentText;
+
+public class SetkeyCommand extends CommandBase implements ICommand {
+
+ @Override
+ public String getCommandName() {
+ return "setkey";
+ }
+
+ @Override
+ public String getCommandUsage(ICommandSender arg0) {
+ return getCommandName() + " [key]";
+ }
+
+ @Override
+ public int getRequiredPermissionLevel() {
+ return 0;
+ }
+
+ @Override
+ public void processCommand(ICommandSender arg0, String[] arg1) throws CommandException {
+ final EntityPlayer player = (EntityPlayer)arg0;
+
+ if (arg1.length == 0) {
+ player.addChatMessage(new ChatComponentText("Usage: /setkey [key]"));
+ return;
+ }
+
+ final ConfigHandler cf = new ConfigHandler();
+ cf.writeStringConfig("api", "APIKey", arg1[0]);
+ player.addChatMessage(new ChatComponentText("Set API key to " + arg1[0]));
+ }
+
+}
|