aboutsummaryrefslogtreecommitdiff
path: root/me/Danker/GetkeyCommand.java
diff options
context:
space:
mode:
authorbowser0000 <bowser0000@gmail.com>2020-07-06 22:32:58 -0400
committerGitHub <noreply@github.com>2020-07-06 22:32:58 -0400
commit7ed302d086bb7ec229f39dcbcb3c3370253404b4 (patch)
tree120c662e201c275fb5de5b970a455091e0400d2d /me/Danker/GetkeyCommand.java
parentc1d2bca1cf22e2ff048ac6f0eb33b585dc3807d9 (diff)
downloadSkyblockMod-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/GetkeyCommand.java')
-rw-r--r--me/Danker/GetkeyCommand.java39
1 files changed, 39 insertions, 0 deletions
diff --git a/me/Danker/GetkeyCommand.java b/me/Danker/GetkeyCommand.java
new file mode 100644
index 0000000..60c5eb8
--- /dev/null
+++ b/me/Danker/GetkeyCommand.java
@@ -0,0 +1,39 @@
+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 GetkeyCommand extends CommandBase implements ICommand {
+
+ @Override
+ public String getCommandName() {
+ return "getkey";
+ }
+
+ @Override
+ public String getCommandUsage(ICommandSender arg0) {
+ return getCommandName();
+ }
+
+ @Override
+ public int getRequiredPermissionLevel() {
+ return 0;
+ }
+
+ @Override
+ public void processCommand(ICommandSender arg0, String[] arg1) throws CommandException {
+ final EntityPlayer player = (EntityPlayer)arg0;
+ final ConfigHandler cf = new ConfigHandler();
+
+ if (cf.getString("api", "APIKey").equals("")) {
+ player.addChatMessage(new ChatComponentText("API key not set. Get a new one by doing /api new."));
+ } else {
+ player.addChatMessage(new ChatComponentText("Your set API key is " + cf.getString("api", "APIKey")));
+ }
+ }
+
+}