diff options
author | bowser0000 <bowser0000@gmail.com> | 2020-07-11 01:13:53 -0400 |
---|---|---|
committer | bowser0000 <bowser0000@gmail.com> | 2020-07-11 01:13:53 -0400 |
commit | 99e549b48623ea7968503377adbbf6ca3eccadca (patch) | |
tree | b227e2fc016b656fd22a987863055cb7ade2c194 /Danker | |
parent | 0d177505ddb0b0d6410d768b32320655e8b24ccf (diff) | |
download | SkyblockMod-99e549b48623ea7968503377adbbf6ca3eccadca.tar.gz SkyblockMod-99e549b48623ea7968503377adbbf6ca3eccadca.tar.bz2 SkyblockMod-99e549b48623ea7968503377adbbf6ca3eccadca.zip |
Add tracker and display for all slayer dropsv1.4
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.
I also have no idea what I'm doing with these commits, don't look at history.
Diffstat (limited to 'Danker')
-rw-r--r-- | Danker/TheMod.java | 440 | ||||
-rw-r--r-- | Danker/commands/DisplayCommand.java | 55 | ||||
-rw-r--r-- | Danker/commands/GetkeyCommand.java | 40 | ||||
-rw-r--r-- | Danker/commands/LootCommand.java | 192 | ||||
-rw-r--r-- | Danker/commands/ReloadConfigCommand.java | 35 | ||||
-rw-r--r-- | Danker/commands/SetkeyCommand.java | 42 | ||||
-rw-r--r-- | Danker/commands/ToggleCommand.java | 64 | ||||
-rw-r--r-- | Danker/handlers/ConfigHandler.java | 216 | ||||
-rw-r--r-- | Danker/handlers/ScoreboardHandler.java | 60 | ||||
-rw-r--r-- | Danker/handlers/TextRenderer.java | 13 |
10 files changed, 0 insertions, 1157 deletions
diff --git a/Danker/TheMod.java b/Danker/TheMod.java deleted file mode 100644 index 3e9791b..0000000 --- a/Danker/TheMod.java +++ /dev/null @@ -1,440 +0,0 @@ -package me.Danker; - -import java.awt.Image; -import java.awt.SystemTray; -import java.awt.Toolkit; -import java.awt.TrayIcon; -import java.util.List; - -import me.Danker.commands.DisplayCommand; -import me.Danker.commands.GetkeyCommand; -import me.Danker.commands.LootCommand; -import me.Danker.commands.ReloadConfigCommand; -import me.Danker.commands.SetkeyCommand; -import me.Danker.commands.ToggleCommand; -import me.Danker.handlers.ConfigHandler; -import me.Danker.handlers.ScoreboardHandler; -import me.Danker.handlers.TextRenderer; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.ScaledResolution; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.ChatComponentText; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.StringUtils; -import net.minecraftforge.client.ClientCommandHandler; -import net.minecraftforge.client.event.ClientChatReceivedEvent; -import net.minecraftforge.client.event.RenderGameOverlayEvent; -import net.minecraftforge.client.event.sound.PlaySoundEvent; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.fml.common.FMLCommonHandler; -import net.minecraftforge.fml.common.Mod; -import net.minecraftforge.fml.common.Mod.EventHandler; -import net.minecraftforge.fml.common.event.FMLInitializationEvent; -import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; - -@Mod(modid = TheMod.MODID, version = TheMod.VERSION, clientSideOnly = true) -public class TheMod -{ - public static final String MODID = "Danker's Skyblock Mod"; - public static final String VERSION = "1.4"; - - static int checkItemsNow = 0; - static int itemsChecked = 0; - - @EventHandler - public void init(FMLInitializationEvent event) - { - FMLCommonHandler.instance().bus().register(this); - MinecraftForge.EVENT_BUS.register(this); - - final ConfigHandler cf = new ConfigHandler(); - cf.reloadConfig(); - } - - @EventHandler - public void preInit(final FMLPreInitializationEvent event) { - ClientCommandHandler.instance.registerCommand(new ToggleCommand()); - ClientCommandHandler.instance.registerCommand(new SetkeyCommand()); - ClientCommandHandler.instance.registerCommand(new GetkeyCommand()); - ClientCommandHandler.instance.registerCommand(new LootCommand()); - ClientCommandHandler.instance.registerCommand(new ReloadConfigCommand()); - ClientCommandHandler.instance.registerCommand(new DisplayCommand()); - } - - @SubscribeEvent - public void onChat(final ClientChatReceivedEvent event) { - final ToggleCommand tc = new ToggleCommand(); - final boolean isGPartyToggled = tc.getToggle("gparty"); - String message = event.message.getUnformattedText(); - - if (!message.contains(":")) { - if (isGPartyToggled) { - if (message.contains(" has invited all members of ")) { - System.out.println(message); - try { - final SystemTray tray = SystemTray.getSystemTray(); - final Image image = Toolkit.getDefaultToolkit().createImage("icon.png"); - final TrayIcon trayIcon = new TrayIcon(image, "Guild Party Notifier"); - trayIcon.setImageAutoSize(true); - trayIcon.setToolTip("Guild Party Notifier"); - tray.add(trayIcon); - trayIcon.displayMessage("Guild Party", message, TrayIcon.MessageType.INFO); - tray.remove(trayIcon); - } catch (Exception ex) { - System.err.print(ex); - } - } - } - - final LootCommand lc = new LootCommand(); - final ConfigHandler cf = new ConfigHandler(); - boolean wolfRNG = false; - boolean spiderRNG = false; - boolean zombieRNG = false; - // T6 books - if (message.contains("VERY RARE DROP! (Enchanted Book)")) { - // Loop through scoreboard to see what boss you're doing - List<String> scoreboard = ScoreboardHandler.getSidebarLines(); - for (String s : scoreboard) { - String sCleaned = ScoreboardHandler.cleanSB(s); - if (sCleaned.contains("Sven Packmaster")) { - lc.wolfBooks++; - cf.writeIntConfig("wolf", "book", lc.wolfBooks); - } else if (sCleaned.contains("Tarantula Broodfather")) { - lc.spiderBooks++; - cf.writeIntConfig("spider", "book", lc.spiderBooks); - } else if (sCleaned.contains("Revenant Horror")) { - lc.zombieBooks++; - cf.writeIntConfig("zombie", "book", lc.zombieBooks); - } - } - } - - // Wolf - if (message.contains("Talk to Maddox to claim your Wolf Slayer XP!")) { - lc.wolfSvens++; - cf.writeIntConfig("wolf", "svens", lc.wolfSvens); - } - if (message.contains("VERY RARE DROP! (◆ Spirit Rune ")) { - lc.wolfSpirits++; - cf.writeIntConfig("wolf", "spirit", lc.wolfSpirits); - } - if (message.contains("CRAZY RARE DROP! (Red Claw Egg)")) { - wolfRNG = true; - lc.wolfEggs++; - cf.writeIntConfig("wolf", "egg", lc.wolfEggs); - } - if (message.contains("CRAZY RARE DROP! (◆ Couture Rune")) { - wolfRNG = true; - lc.wolfCoutures++; - cf.writeIntConfig("wolf", "couture", lc.wolfCoutures); - } - // How did Skyblock devs even manage to make this item Rename Me - if (message.contains("CRAZY RARE DROP! (Grizzly Bait)") || message.contains("CRAZY RARE DROP! (Rename Me)")) { - wolfRNG = true; - lc.wolfBaits++; - cf.writeIntConfig("wolf", "bait", lc.wolfBaits); - } - if (message.contains("CRAZY RARE DROP! (Overflux Capacitor)")) { - wolfRNG = true; - lc.wolfFluxes++; - cf.writeIntConfig("wolf", "flux", lc.wolfFluxes); - } - - // Spider - if (message.contains("Talk to Maddox to claim your Spider Slayer XP!")) { - lc.spiderTarantulas++; - cf.writeIntConfig("spider", "tarantulas", lc.spiderTarantulas); - } - - if (message.contains("VERY RARE DROP! (◆ Bite Rune")) { - lc.spiderBites++; - cf.writeIntConfig("spider", "bite", lc.spiderBites); - } - if (message.contains("VERY RARE DROP! (Spider Catalyst)")) { - lc.spiderCatalysts++; - cf.writeIntConfig("spider", "catalyst", lc.spiderCatalysts); - } - // T3 Spider Book Drop - if (message.contains("CRAZY RARE DROP! (Enchanted Book)")) { - lc.spiderBooks++; - cf.writeIntConfig("spider", "book", lc.spiderBooks); - } - if (message.contains("CRAZY RARE DROP! (Fly Swatter)")) { - spiderRNG = true; - lc.spiderSwatters++; - cf.writeIntConfig("spider", "swatter", lc.spiderSwatters); - } - if (message.contains("CRAZY RARE DROP! (Tarantula Talisman")) { - spiderRNG = true; - lc.spiderTalismans++; - cf.writeIntConfig("spider", "talisman", lc.spiderTalismans); - } - if (message.contains("CRAZY RARE DROP! (Digested Mosquito)")) { - spiderRNG = true; - lc.spiderMosquitos++; - cf.writeIntConfig("spider", "mosquito", lc.spiderMosquitos); - } - - // Zombie - if (message.contains("Talk to Maddox to claim your Zombie Slayer XP!")) { - lc.zombieRevs++; - cf.writeIntConfig("zombie", "revs", lc.zombieRevs); - } - // I couldn't find a pic of someone getting this drop, so I'm assuming this works - if (message.contains("VERY RARE DROP! (Revenant Catalyst)")) { - lc.zombieRevCatas++; - cf.writeIntConfig("zombie", "revCatalyst", lc.zombieRevCatas); - } - if (message.contains("VERY RARE DROP! (◆ Pestilence Rune")) { - lc.zombiePestilences++; - cf.writeIntConfig("zombie", "pestilence", lc.zombiePestilences); - } - if (message.contains("VERY RARE DROP! (Undead Catalyst)")) { - lc.zombieUndeadCatas++; - cf.writeIntConfig("zombie", "undeadCatalyst", lc.zombieUndeadCatas); - } - if (message.contains("CRAZY RARE DROP! (Beheaded Horror)")) { - zombieRNG = true; - lc.zombieBeheadeds++; - cf.writeIntConfig("zombie", "beheaded", lc.zombieBeheadeds); - } - - if (message.contains("CRAZY RARE DROP! (◆ Snake Rune")) { - zombieRNG = true; - lc.zombieSnakes++; - cf.writeIntConfig("zombie", "snake", lc.zombieSnakes); - } - if (message.contains("CRAZY RARE DROP! (Scythe Blade)")) { - zombieRNG = true; - lc.zombieScythes++; - cf.writeIntConfig("zombie", "scythe", lc.zombieScythes); - } - - // Time is stored in seconds, so if Skyblock - // survives until 2038, I'll just update it then - if (wolfRNG) { - lc.wolfTime = (int) System.currentTimeMillis() / 1000; - lc.wolfBosses = 0; - cf.writeIntConfig("wolf", "timeRNG", lc.wolfTime); - cf.writeIntConfig("wolf", "bossRNG", 0); - } else { - if (lc.wolfBosses != -1) { - lc.wolfBosses++; - } - cf.writeIntConfig("wolf", "bossRNG", lc.wolfBosses); - } - if (spiderRNG) { - lc.spiderTime = (int) System.currentTimeMillis() / 1000; - lc.spiderBosses = 0; - cf.writeIntConfig("spider", "timeRNG", lc.spiderTime); - cf.writeIntConfig("spider", "bossRNG", 0); - } else { - if (lc.spiderBosses != -1) { - lc.spiderBosses++; - } - cf.writeIntConfig("spider", "bossRNG", lc.spiderBosses); - } - if (zombieRNG) { - lc.zombieTime = (int) System.currentTimeMillis() / 1000; - lc.zombieBosses = 0; - cf.writeIntConfig("zombie", "timeRNG", lc.zombieTime); - cf.writeIntConfig("zombie", "bossRNG", 0); - } else { - if (lc.zombieBosses != -1) { - lc.zombieBosses++; - } - cf.writeIntConfig("wolf", "bossRNG", lc.zombieBosses); - } - } - } - - @SubscribeEvent - public void renderPlayerInfo(final RenderGameOverlayEvent.Post event) { - if (event.type != RenderGameOverlayEvent.ElementType.EXPERIENCE) return; - final ToggleCommand tc = new ToggleCommand(); - final boolean isCoordsToggled = tc.getToggle("coords"); - - if (isCoordsToggled) { - ScaledResolution scaled = new ScaledResolution(Minecraft.getMinecraft()); - EntityPlayer player = Minecraft.getMinecraft().thePlayer; - - double xDir = (player.rotationYaw % 360 + 360) % 360; - if (xDir > 180) xDir -= 360; - xDir = (double) Math.round(xDir * 10d) / 10d; - double yDir = (double) Math.round(player.rotationPitch * 10d) / 10d; - - String coordText = (int) player.posX + " / " + (int) player.posY + " / " + (int) player.posZ + " (" + xDir + " / " + yDir + ")"; - int height = scaled.getScaledHeight(); - new TextRenderer(Minecraft.getMinecraft(), coordText, 5, height - 25, Integer.parseInt("FFFFFF", 16)); - } - - final DisplayCommand ds = new DisplayCommand(); - final String displayToggle = ds.display; - - if (!displayToggle.equals("off")) { - final LootCommand lc = new LootCommand(); - String dropsText = ""; - String countText = ""; - String timeBetween = "Never"; - String bossesBetween = "Never"; - int timeNow = (int) System.currentTimeMillis() / 1000; - - if (displayToggle.equals("wolf")) { - if (lc.wolfTime == -1) { - timeBetween = "Never"; - } else { - timeBetween = lc.getTimeBetween(lc.wolfTime, timeNow); - } - if (lc.wolfBosses == -1) { - bossesBetween = "Never"; - } else { - bossesBetween = Integer.toString(lc.wolfBosses); - } - - dropsText = EnumChatFormatting.GOLD + "Svens Killed:\n" + - EnumChatFormatting.GREEN + "Wolf Teeth:\n" + - EnumChatFormatting.BLUE + "Hamster Wheels:\n" + - EnumChatFormatting.AQUA + "Spirit Runes:\n" + - EnumChatFormatting.WHITE + "Critical VI Books:\n" + - EnumChatFormatting.DARK_RED + "Red Claw Eggs:\n" + - EnumChatFormatting.GOLD + "Couture Runes:\n" + - EnumChatFormatting.AQUA + "Grizzly Baits:\n" + - EnumChatFormatting.DARK_PURPLE + "Overfluxes:\n" + - EnumChatFormatting.AQUA + "Time Since RNG:\n" + - EnumChatFormatting.AQUA + "Bosses Since RNG:\n"; - countText = EnumChatFormatting.GOLD + "" + lc.wolfSvens + "\n" + - EnumChatFormatting.GREEN + lc.wolfTeeth + "\n" + - EnumChatFormatting.BLUE + lc.wolfWheels + "\n" + - EnumChatFormatting.AQUA + lc.wolfSpirits + "\n" + - EnumChatFormatting.WHITE + lc.wolfBooks + "\n" + - EnumChatFormatting.DARK_RED + lc.wolfEggs + "\n" + - EnumChatFormatting.GOLD + lc.wolfCoutures + "\n" + - EnumChatFormatting.AQUA + lc.wolfBaits + "\n" + - EnumChatFormatting.DARK_PURPLE + lc.wolfFluxes + "\n" + - EnumChatFormatting.AQUA + timeBetween + "\n" + - EnumChatFormatting.AQUA + bossesBetween + "\n"; - } else if (displayToggle.equals("spider")) { - if (lc.spiderTime == -1) { - timeBetween = "Never"; - } else { - timeBetween = lc.getTimeBetween(lc.spiderTime, timeNow); - } - if (lc.spiderBosses == -1) { - bossesBetween = "Never"; - } else { - bossesBetween = Integer.toString(lc.spiderBosses); - } - - dropsText = EnumChatFormatting.GOLD + "Tarantulas Killed:\n" + - EnumChatFormatting.GREEN + "Tarantula Webs:\n" + - EnumChatFormatting.DARK_GREEN + "Arrow Poison:\n" + - EnumChatFormatting.DARK_GRAY + "Bite Runes:\n" + - EnumChatFormatting.WHITE + "Bane VI Books:\n" + - EnumChatFormatting.AQUA + "Spider Catalysts:\n" + - EnumChatFormatting.DARK_PURPLE + "Tarantula Talismans:\n" + - EnumChatFormatting.LIGHT_PURPLE + "Fly Swatters:\n" + - EnumChatFormatting.GOLD + "Digested Mosquitos:\n" + - EnumChatFormatting.AQUA + "Time Since RNG:\n" + - EnumChatFormatting.AQUA + "Bosses Since RNG:\n"; - countText = EnumChatFormatting.GOLD + "" + lc.spiderTarantulas + "\n" + - EnumChatFormatting.GREEN + lc.spiderWebs + "\n" + - EnumChatFormatting.DARK_GREEN + lc.spiderTAP + "\n" + - EnumChatFormatting.DARK_GRAY + lc.spiderBites + "\n" + - EnumChatFormatting.WHITE + lc.spiderBooks + "\n" + - EnumChatFormatting.AQUA + lc.spiderCatalysts + "\n" + - EnumChatFormatting.DARK_PURPLE + lc.spiderTalismans + "\n" + - EnumChatFormatting.LIGHT_PURPLE + lc.spiderSwatters + "\n" + - EnumChatFormatting.GOLD + lc.spiderMosquitos + "\n" + - EnumChatFormatting.AQUA + timeBetween + "\n" + - EnumChatFormatting.AQUA + bossesBetween + "\n"; - } else { - // Zombie - dropsText = EnumChatFormatting.GOLD + "Revs Killed:\n" + - EnumChatFormatting.GREEN + "Revenant Flesh:\n" + - EnumChatFormatting.BLUE + "Foul Flesh:\n" + - EnumChatFormatting.DARK_GREEN + "Pestilence Runes:\n" + - EnumChatFormatting.WHITE + "Smite VI Books:\n" + - EnumChatFormatting.AQUA + "Undead Catalysts:\n" + - EnumChatFormatting.DARK_PURPLE + "Beheaded Horrors:\n" + - EnumChatFormatting.RED + "Revenant Catalysts:\n" + - EnumChatFormatting.DARK_GREEN + "Snake Runes:\n" + - EnumChatFormatting.GOLD + "Scythe Blades:\n" + - EnumChatFormatting.AQUA + "Time Since RNG:\n" + - EnumChatFormatting.AQUA + "Bosses Since RNG:\n"; - countText = EnumChatFormatting.GOLD + "" + lc.zombieRevs + "\n" + - EnumChatFormatting.GREEN + lc.zombieRevFlesh + "\n" + - EnumChatFormatting.BLUE + lc.zombieFoulFlesh + "\n" + - EnumChatFormatting.DARK_GREEN + lc.zombiePestilences + "\n" + - EnumChatFormatting.WHITE + lc.zombieBooks + "\n" + - EnumChatFormatting.AQUA + lc.zombieUndeadCatas + "\n" + - EnumChatFormatting.DARK_PURPLE + lc.zombieBeheadeds + "\n" + - EnumChatFormatting.RED + lc.zombieRevCatas + "\n" + - EnumChatFormatting.DARK_GREEN + lc.zombieSnakes + "\n" + - EnumChatFormatting.GOLD + lc.zombieScythes + "\n" + - EnumChatFormatting.AQUA + timeBetween + "\n" + - EnumChatFormatting.AQUA + bossesBetween + "\n"; - } - new TextRenderer(Minecraft.getMinecraft(), dropsText, 80, 5, Integer.parseInt("FFFFFF", 16)); - new TextRenderer(Minecraft.getMinecraft(), countText, 190, 5, Integer.parseInt("FFFFFF", 16)); - } - } - - @SubscribeEvent - public void onSound(final PlaySoundEvent event) { - if (event.name.equals("note.pling")) { - // Don't check twice within 5 seconds - checkItemsNow = (int) System.currentTimeMillis() / 1000; - if (checkItemsNow - itemsChecked <= 5) return; - - final ScoreboardHandler sc = new ScoreboardHandler(); - List<String> scoreboard = sc.getSidebarLines(); - - for (String line : scoreboard) { - String cleanedLine = sc.cleanSB(line); - if (cleanedLine.contains("Boss slain!")) { - final LootCommand lc = new LootCommand(); - final ConfigHandler cf = new ConfigHandler(); - - itemsChecked = (int) System.currentTimeMillis() / 1000; - - lc.wolfTeeth += getItems("Wolf Teeth"); - lc.wolfWheels += getItems("Hamster Wheel"); - lc.spiderWebs += getItems("Tarantula Web"); - lc.spiderTAP += getItems("Toxic Arrow Poison"); - lc.zombieRevFlesh += getItems("Revenant Flesh"); - lc.zombieFoulFlesh += getItems("Foul Flesh"); - - cf.writeIntConfig("wolf", "teeth", lc.wolfTeeth); - cf.writeIntConfig("wolf", "wheel", lc.wolfWheels); - cf.writeIntConfig("spider", "web", lc.spiderWebs); - cf.writeIntConfig("spider", "tap", lc.spiderTAP); - cf.writeIntConfig("zombie", "revFlesh", lc.zombieRevFlesh); - cf.writeIntConfig("zombie", "foulFlesh", lc.zombieFoulFlesh); - } - } - } - } - - public int getItems(String item) { - Minecraft mc = Minecraft.getMinecraft(); - EntityPlayer player = mc.thePlayer; - - double x = player.posX; - double y = player.posY; - double z = player.posZ; - AxisAlignedBB scan = new AxisAlignedBB(x - 6, y - 6, z - 6, x + 6, y + 6, z + 6); - List<EntityItem> items = mc.theWorld.getEntitiesWithinAABB(EntityItem.class, scan); - - for (EntityItem i : items) { - String itemName = StringUtils.stripControlCodes(i.getEntityItem().getDisplayName()); - if (itemName.equals(item)) return i.getEntityItem().stackSize; - } - // No items found - return 0; - } - -} diff --git a/Danker/commands/DisplayCommand.java b/Danker/commands/DisplayCommand.java deleted file mode 100644 index 534ce16..0000000 --- a/Danker/commands/DisplayCommand.java +++ /dev/null @@ -1,55 +0,0 @@ -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/Danker/commands/GetkeyCommand.java b/Danker/commands/GetkeyCommand.java deleted file mode 100644 index e8b29e6..0000000 --- a/Danker/commands/GetkeyCommand.java +++ /dev/null @@ -1,40 +0,0 @@ -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/Danker/commands/LootCommand.java b/Danker/commands/LootCommand.java deleted file mode 100644 index 4b05d25..0000000 --- a/Danker/commands/LootCommand.java +++ /dev/null @@ -1,192 +0,0 @@ -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/Danker/commands/ReloadConfigCommand.java b/Danker/commands/ReloadConfigCommand.java deleted file mode 100644 index 4eda66b..0000000 --- a/Danker/commands/ReloadConfigCommand.java +++ /dev/null @@ -1,35 +0,0 @@ -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/Danker/commands/SetkeyCommand.java b/Danker/commands/SetkeyCommand.java deleted file mode 100644 index 85e9dd7..0000000 --- a/Danker/commands/SetkeyCommand.java +++ /dev/null @@ -1,42 +0,0 @@ -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/Danker/commands/ToggleCommand.java b/Danker/commands/ToggleCommand.java deleted file mode 100644 index 7e1b83a..0000000 --- a/Danker/commands/ToggleCommand.java +++ /dev/null @@ -1,64 +0,0 @@ -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]")); - } - } -} diff --git a/Danker/handlers/ConfigHandler.java b/Danker/handlers/ConfigHandler.java deleted file mode 100644 index c9556f1..0000000 --- a/Danker/handlers/ConfigHandler.java +++ /dev/null @@ -1,216 +0,0 @@ -package me.Danker.handlers; - -import java.io.File; - -import me.Danker.commands.DisplayCommand; -import me.Danker.commands.LootCommand; -import me.Danker.commands.ToggleCommand; -import net.minecraftforge.common.config.Configuration; - -public class ConfigHandler { - public static Configuration config; - private static String file = "config/Danker's Skyblock Mod.cfg"; - - public static void init() { - config = new Configuration(new File(file)); - try { - config.load(); - } catch (Exception ex) { - System.err.print(ex); - } finally { - config.save(); - } - } - - public static int getInt(String category, String key) { - config = new Configuration(new File(file)); - try { - config.load(); - if (config.getCategory(category).containsKey(key)) { - return config.get(category, key, 0).getInt(); - } - } catch (Exception ex) { - System.err.print(ex); - } finally { - config.save(); - } - return 0; - } - - public static String getString(String category, String key) { - config = new Configuration(new File(file)); - try { - config.load(); - if (config.getCategory(category).containsKey(key)) { - return config.get(category, key, "").getString(); - } - } catch (Exception ex) { - System.err.print(ex); - } finally { - config.save(); - } - return ""; - } - - public static boolean getBoolean(String category, String key) { - config = new Configuration(new File(file)); - try { - config.load(); - if (config.getCategory(category).containsKey(key)) { - return config.get(category, key, false).getBoolean(); - } - } catch (Exception ex) { - System.err.print(ex); - } finally { - config.save(); - } - return true; - } - - public static void writeIntConfig(String category, String key, int value) { - config = new Configuration(new File(file)); - try { - config.load(); - int set = config.get(category, key, value).getInt(); - config.getCategory(category).get(key).set(value); - } catch (Exception ex) { - System.err.print(ex); - } finally { - config.save(); - } - } - - public static void writeStringConfig(String category, String key, String value) { - config = new Configuration(new File(file)); - try { - config.load(); - String set = config.get(category, key, value).getString(); - config.getCategory(category).get(key).set(value); - } catch (Exception ex) { - System.err.print(ex); - } finally { - config.save(); - } - } - - public static void writeBooleanConfig(String category, String key, boolean value) { - config = new Configuration(new File(file)); - try { - config.load(); - boolean set = config.get(category, key, value).getBoolean(); - config.getCategory(category).get(key).set(value); - } catch (Exception ex) { - System.err.print(ex); - } finally { - config.save(); - } - } - - public static boolean hasKey(String category, String key) { - config = new Configuration(new File(file)); - try { - config.load(); - if (!config.hasCategory(category)) return false; - return config.getCategory(category).containsKey(key); - } catch (Exception ex) { - System.err.print(ex); - } finally { - config.save(); - } - return false; - } - - public static void reloadConfig() { - // Config init - if (!hasKey("toggles", "GParty")) writeBooleanConfig("toggles", "GParty", true); - if (!hasKey("toggles", "Coords")) writeBooleanConfig("toggles", "Coords", true); - if (!hasKey("api", "APIKey")) writeStringConfig("api", "APIKey", ""); - - // Wolf Loot - if (!hasKey("wolf", "svens")) writeIntConfig("wolf", "svens", 0); - if (!hasKey("wolf", "teeth")) writeIntConfig("wolf", "teeth", 0); - if (!hasKey("wolf", "wheel")) writeIntConfig("wolf", "wheel", 0); - if (!hasKey("wolf", "spirit")) writeIntConfig("wolf", "spirit", 0); - if (!hasKey("wolf", "book")) writeIntConfig("wolf", "book", 0); - if (!hasKey("wolf", "egg")) writeIntConfig("wolf", "egg", 0); - if (!hasKey("wolf", "couture")) writeIntConfig("wolf", "couture", 0); - if (!hasKey("wolf", "bait")) writeIntConfig("wolf", "bait", 0); - if (!hasKey("wolf", "flux")) writeIntConfig("wolf", "flux", 0); - if (!hasKey("wolf", "timeRNG")) writeIntConfig("wolf", "timeRNG", -1); - if (!hasKey("wolf", "bossRNG")) writeIntConfig("wolf", "bossRNG", -1); - // Spider Loot - if (!hasKey("spider", "tarantulas")) writeIntConfig("spider", "tarantulas", 0); - if (!hasKey("spider", "web")) writeIntConfig("spider", "web", 0); - if (!hasKey("spider", "tap")) writeIntConfig("spider", "tap", 0); - if (!hasKey("spider", "bite")) writeIntConfig("spider", "bite", 0); - if (!hasKey("spider", "catalyst")) writeIntConfig("spider", "catalyst", 0); - if (!hasKey("spider", "book")) writeIntConfig("spider", "book", 0); - if (!hasKey("spider", "swatter")) writeIntConfig("spider", "swatter", 0); - if (!hasKey("spider", "talisman")) writeIntConfig("spider", "talisman", 0); - if (!hasKey("spider", "mosquito")) writeIntConfig("spider", "mosquito", 0); - if (!hasKey("spider", "timeRNG")) writeIntConfig("spider", "timeRNG", -1); - if (!hasKey("spider", "bossRNG")) writeIntConfig("spider", "bossRNG", -1); - // Zombie Loot - if (!hasKey("zombie", "revs")) writeIntConfig("zombie", "revs", 0); - if (!hasKey("zombie", "revFlesh")) writeIntConfig("zombie", "revFlesh", 0); - if (!hasKey("zombie", "foulFlesh")) writeIntConfig("zombie", "foulFlesh", 0); - if (!hasKey("zombie", "pestilence")) writeIntConfig("zombie", "pestilence", 0); - if (!hasKey("zombie", "undeadCatalyst")) writeIntConfig("zombie", "undeadCatalyst", 0); - if (!hasKey("zombie", "book")) writeIntConfig("zombie", "book", 0); - if (!hasKey("zombie", "beheaded")) writeIntConfig("zombie", "beheaded", 0); - if (!hasKey("zombie", "revCatalyst")) writeIntConfig("zombie", "revCatalyst", 0); - if (!hasKey("zombie", "snake")) writeIntConfig("zombie", "snake", 0); - if (!hasKey("zombie", "scythe")) writeIntConfig("zombie", "scythe", 0); - if (!hasKey("zombie", "timeRNG")) writeIntConfig("zombie", "timeRNG", -1); - if (!hasKey("zombie", "bossRNG")) writeIntConfig("zombie", "bossRNG", -1); - - if (!hasKey("misc", "display")) writeStringConfig("misc", "display", "off"); - - final ToggleCommand tf = new ToggleCommand(); - tf.gpartyToggled = getBoolean("toggles", "GParty"); - tf.coordsToggled = getBoolean("toggles", "Coords"); - - final LootCommand lc = new LootCommand(); - // Wolf - lc.wolfSvens = getInt("wolf", "svens"); - lc.wolfTeeth = getInt("wolf", "teeth"); - lc.wolfWheels = getInt("wolf", "wheel"); - lc.wolfSpirits = getInt("wolf", "spirit"); - lc.wolfBooks = getInt("wolf", "book"); - lc.wolfEggs = getInt("wolf", "egg"); - lc.wolfCoutures = getInt("wolf", "couture"); - lc.wolfBaits = getInt("wolf", "bait"); - lc.wolfFluxes = getInt("wolf", "flux"); - lc.wolfTime = getInt("wolf", "timeRNG"); - lc.wolfBosses = getInt("wolf", "bossRNG"); - // Spider - lc.spiderTarantulas = getInt("spider", "tarantulas"); - lc.spiderWebs = getInt("spider", "web"); - lc.spiderTAP = getInt("spider", "tap"); - lc.spiderBites = getInt("spider", "bite"); - lc.spiderCatalysts = getInt("spider", "catalyst"); - lc.spiderBooks = getInt("spider", "book"); - lc.spiderSwatters = getInt("spider", "swatter"); - lc.spiderTalismans = getInt("spider", "talisman"); - lc.spiderMosquitos = getInt("spider", "mosquito"); - lc.spiderTime = getInt("spider", "timeRNG"); - lc.spiderBosses = getInt("spider", "bossRNG"); - // Zombie - lc.zombieRevs = getInt("zombie", "revs"); - lc.zombieRevFlesh = getInt("zombie", "revFlesh"); - lc.zombieFoulFlesh = getInt("zombie", "foulFlesh"); - lc.zombiePestilences = getInt("zombie", "pestilence"); - lc.zombieUndeadCatas = getInt("zombie", "undeadCatalyst"); - lc.zombieBooks = getInt("zombie", "book"); - lc.zombieBeheadeds = getInt("zombie", "beheaded"); - lc.zombieRevCatas = getInt("zombie", "revCatalyst"); - lc.zombieSnakes = getInt("zombie", "snake"); - lc.zombieScythes = getInt("zombie", "scythe"); - lc.zombieTime = getInt("zombie", "timeRNG"); - lc.zombieBosses = getInt("zombie", "bossRNG"); - - final DisplayCommand ds = new DisplayCommand(); - ds.display = getString("misc", "display"); - } - -} diff --git a/Danker/handlers/ScoreboardHandler.java b/Danker/handlers/ScoreboardHandler.java deleted file mode 100644 index e89591b..0000000 --- a/Danker/handlers/ScoreboardHandler.java +++ /dev/null @@ -1,60 +0,0 @@ -package me.Danker.handlers; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.stream.Collectors; - -import com.google.common.collect.Iterables; -import com.google.common.collect.Lists; - -import net.minecraft.client.Minecraft; -import net.minecraft.scoreboard.Score; -import net.minecraft.scoreboard.ScoreObjective; -import net.minecraft.scoreboard.ScorePlayerTeam; -import net.minecraft.scoreboard.Scoreboard; -import net.minecraft.util.StringUtils; - -public class ScoreboardHandler { - - public static String cleanSB(String scoreboard) { - char[] nvString = StringUtils.stripControlCodes(scoreboard).toCharArray(); - StringBuilder cleaned = new StringBuilder(); - - for (char c : nvString) { - if ((int) c > 20 && (int) c < 127) { - cleaned.append(c); - } - } - - return cleaned.toString(); - } - - public static List<String> getSidebarLines() { - List<String> lines = new ArrayList<>(); - Scoreboard scoreboard = Minecraft.getMinecraft().theWorld.getScoreboard(); - if (scoreboard == null) return lines; - - ScoreObjective objective = scoreboard.getObjectiveInDisplaySlot(1); - if (objective == null) return lines; - - Collection<Score> scores = scoreboard.getSortedScores(objective); - List<Score> list = Lists.newArrayList(scores.stream() - .filter(input -> input != null && input.getPlayerName() != null && !input.getPlayerName() - .startsWith("#")) - .collect(Collectors.toList())); - - if (list.size() > 15) { - scores = Lists.newArrayList(Iterables.skip(list, scores.size() - 15)); - } else { - scores = list; - } - - for (Score score : scores) { - ScorePlayerTeam team = scoreboard.getPlayersTeam(score.getPlayerName()); - lines.add(ScorePlayerTeam.formatPlayerName(team, score.getPlayerName())); - } - - return lines; - } -} diff --git a/Danker/handlers/TextRenderer.java b/Danker/handlers/TextRenderer.java deleted file mode 100644 index 262f932..0000000 --- a/Danker/handlers/TextRenderer.java +++ /dev/null @@ -1,13 +0,0 @@ -package me.Danker.handlers; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.Gui; - -public class TextRenderer extends Gui { - public TextRenderer(Minecraft mc, String text, int x, int y, int colour) { - y -= mc.fontRendererObj.FONT_HEIGHT; - for (String line : text.split("\n")) { - drawString(mc.fontRendererObj, line, x, y += mc.fontRendererObj.FONT_HEIGHT, colour); - } - } -} |