diff options
author | bowser0000 <bowser0000@gmail.com> | 2020-09-05 18:35:43 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-05 18:35:43 -0400 |
commit | 20b405f59dcd92df1b4c3cd5b9ac353652ef4405 (patch) | |
tree | f387a1ca10387c77381a22568b486984da5b38a6 /src/main/java/me/Danker/commands/GetkeyCommand.java | |
parent | 3ed5e14d43c6f3ff3cdce7598d01254e9465c33d (diff) | |
parent | a29cfb42db5da544f8445f56acb3742e396d8dee (diff) | |
download | SkyblockMod-20b405f59dcd92df1b4c3cd5b9ac353652ef4405.tar.gz SkyblockMod-20b405f59dcd92df1b4c3cd5b9ac353652ef4405.tar.bz2 SkyblockMod-20b405f59dcd92df1b4c3cd5b9ac353652ef4405.zip |
v1.7v1.7
Merge pull request #13 from bowser0000/development
Diffstat (limited to 'src/main/java/me/Danker/commands/GetkeyCommand.java')
-rw-r--r-- | src/main/java/me/Danker/commands/GetkeyCommand.java | 25 |
1 files changed, 17 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..f06e66f 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,19 @@ 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.")); + } + + clipboard.setContents(stringSelection, null); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Your set API key is " + EnumChatFormatting.DARK_GREEN + cf.getString("api", "APIKey") + "\n" + + EnumChatFormatting.GREEN + "Your set API key has been copied to the clipboard.")); + } } |