aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/Danker/commands/GetkeyCommand.java
diff options
context:
space:
mode:
authorbowser0000 <bowser0000@gmail.com>2020-08-18 18:56:57 -0400
committerbowser0000 <bowser0000@gmail.com>2020-08-18 18:56:57 -0400
commit4bba146e8d7602ceda5bda4083bb1d1abe3198f1 (patch)
tree776125ec7af91f9e85ca67d207fe8b57fda20c4d /src/main/java/me/Danker/commands/GetkeyCommand.java
parent67cb5cc2b84743a936aeb8aa3b9e875b2e24a5ea (diff)
parent57af29e64bac4bc7fc8ccf8e3af69c4e1d89b448 (diff)
downloadSkyblockMod-4bba146e8d7602ceda5bda4083bb1d1abe3198f1.tar.gz
SkyblockMod-4bba146e8d7602ceda5bda4083bb1d1abe3198f1.tar.bz2
SkyblockMod-4bba146e8d7602ceda5bda4083bb1d1abe3198f1.zip
Merge branch 'development' of https://github.com/bowser0000/SkyblockMod into development
Diffstat (limited to 'src/main/java/me/Danker/commands/GetkeyCommand.java')
-rw-r--r--src/main/java/me/Danker/commands/GetkeyCommand.java29
1 files changed, 21 insertions, 8 deletions
diff --git a/src/main/java/me/Danker/commands/GetkeyCommand.java b/src/main/java/me/Danker/commands/GetkeyCommand.java
index 80354fe..d32a56e 100644
--- a/src/main/java/me/Danker/commands/GetkeyCommand.java
+++ b/src/main/java/me/Danker/commands/GetkeyCommand.java
@@ -1,5 +1,9 @@
package me.Danker.commands;
+import java.awt.Toolkit;
+import java.awt.datatransfer.Clipboard;
+import java.awt.datatransfer.StringSelection;
+
import me.Danker.handlers.ConfigHandler;
import net.minecraft.command.CommandBase;
import net.minecraft.command.CommandException;
@@ -28,14 +32,23 @@ public class GetkeyCommand 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 (cf.getString("api", "APIKey").equals("")) {
- player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "API key not set. Set your API key using /setkey."));
- } else {
- player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Your set API key is " + EnumChatFormatting.DARK_GREEN + cf.getString("api", "APIKey")));
- }
+ EntityPlayer player = (EntityPlayer)arg0;
+ ConfigHandler cf = new ConfigHandler();
+ Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
+ StringSelection stringSelection = new StringSelection(cf.getString("api", "APIKey"));
+
+ if (cf.getString("api", "APIKey").equals("")) {
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "API key not set. Set your API key using /setkey."));
+ }
+ else if (arg1.length == 0) {
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Your set API key is " + EnumChatFormatting.DARK_GREEN + cf.getString("api", "APIKey")));
+ } else if (arg1[0].equalsIgnoreCase("clipboard")){
+ clipboard.setContents(stringSelection, null);
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Your set API key has been copied to the clipboard."));
+ } else {
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Wrong command usage: /getkey (clipboard)"));
+ }
+
}
}