diff options
author | bowser0000 <bowser0000@gmail.com> | 2020-07-11 01:07:31 -0400 |
---|---|---|
committer | bowser0000 <bowser0000@gmail.com> | 2020-07-11 01:07:31 -0400 |
commit | 0f232e1343fc6495d79f61af212b93fbd55e1598 (patch) | |
tree | 266e8fdafda66af34899d557f615329386820103 /me/Danker/commands | |
parent | 8a87957922a40ed3f29356098ee231e3338b1922 (diff) | |
download | SkyblockMod-0f232e1343fc6495d79f61af212b93fbd55e1598.tar.gz SkyblockMod-0f232e1343fc6495d79f61af212b93fbd55e1598.tar.bz2 SkyblockMod-0f232e1343fc6495d79f61af212b93fbd55e1598.zip |
Add tracker and display for all slayer drops
Added token and 20% chance slayer drops. Also added display for the slayer tracker with /display.
This was more difficult than I thought. I first tried to use the PlayerEvent.ItemPickupEvent event, but it was server side only. Then I tried to use the ClientChatReceivedEvent event, but the boss slain message was sent to late. Ultimately, I decided on the PlaySoundEvent event, which waits for the noise for when a slayer boss dies.
Diffstat (limited to 'me/Danker/commands')
-rw-r--r-- | me/Danker/commands/DisplayCommand.java | 55 | ||||
-rw-r--r-- | me/Danker/commands/GetkeyCommand.java | 40 | ||||
-rw-r--r-- | me/Danker/commands/LootCommand.java | 192 | ||||
-rw-r--r-- | me/Danker/commands/ReloadConfigCommand.java | 35 | ||||
-rw-r--r-- | me/Danker/commands/SetkeyCommand.java | 42 | ||||
-rw-r--r-- | me/Danker/commands/ToggleCommand.java | 64 |
6 files changed, 428 insertions, 0 deletions
diff --git a/me/Danker/commands/DisplayCommand.java b/me/Danker/commands/DisplayCommand.java new file mode 100644 index 0000000..534ce16 --- /dev/null +++ b/me/Danker/commands/DisplayCommand.java @@ -0,0 +1,55 @@ +package me.Danker.commands; + +import me.Danker.handlers.ConfigHandler; +import net.minecraft.command.CommandBase; +import net.minecraft.command.CommandException; +import net.minecraft.command.ICommandSender; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.ChatComponentText; + +public class DisplayCommand extends CommandBase { + public static String display; + + @Override + public String getCommandName() { + return "display"; + } + + @Override + public String getCommandUsage(ICommandSender arg0) { + return getCommandName() + " [zombie/spider/wolf/off]"; + } + + @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: /display [zombie/spider/wolf/off]")); + return; + } + + final ConfigHandler cf = new ConfigHandler(); + + if (arg1[0].equalsIgnoreCase("wolf")) { + display = "wolf"; + } else if (arg1[0].equalsIgnoreCase("spider")) { + display = "spider"; + } else if (arg1[0].equalsIgnoreCase("zombie")) { + display = "zombie"; + } else if (arg1[0].equalsIgnoreCase("off")) { + display = "off"; + } else { + player.addChatMessage(new ChatComponentText("Usage: /display [zombie/spider/wolf/off]")); + return; + } + player.addChatMessage(new ChatComponentText("Display set to " + display + ".")); + cf.writeStringConfig("misc", "display", display); + } + +} diff --git a/me/Danker/commands/GetkeyCommand.java b/me/Danker/commands/GetkeyCommand.java new file mode 100644 index 0000000..e8b29e6 --- /dev/null +++ b/me/Danker/commands/GetkeyCommand.java @@ -0,0 +1,40 @@ +package me.Danker.commands; + +import me.Danker.handlers.ConfigHandler; +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. Set your API key using /setkey.")); + } else { + player.addChatMessage(new ChatComponentText("Your set API key is " + cf.getString("api", "APIKey"))); + } + } + +} diff --git a/me/Danker/commands/LootCommand.java b/me/Danker/commands/LootCommand.java new file mode 100644 index 0000000..4b05d25 --- /dev/null +++ b/me/Danker/commands/LootCommand.java @@ -0,0 +1,192 @@ +package me.Danker.commands; + +import java.util.List; + +import net.minecraft.command.CommandBase; +import net.minecraft.command.CommandException; +import net.minecraft.command.ICommandSender; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.EnumChatFormatting; + +public class LootCommand extends CommandBase { + // Wolf + public static int wolfSvens; + public static int wolfTeeth; + public static int wolfWheels; + public static int wolfSpirits; + public static int wolfBooks; + public static int wolfEggs; + public static int wolfCoutures; + public static int wolfBaits; + public static int wolfFluxes; + public static int wolfTime; + public static int wolfBosses; + // Spider + public static int spiderTarantulas; + public static int spiderWebs; + public static int spiderTAP; + public static int spiderBites; + public static int spiderCatalysts; + public static int spiderBooks; + public static int spiderSwatters; + public static int spiderTalismans; + public static int spiderMosquitos; + public static int spiderTime; + public static int spiderBosses; + // Zombie + public static int zombieRevs; + public static int zombieRevFlesh; + public static int zombieFoulFlesh; + public static int zombiePestilences; + public static int zombieUndeadCatas; + public static int zombieBooks; + public static int zombieBeheadeds; + public static int zombieRevCatas; + public static int zombieSnakes; + public static int zombieScythes; + public static int zombieTime; + public static int zombieBosses; + + public String getTimeBetween(int timeOne, int timeTwo) { + int secondsBetween = timeTwo - timeOne; + + String timeFormatted = ""; + int days; + int hours; + int minutes; + int seconds; + + if (secondsBetween > 86400) { + // More than 1d, display #d#h + days = secondsBetween / 86400; + hours = secondsBetween % 86400 / 3600; + timeFormatted = days + "d" + hours + "h"; + } else if (secondsBetween > 3600) { + // More than 1h, display #h#m + hours = secondsBetween / 3600; + minutes = secondsBetween % 3600 / 60; + timeFormatted = hours + "h" + minutes + "m"; + } else { + // Display #m#s + minutes = secondsBetween / 60; + seconds = secondsBetween % 60; + timeFormatted = minutes + "m" + seconds + "s"; + } + + return timeFormatted; + } + + @Override + public String getCommandName() { + return "loot"; + } + + @Override + public String getCommandUsage(ICommandSender arg0) { + return getCommandName() + " [zombie/spider/wolf]"; + } + + @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: /loot [zombie/spider/wolf]")); + return; + } + + int timeNow = (int) System.currentTimeMillis() / 1000; + String timeBetween; + String bossesBetween; + if (arg1[0].equalsIgnoreCase("wolf")) { + if (wolfTime == -1) { + timeBetween = "Never"; + } else { + timeBetween = getTimeBetween(wolfTime, timeNow); + } + if (wolfBosses == -1) { + bossesBetween = "Never"; + } else { + bossesBetween = Integer.toString(wolfBosses); + } + + player.addChatMessage(new ChatComponentText(EnumChatFormatting.AQUA + "" + EnumChatFormatting.BOLD + "-------------------\n" + + EnumChatFormatting.DARK_AQUA + "" + EnumChatFormatting.BOLD + " Sven Loot Summary:\n" + + EnumChatFormatting.GOLD + " Svens Killed: " + wolfSvens + "\n" + + EnumChatFormatting.GREEN + " Wolf Teeth: " + wolfTeeth + "\n" + + EnumChatFormatting.BLUE + " Hamster Wheels: " + wolfWheels + "\n" + + EnumChatFormatting.AQUA + " Spirit Runes: " + wolfSpirits + "\n" + + EnumChatFormatting.WHITE + " Critical VI Books: " + wolfBooks + "\n" + + EnumChatFormatting.DARK_RED + " Red Claw Eggs: " + wolfEggs + "\n" + + EnumChatFormatting.GOLD + " Couture Runes: " + wolfCoutures + "\n" + + EnumChatFormatting.AQUA + " Grizzly Baits: " + wolfBaits + "\n" + + EnumChatFormatting.DARK_PURPLE + " Overfluxes: " + wolfFluxes + "\n" + + EnumChatFormatting.AQUA + " Time Since RNG: " + timeBetween + "\n" + + EnumChatFormatting.AQUA + " Bosses Since RNG: " + bossesBetween + "\n" + + EnumChatFormatting.AQUA + "" + EnumChatFormatting.BOLD + " -------------------")); + } else if (arg1[0].equalsIgnoreCase("spider")) { + if (spiderTime == -1) { + timeBetween = "Never"; + } else { + timeBetween = getTimeBetween(spiderTime, timeNow); + } + if (spiderBosses == -1) { + bossesBetween = "Never"; + } else { + bossesBetween = Integer.toString(spiderBosses); + } + + player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "" + EnumChatFormatting.BOLD + "-------------------\n" + + EnumChatFormatting.DARK_RED + "" + EnumChatFormatting.BOLD + " Spider Loot Summary:\n" + + EnumChatFormatting.GOLD + " Tarantulas Killed: " + spiderTarantulas + "\n" + + EnumChatFormatting.GREEN + " Tarantula Webs: " + spiderWebs + "\n" + + EnumChatFormatting.DARK_GREEN + " Arrow Poison: " + spiderTAP + "\n" + + EnumChatFormatting.DARK_GRAY + " Bite Runes: " + spiderBites + "\n" + + EnumChatFormatting.WHITE + " Bane VI Books: " + spiderBooks + "\n" + + EnumChatFormatting.AQUA + " Spider Catalysts: " + spiderCatalysts + "\n" + + EnumChatFormatting.DARK_PURPLE + " Tarantula Talismans: " + spiderTalismans + "\n" + + EnumChatFormatting.LIGHT_PURPLE + " Fly Swatters: " + spiderSwatters + "\n" + + EnumChatFormatting.GOLD + " Digested Mosquitos: " + spiderMosquitos + "\n" + + EnumChatFormatting.AQUA + " Time Since RNG: " + timeBetween + "\n" + + EnumChatFormatting.AQUA + " Bosses Since RNG: " + bossesBetween + "\n" + + EnumChatFormatting.RED + "" + EnumChatFormatting.BOLD + " -------------------")); + } else if (arg1[0].equalsIgnoreCase("zombie")) { + if (zombieTime == -1) { + timeBetween = "Never"; + } else { + timeBetween = getTimeBetween(zombieTime, timeNow); + } + if (zombieBosses == -1) { + bossesBetween = "Never"; + } else { + bossesBetween = Integer.toString(zombieBosses); + } + + player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "" + EnumChatFormatting.BOLD + "-------------------\n" + + EnumChatFormatting.DARK_GREEN + "" + EnumChatFormatting.BOLD + " Zombie Loot Summary:\n" + + EnumChatFormatting.GOLD + " Revs Killed: " + zombieRevs + "\n" + + EnumChatFormatting.GREEN + " Revenant Flesh: " + zombieRevFlesh + "\n" + + EnumChatFormatting.BLUE + " Foul Flesh: " + zombieFoulFlesh + "\n" + + EnumChatFormatting.DARK_GREEN + " Pestilence Runes: " + zombiePestilences + "\n" + + EnumChatFormatting.WHITE + " Smite VI Books: " + zombieBooks + "\n" + + EnumChatFormatting.AQUA + " Undead Catalysts: " + zombieUndeadCatas + "\n" + + EnumChatFormatting.DARK_PURPLE + " Beheaded Horrors: " + zombieBeheadeds + "\n" + + EnumChatFormatting.RED + " Revenant Catalysts: " + zombieRevCatas + "\n" + + EnumChatFormatting.DARK_GREEN + " Snake Runes: " + zombieSnakes + "\n" + + EnumChatFormatting.GOLD + " Scythe Blades: " + zombieScythes + "\n" + + EnumChatFormatting.AQUA + " Time Since RNG: " + timeBetween + "\n" + + EnumChatFormatting.AQUA + " Bosses Since RNG: " + bossesBetween + "\n" + + EnumChatFormatting.GREEN + "" + EnumChatFormatting.BOLD + " -------------------")); + } else { + player.addChatMessage(new ChatComponentText("Usage: /loot [zombie/spider/wolf]")); + } + + } + +} diff --git a/me/Danker/commands/ReloadConfigCommand.java b/me/Danker/commands/ReloadConfigCommand.java new file mode 100644 index 0000000..4eda66b --- /dev/null +++ b/me/Danker/commands/ReloadConfigCommand.java @@ -0,0 +1,35 @@ +package me.Danker.commands; + +import me.Danker.handlers.ConfigHandler; +import net.minecraft.command.CommandBase; +import net.minecraft.command.CommandException; +import net.minecraft.command.ICommandSender; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.ChatComponentText; + +public class ReloadConfigCommand extends CommandBase { + + @Override + public String getCommandName() { + return "reloadconfig"; + } + + @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(); + cf.reloadConfig(); + player.addChatMessage(new ChatComponentText("Reloaded config.")); + } + +} diff --git a/me/Danker/commands/SetkeyCommand.java b/me/Danker/commands/SetkeyCommand.java new file mode 100644 index 0000000..85e9dd7 --- /dev/null +++ b/me/Danker/commands/SetkeyCommand.java @@ -0,0 +1,42 @@ +package me.Danker.commands; + +import me.Danker.handlers.ConfigHandler; +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])); + } + +} diff --git a/me/Danker/commands/ToggleCommand.java b/me/Danker/commands/ToggleCommand.java new file mode 100644 index 0000000..7e1b83a --- /dev/null +++ b/me/Danker/commands/ToggleCommand.java @@ -0,0 +1,64 @@ +package me.Danker.commands; + +import me.Danker.handlers.ConfigHandler; +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 ToggleCommand extends CommandBase implements ICommand { + public static boolean gpartyToggled; + public static boolean coordsToggled; + + public boolean getToggle(String type) { + if (type.equals("gparty")) { + return gpartyToggled; + } else if (type.equals("coords")) { + return coordsToggled; + } + return true; + } + + @Override + public String getCommandName() { + return "toggle"; + } + + @Override + public String getCommandUsage(ICommandSender arg0) { + return getCommandName() + " [gparty/coords/list]"; + } + + @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 (arg1.length == 0) { + player.addChatMessage(new ChatComponentText("Usage: /toggle [gparty/coords/list]")); + return; + } + + if (arg1[0].equalsIgnoreCase("gparty")) { + gpartyToggled = !gpartyToggled; + cf.writeBooleanConfig("toggles", "GParty", gpartyToggled); + player.addChatMessage(new ChatComponentText("Guild party notifications has been set to " + gpartyToggled + ".")); + } else if (arg1[0].equalsIgnoreCase("coords")) { + coordsToggled = !coordsToggled; + cf.writeBooleanConfig("toggles", "Coords", coordsToggled); + player.addChatMessage(new ChatComponentText("Coord/Angle display has been set to " + coordsToggled + ".")); + } else if (arg1[0].equalsIgnoreCase("list")) { + player.addChatMessage(new ChatComponentText("Guild party notifications: " + gpartyToggled)); + player.addChatMessage(new ChatComponentText("Coord/Angle display: " + coordsToggled)); + } else { + player.addChatMessage(new ChatComponentText("Usage: /toggle [gparty/coords/list]")); + } + } +} |