From da78feeab0e2af3c0f7f382eb79fa6f01d9fc7d2 Mon Sep 17 00:00:00 2001 From: Desco1 Date: Tue, 18 Aug 2020 19:28:20 +0200 Subject: Added clipboard as a parameter for the getkey command --- src/main/java/me/Danker/commands/DHelpCommand.java | 2 +- .../java/me/Danker/commands/GetkeyCommand.java | 29 ++++++++++++++++------ src/main/java/me/Danker/commands/PetsCommand.java | 2 +- 3 files changed, 23 insertions(+), 10 deletions(-) (limited to 'src/main/java/me/Danker') diff --git a/src/main/java/me/Danker/commands/DHelpCommand.java b/src/main/java/me/Danker/commands/DHelpCommand.java index 0a48213..a2efa94 100644 --- a/src/main/java/me/Danker/commands/DHelpCommand.java +++ b/src/main/java/me/Danker/commands/DHelpCommand.java @@ -34,7 +34,7 @@ public class DHelpCommand extends CommandBase { EnumChatFormatting.GOLD + " /dhelp" + EnumChatFormatting.AQUA + " - Returns this message.\n" + EnumChatFormatting.GOLD + " /toggle " + EnumChatFormatting.AQUA + " - Toggles features. /toggle list returns values of every toggle.\n" + EnumChatFormatting.GOLD + " /setkey " + EnumChatFormatting.AQUA + " - Sets API key.\n" + - EnumChatFormatting.GOLD + " /getkey" + EnumChatFormatting.AQUA + " - Returns key set with /setkey.\n" + + EnumChatFormatting.GOLD + " /getkey [clipboard]" + EnumChatFormatting.AQUA + " - Returns key set with /setkey.\n" + EnumChatFormatting.GOLD + " /loot [winter/f(1-4)/session]" + EnumChatFormatting.AQUA + " - Returns loot received from slayer quests or fishing stats. /loot fishing winter returns winter sea creatures instead.\n" + EnumChatFormatting.GOLD + " /display [winter/f(1-4)/session]" + EnumChatFormatting.AQUA + " - Text display for trackers. /display fishing winter displays winter sea creatures instead.\n" + EnumChatFormatting.GOLD + " /resetloot " + EnumChatFormatting.AQUA + " - Resets loot for trackers. /resetloot confirm confirms the reset.\n" + 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)")); + } + } } diff --git a/src/main/java/me/Danker/commands/PetsCommand.java b/src/main/java/me/Danker/commands/PetsCommand.java index 75367ab..5d38214 100644 --- a/src/main/java/me/Danker/commands/PetsCommand.java +++ b/src/main/java/me/Danker/commands/PetsCommand.java @@ -23,7 +23,7 @@ public class PetsCommand extends CommandBase { static int petXpToLevel(double xp, String rarity) { int[] xpPerLevel = {100, 110, 120, 130, 145, 160, 175, 190, 210, 230, 250, 275, 300, 330, 360, 400, 440, 490, 540, 600, 660, 730, - 800, 880, 860, 1050, 1150, 1260, 1380, 1510, 1650, 1800, 1960, 2130, 2310, 2500, 2700, 2920, 3160, 3420, 3700, + 800, 880, 960, 1050, 1150, 1260, 1380, 1510, 1650, 1800, 1960, 2130, 2310, 2500, 2700, 2920, 3160, 3420, 3700, 4000, 4350, 4750, 5200, 5700, 6300, 7000, 7800, 8700, 9700, 10800, 12000, 13300, 14700, 16200, 17800, 19500, 21300, 23200, 25200, 27400, 29800, 32400, 35200, 38200, 41400, 44800, 48400, 52200, 56200, 60400, 64800, 69400, 74200, 79200, 84700, 90700, 97200, 104200, 111700, 119700, 128200, 137200, 146700, 156700, 167700, 179700, 192700, -- cgit