diff options
author | Cow <cow@volloeko.de> | 2021-01-02 03:21:27 +0100 |
---|---|---|
committer | Cow <cow@volloeko.de> | 2021-01-02 03:21:27 +0100 |
commit | f518b342c68d17b4a826984808995b51fe132517 (patch) | |
tree | 4b4feb32cce0b5b983252cb4d01dbfb08c9b83de /src/main/java/de | |
parent | a62c6c1484eaf7bd03110e34a7522ca87fd86a6d (diff) | |
download | Cowlection-f518b342c68d17b4a826984808995b51fe132517.tar.gz Cowlection-f518b342c68d17b4a826984808995b51fe132517.tar.bz2 Cowlection-f518b342c68d17b4a826984808995b51fe132517.zip |
Implemented feedback from 0.12.0 pre-release
- Dungeon Party Finder: only lookup party members after *successfully* joining a party
- Various small changes to several features
- Added a few more config options
Diffstat (limited to 'src/main/java/de')
8 files changed, 164 insertions, 80 deletions
diff --git a/src/main/java/de/cowtipper/cowlection/command/MooCommand.java b/src/main/java/de/cowtipper/cowlection/command/MooCommand.java index b5768fb..763a2c7 100644 --- a/src/main/java/de/cowtipper/cowlection/command/MooCommand.java +++ b/src/main/java/de/cowtipper/cowlection/command/MooCommand.java @@ -123,36 +123,56 @@ public class MooCommand extends CommandBase { } else if (args[0].equalsIgnoreCase("whatyearisit") || args[0].equalsIgnoreCase("year")) { long year = ((System.currentTimeMillis() - 1560275700000L) / (TimeUnit.HOURS.toMillis(124))) + 1; main.getChatHelper().sendMessage(EnumChatFormatting.YELLOW, "It is SkyBlock year " + EnumChatFormatting.GOLD + year + EnumChatFormatting.YELLOW + "."); - } else if (args[0].equalsIgnoreCase("worldage")) { - long worldTime = Minecraft.getMinecraft().theWorld.getWorldTime(); - new TickDelay(() -> { - WorldClient world = Minecraft.getMinecraft().theWorld; - if (world == null) { - return; + } else if (args[0].equalsIgnoreCase("worldage") || args[0].equalsIgnoreCase("serverage")) { + if (args.length == 2) { + boolean enable; + switch (args[1]) { + case "on": + case "enable": + enable = true; + break; + case "off": + case "disable": + enable = false; + break; + default: + main.getChatHelper().sendMessage(EnumChatFormatting.RED, "Command usage: /" + getCommandName() + " worldage [on|off]"); + return; } - String msgPrefix; - long worldTime2 = world.getWorldTime(); - if (worldTime > worldTime2 || (worldTime2 - worldTime) < 15) { - // time is frozen - worldTime2 = world.getTotalWorldTime(); - msgPrefix = "World time seems to be frozen at around " + worldTime + " ticks. "; - if (worldTime2 > 24 * 60 * 60 * 20) { - // total world time >24h - main.getChatHelper().sendMessage(EnumChatFormatting.GOLD, msgPrefix + "However, how long this world is loaded cannot be determined."); + MooConfig.notifyServerAge = enable; + main.getChatHelper().sendMessage(EnumChatFormatting.GREEN, "✔ " + (enable ? EnumChatFormatting.DARK_GREEN + "Enabled" : EnumChatFormatting.RED + "Disabled") + EnumChatFormatting.GREEN + " world age notifications."); + main.getConfig().syncFromFields(); + } else { + long worldTime = Minecraft.getMinecraft().theWorld.getWorldTime(); + new TickDelay(() -> { + WorldClient world = Minecraft.getMinecraft().theWorld; + if (world == null) { return; } - msgPrefix += "However, this world is probably"; - } else { - msgPrefix = "This world is"; - } - long days = worldTime2 / 24000L + 1; - long minutes = days * 20; - long hours = minutes / 60; - minutes -= hours * 60; - - main.getChatHelper().sendMessage(EnumChatFormatting.YELLOW, msgPrefix + " loaded around " + EnumChatFormatting.GOLD + days + " ingame days " - + EnumChatFormatting.YELLOW + "(= less than" + EnumChatFormatting.GOLD + (hours > 0 ? " " + hours + " hours" : "") + (minutes > 0 ? " " + minutes + " mins" : "") + ")"); - }, 20); + String msgPrefix; + long worldTime2 = world.getWorldTime(); + if (worldTime > worldTime2 || (worldTime2 - worldTime) < 15) { + // time is frozen + worldTime2 = world.getTotalWorldTime(); + msgPrefix = "World time seems to be frozen at around " + worldTime + " ticks. "; + if (worldTime2 > 24 * 60 * 60 * 20) { + // total world time >24h + main.getChatHelper().sendMessage(EnumChatFormatting.GOLD, msgPrefix + "However, how long this world is loaded cannot be determined."); + return; + } + msgPrefix += "However, this world is probably"; + } else { + msgPrefix = "This world is"; + } + long days = worldTime2 / 24000L + 1; + long minutes = days * 20; + long hours = minutes / 60; + minutes -= hours * 60; + + main.getChatHelper().sendMessage(EnumChatFormatting.YELLOW, msgPrefix + " loaded around " + EnumChatFormatting.GOLD + days + " ingame days " + + EnumChatFormatting.YELLOW + "(= less than" + EnumChatFormatting.GOLD + (hours > 0 ? " " + hours + " hours" : "") + (minutes > 0 ? " " + minutes + " mins" : "") + ")"); + }, 20); + } } //endregion //region sub-commands: update mod @@ -812,6 +832,7 @@ public class MooCommand extends CommandBase { private void sendCommandUsage(ICommandSender sender) { IChatComponent usage = new MooChatComponent("➜ " + Cowlection.MODNAME + " commands:").gold().bold() .appendSibling(createCmdHelpEntry("config", "Open mod's configuration")) + .appendSibling(new MooChatComponent("\n").reset().white().appendText(EnumChatFormatting.DARK_GREEN + " ❢" + EnumChatFormatting.LIGHT_PURPLE + EnumChatFormatting.ITALIC + " To move the Dungeons overlay: " + EnumChatFormatting.WHITE + "/" + getCommandName() + " config " + EnumChatFormatting.GRAY + "➡ " + EnumChatFormatting.WHITE + "SB Dungeons " + EnumChatFormatting.GRAY + "➡ " + EnumChatFormatting.WHITE + "Performance Overlay")) .appendSibling(new MooChatComponent("\n").reset().gray().appendText(EnumChatFormatting.DARK_GREEN + " ❢" + EnumChatFormatting.GRAY + EnumChatFormatting.ITALIC + " Commands marked with §d§l⚷" + EnumChatFormatting.GRAY + EnumChatFormatting.ITALIC + " require a valid API key")) .appendSibling(createCmdHelpSection(1, "Best friends, friends & other players")) .appendSibling(createCmdHelpEntry("stalk", "Get info of player's status §d§l⚷")) @@ -861,7 +882,7 @@ public class MooCommand extends CommandBase { return getListOfStringsMatchingLastWord(args, /* Best friends, friends & other players */ "stalk", "add", "remove", "list", "online", "nameChangeCheck", /* SkyBlock */ "stalkskyblock", "skyblockstalk", "analyzeIsland", "dungeon", - /* miscellaneous */ "config", "search", "worldage", "guiscale", "rr", "shrug", "apikey", + /* miscellaneous */ "config", "search", "worldage", "serverage", "guiscale", "rr", "shrug", "apikey", /* update mod */ "update", "updateHelp", "version", "directory", /* help */ "help", /* rarely used aliases */ "askPolitelyWhereTheyAre", "askPolitelyAboutTheirSkyBlockProgress", "year", "whatyearisit"); @@ -869,6 +890,8 @@ public class MooCommand extends CommandBase { return getListOfStringsMatchingLastWord(args, main.getFriendsHandler().getBestFriends()); } else if (args.length == 2 && args[0].equalsIgnoreCase("dungeon")) { return getListOfStringsMatchingLastWord(args, "party", "enter", "leave"); + } else if (args.length == 2 && (args[0].equalsIgnoreCase("worldage") || args[0].equalsIgnoreCase("serverage"))) { + return getListOfStringsMatchingLastWord(args, "off", "on", "disable", "enable"); } String commandArg = args[0].toLowerCase(); if (args.length == 2 && (commandArg.equals("s") || commandArg.equals("ss") || commandArg.equals("namechangecheck") || commandArg.contains("stalk") || commandArg.contains("askpolitely"))) { // stalk & stalkskyblock + namechangecheck diff --git a/src/main/java/de/cowtipper/cowlection/config/MooConfig.java b/src/main/java/de/cowtipper/cowlection/config/MooConfig.java index 63856af..2510820 100644 --- a/src/main/java/de/cowtipper/cowlection/config/MooConfig.java +++ b/src/main/java/de/cowtipper/cowlection/config/MooConfig.java @@ -12,6 +12,7 @@ import de.cowtipper.cowlection.util.Utils; import net.minecraft.client.Minecraft; import net.minecraft.client.audio.SoundCategory; import net.minecraft.command.ICommand; +import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTTagInt; import net.minecraft.nbt.NBTTagString; @@ -67,19 +68,23 @@ public class MooConfig { private static String enableSkyBlockOnlyFeatures; public static int notifyFreshServer; public static int notifyOldServer; + public static boolean notifyServerAge; public static int tooltipToggleKeyBinding; - private static String tooltipAuctionHousePriceEach; - private static String bazaarConnectGraphsNodes; private static String tooltipItemAge; public static boolean tooltipItemAgeShortened; private static String tooltipItemTimestamp; private static String numeralSystem; + private static String tooltipAuctionHousePriceEach; + private static String bazaarConnectGraphsNodes; + public static int bazaarConnectGraphsLineWidth; private static int lookupWikiKeyBinding; private static int lookupPriceKeyBinding; + public static boolean lookupItemDirectly; // Category: SkyBlock Dungeons private static String showItemQualityAndFloor; private static String dungItemQualityPos; public static int dungItemToolTipToggleKeyBinding; + public static boolean dungSendPerformanceOnDeath; public static boolean dungOverlayEnabled; public static int dungOverlayPositionX; public static int dungOverlayPositionY; @@ -313,6 +318,8 @@ public class MooConfig { "notifyFreshServer", 1, "Notify when a world is loaded <X ingame days", 0, 40)); Property propNotifyOldServer = subCat.addConfigEntry(cfg.get(configCat.getConfigName(), "notifyOldServer", 30, "Notify when a world is loaded >X ingame days", 0, 40)); + Property propNotifyServerAge = subCat.addConfigEntry(cfg.get(configCat.getConfigName(), + "notifyServerAge", true, "Show server age notifications?")); // Sub-Category: Tooltip enhancements subCat = configCat.addSubCategory("Tooltip enhancements"); @@ -320,21 +327,6 @@ public class MooConfig { Property propTooltipToggleKeyBinding = subCat.addConfigEntry(cfg.get(configCat.getConfigName(), "tooltipToggleKeyBinding", Keyboard.KEY_LSHIFT, "Key to toggle tooltip")); - Property propTooltipAuctionHousePriceEach = subCat.addConfigEntry(cfg.get(configCat.getConfigName(), - "tooltipAuctionHousePriceEach", "always", "Add price per item if multiple items are bought or sold", new String[]{"always", "key press", "never"})); - - MooConfigPreview bazaarGraphPreview = new MooConfigPreview(MooConfigPreview.createDemoItem("paper", "§aBuy Price §731d §77d §e24h", new String[]{ - "§7The price at which buy orders have been filled.", "", - "§r┌----------------------------------------------┐", "§r│§66. 1k§r+§bxxxxxx§8·································§bxx§r│", - "§r│§8····§r│§8······································§bx§8··§r│", "§r│§66. 1k§r+§8·····§bx§8···················§bx§8·······§bxxxxx§8···§r│", - "§r│§8····§r│§8···············§bx§8········§bxxxxxxxxx§8········§r│", "§r│§8··§66k§r+§8··············§bx§8····§bxx§8··§bx§8·················§r│", - "§r│§8····§r│§8············§bx§8··§bxxxx§8·§bxxx§8··················§r│", "§r│§8··§66k§r+§8······§bx§8·§bxxxx§8·§bx§8···························§r│", - "§r│§8····§r│§8·······§bx§8·································§r│", "§r│§8··§66k§r+---------+----------+---------+---------+│", - "§r│§8····§r24h§8······§r18h§8········§r12h§8·······§r6h§8·······§rnow│", "§r└----------------------------------------------┘"}, Maps.newHashMap())); - Property propBazaarConnectGraphsNodes = subCat.addConfigEntry(cfg.get(configCat.getConfigName(), - "bazaarConnectGraphsNodes", "always", "Bazaar: connect the graph nodes", new String[]{"always", "key press", "never"}), - bazaarGraphPreview); - Map<String, NBTBase> demoItemExtraAttributes = new HashMap<>(); demoItemExtraAttributes.put("new_years_cake", new NBTTagInt(1)); demoItemExtraAttributes.put("originTag", new NBTTagString("REWARD_NEW_YEARS_CAKE_NPC")); @@ -356,6 +348,29 @@ public class MooConfig { Property propNumeralSystem = subCat.addConfigEntry(cfg.get(configCat.getConfigName(), "numeralSystem", "Arabic: 1, 4, 10", "Use Roman or Arabic numeral system?", new String[]{"Arabic: 1, 4, 10", "Roman: I, IV, X"})); + Map<String, NBTBase> demoAhItemExtraAttributes = new HashMap<>(); + demoItemExtraAttributes.put("id", new NBTTagString("BEACON")); + ItemStack demoAhItem = MooConfigPreview.createDemoItem("beacon", "§764x §fB§8e§facon Block", new String[]{"§f§lCOMMON", "§8§m-----------------", "§7Seller: §6[MVP§0++§6] Enlightener", "§7Buy it now: §63,900,000 coins", "", "§7Ends in: §e13h 33m 37s", "", "§eDon't click to inspect!"}, demoAhItemExtraAttributes); + demoAhItem.stackSize = 64; + MooConfigPreview ahItemPreview = new MooConfigPreview(demoAhItem); + Property propTooltipAuctionHousePriceEach = subCat.addConfigEntry(cfg.get(configCat.getConfigName(), + "tooltipAuctionHousePriceEach", "always", "Add price per item if multiple items are bought or sold", new String[]{"always", "key press", "never"}), ahItemPreview); + + MooConfigPreview bazaarGraphPreview = new MooConfigPreview(MooConfigPreview.createDemoItem("paper", "§aBuy Price §731d §77d §e24h", new String[]{ + "§7The price at which buy orders have been filled.", "", + "§r┌----------------------------------------------┐", "§r│§66. 1k§r+§bxxxxxx§8·································§bxx§r│", + "§r│§8····§r│§8······································§bx§8··§r│", "§r│§66. 1k§r+§8·····§bx§8···················§bx§8·······§bxxxxx§8···§r│", + "§r│§8····§r│§8···············§bx§8········§bxxxxxxxxx§8········§r│", "§r│§8··§66k§r+§8··············§bx§8····§bxx§8··§bx§8·················§r│", + "§r│§8····§r│§8············§bx§8··§bxxxx§8·§bxxx§8··················§r│", "§r│§8··§66k§r+§8······§bx§8·§bxxxx§8·§bx§8···························§r│", + "§r│§8····§r│§8·······§bx§8·································§r│", "§r│§8··§66k§r+---------+----------+---------+---------+│", + "§r│§8····§r24h§8······§r18h§8········§r12h§8·······§r6h§8·······§rnow│", "§r└----------------------------------------------┘"}, Maps.newHashMap())); + Property propBazaarConnectGraphsNodes = subCat.addConfigEntry(cfg.get(configCat.getConfigName(), + "bazaarConnectGraphsNodes", "always", "Bazaar: connect the graph nodes", new String[]{"always", "key press", "never"}), + bazaarGraphPreview); + + Property propBazaarConnectGraphsLineWidth = subCat.addConfigEntry(cfg.get(configCat.getConfigName(), + "bazaarConnectGraphsLineWidth", 3, "Line width of bazaar graph", 1, 10)); + // Sub-Category: Item lookup subCat = configCat.addSubCategory("Item lookup"); subCat.addExplanations("Lookup item prices or wiki articles for any SkyBlock item in any inventory."); @@ -365,6 +380,9 @@ public class MooConfig { Property propLookupPriceKeyBinding = subCat.addConfigEntry(cfg.get(configCat.getConfigName(), "lookupPriceKeyBinding", Keyboard.KEY_P, "Key to lookup item price")); + Property propLookupItemDirectly = subCat.addConfigEntry(cfg.get(configCat.getConfigName(), + "lookupItemDirectly", true, "Open website directly?")); + // Category: SkyBlock Dungeons configCat = new MooConfigCategory("SkyBlock Dungeons", "skyblockdungeons"); configCat.setMenuDisplayName("SB Dungeons"); @@ -402,6 +420,9 @@ public class MooConfig { " ‣ bonus score " + EnumChatFormatting.GRAY + "(+1 [max 5] for each destroyed crypt; if 'enhanced tab list' is disabled: limited to ~50 blocks away from the player)", "Does " + EnumChatFormatting.ITALIC + "not" + EnumChatFormatting.RESET + " track explorer score " + EnumChatFormatting.GRAY + "(explored rooms, secrets, ...)"); + Property propDungSendPerformanceOnDeath = subCat.addConfigEntry(cfg.get(configCat.getConfigName(), + "dungSendPerformanceOnDeath", true, "Send dungeon performance after a player died?")); + Property propDungOverlayEnabled = subCat.addConfigEntry(cfg.get(configCat.getConfigName(), "dungOverlayEnabled", true, "Enable Dungeon performance overlay?")); @@ -449,7 +470,7 @@ public class MooConfig { "dungPartyFinderPlayerLookup", "as a tooltip", "Show armor + dungeons stats of player joining via party finder as a tooltip or in chat?", new String[]{"as a tooltip", "in chat", "disabled"})); Property propDungPartyFinderPartyLookup = subCat.addConfigEntry(cfg.get(configCat.getConfigName(), - "dungPartyFinderPartyLookup", false, "Lookup info when joining another party?")); + "dungPartyFinderPartyLookup", true, "Lookup info when joining another party?")); Property propDungPartiesSize = subCat.addConfigEntry(cfg.get(configCat.getConfigName(), "dungPartiesSize", true, "Show size of parties?"), @@ -509,19 +530,23 @@ public class MooConfig { enableSkyBlockOnlyFeatures = propEnableSkyBlockOnlyFeatures.getString(); notifyFreshServer = propNotifyFreshServer.getInt(); notifyOldServer = propNotifyOldServer.getInt(); + notifyServerAge = propNotifyServerAge.getBoolean(); tooltipToggleKeyBinding = propTooltipToggleKeyBinding.getInt(); - tooltipAuctionHousePriceEach = propTooltipAuctionHousePriceEach.getString(); - bazaarConnectGraphsNodes = propBazaarConnectGraphsNodes.getString(); tooltipItemAge = propTooltipItemAge.getString(); tooltipItemAgeShortened = propTooltipItemAgeShortened.getBoolean(); tooltipItemTimestamp = propTooltipItemTimestamp.getString(); numeralSystem = propNumeralSystem.getString(); + tooltipAuctionHousePriceEach = propTooltipAuctionHousePriceEach.getString(); + bazaarConnectGraphsNodes = propBazaarConnectGraphsNodes.getString(); + bazaarConnectGraphsLineWidth = propBazaarConnectGraphsLineWidth.getInt(); lookupWikiKeyBinding = propLookupWikiKeyBinding.getInt(); lookupPriceKeyBinding = propLookupPriceKeyBinding.getInt(); + lookupItemDirectly = propLookupItemDirectly.getBoolean(); // Category: SkyBlock Dungeons showItemQualityAndFloor = propShowItemQualityAndFloor.getString(); dungItemQualityPos = propDungItemQualityPos.getString(); dungItemToolTipToggleKeyBinding = propDungItemToolTipToggleKeyBinding.getInt(); + dungSendPerformanceOnDeath = propDungSendPerformanceOnDeath.getBoolean(); dungOverlayEnabled = propDungOverlayEnabled.getBoolean(); dungOverlayPositionX = propDungOverlayPositionX.getInt(); dungOverlayPositionY = propDungOverlayPositionY.getInt(); @@ -566,19 +591,23 @@ public class MooConfig { propEnableSkyBlockOnlyFeatures.set(enableSkyBlockOnlyFeatures); propNotifyFreshServer.set(notifyFreshServer); propNotifyOldServer.set(notifyOldServer); + propNotifyServerAge.set(notifyServerAge); propTooltipToggleKeyBinding.set(tooltipToggleKeyBinding); - propTooltipAuctionHousePriceEach.set(tooltipAuctionHousePriceEach); - propBazaarConnectGraphsNodes.set(bazaarConnectGraphsNodes); propTooltipItemAge.set(tooltipItemAge); propTooltipItemAgeShortened.set(tooltipItemAgeShortened); propTooltipItemTimestamp.set(tooltipItemTimestamp); propNumeralSystem.set(numeralSystem); + propTooltipAuctionHousePriceEach.set(tooltipAuctionHousePriceEach); + propBazaarConnectGraphsNodes.set(bazaarConnectGraphsNodes); + propBazaarConnectGraphsLineWidth.set(bazaarConnectGraphsLineWidth); propLookupWikiKeyBinding.set(lookupWikiKeyBinding); propLookupPriceKeyBinding.set(lookupPriceKeyBinding); + propLookupItemDirectly.set(lookupItemDirectly); // Category: SkyBlock Dungeons propShowItemQualityAndFloor.set(showItemQualityAndFloor); propDungItemQualityPos.set(dungItemQualityPos); propDungItemToolTipToggleKeyBinding.set(dungItemToolTipToggleKeyBinding); + propDungSendPerformanceOnDeath.set(dungSendPerformanceOnDeath); propDungOverlayEnabled.set(dungOverlayEnabled); propDungOverlayPositionX.set(dungOverlayPositionX); propDungOverlayPositionY.set(dungOverlayPositionY); diff --git a/src/main/java/de/cowtipper/cowlection/handler/DungeonCache.java b/src/main/java/de/cowtipper/cowlection/handler/DungeonCache.java index e06ba7d..cfacd9d 100644 --- a/src/main/java/de/cowtipper/cowlection/handler/DungeonCache.java +++ b/src/main/java/de/cowtipper/cowlection/handler/DungeonCache.java @@ -3,6 +3,8 @@ package de.cowtipper.cowlection.handler; import com.google.common.collect.ComparisonChain; import com.google.common.collect.Ordering; import de.cowtipper.cowlection.Cowlection; +import de.cowtipper.cowlection.config.MooConfig; +import de.cowtipper.cowlection.listener.skyblock.DungeonsPartyListener; import de.cowtipper.cowlection.util.TickDelay; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiPlayerTabOverlay; @@ -33,6 +35,7 @@ public class DungeonCache { private long lastScoreboardCheck; private long nextPerformanceSend; private String queuedFloor; + private List<String> potentialPartyMembers; public DungeonCache(Cowlection main) { this.main = main; @@ -156,7 +159,18 @@ public class DungeonCache { } } + public void lookupPartyMembers() { + if (potentialPartyMembers.size() > 0) { + new DungeonsPartyListener(main, potentialPartyMembers); + potentialPartyMembers.clear(); + } + } + // setter/adder + public void setPotentialPartyMembers(List<String> potentialPartyMembers) { + this.potentialPartyMembers = potentialPartyMembers; + } + public void setQueuedFloor(String floorNr) { this.queuedFloor = floorNr; } @@ -170,7 +184,9 @@ public class DungeonCache { int previousPlayerDeaths = deathCounter.getOrDefault(playerName, 0); deathCounter.put(playerName, previousPlayerDeaths + 1); - new TickDelay(this::sendDungeonPerformance, 1); + if (MooConfig.dungSendPerformanceOnDeath) { + new TickDelay(this::sendDungeonPerformance, 1); + } } public void revivedPlayer(String playerName) { diff --git a/src/main/java/de/cowtipper/cowlection/listener/ChatListener.java b/src/main/java/de/cowtipper/cowlection/listener/ChatListener.java index 43f49fe..0240938 100644 --- a/src/main/java/de/cowtipper/cowlection/listener/ChatListener.java +++ b/src/main/java/de/cowtipper/cowlection/listener/ChatListener.java @@ -176,11 +176,16 @@ public class ChatListener { messageSender = partyOrGameInviteMatcher.group(1); } else if (dungeonPartyFinderJoinedMatcher.find()) { messageSender = dungeonPartyFinderJoinedMatcher.group(1); - if (CredentialStorage.isMooValid && !messageSender.equals(Minecraft.getMinecraft().thePlayer.getName()) - && MooConfig.getDungPartyFinderPlayerLookupDisplay() != MooConfig.Setting.DISABLED) { - // another player joined via Dungeon Party Finder - String dungeonClass = dungeonPartyFinderJoinedMatcher.group(2) + " Lvl " + dungeonPartyFinderJoinedMatcher.group(3); - getDungeonPartyMemberDetails(messageSender, dungeonClass); + if (CredentialStorage.isMooValid) { + boolean joinedYourself = messageSender.equals(Minecraft.getMinecraft().thePlayer.getName()); + if (!joinedYourself && MooConfig.getDungPartyFinderPlayerLookupDisplay() != MooConfig.Setting.DISABLED) { + // another player joined via Dungeon Party Finder + String dungeonClass = dungeonPartyFinderJoinedMatcher.group(2) + " Lvl " + dungeonPartyFinderJoinedMatcher.group(3); + getDungeonPartyMemberDetails(messageSender, dungeonClass); + } else if (joinedYourself && MooConfig.dungPartyFinderPartyLookup) { + // successfully joined another party via Dungeon Party Finder + main.getDungeonCache().lookupPartyMembers(); + } } } diff --git a/src/main/java/de/cowtipper/cowlection/listener/PlayerListener.java b/src/main/java/de/cowtipper/cowlection/listener/PlayerListener.java index 31d2d73..5e1ad0b 100644 --- a/src/main/java/de/cowtipper/cowlection/listener/PlayerListener.java +++ b/src/main/java/de/cowtipper/cowlection/listener/PlayerListener.java @@ -188,7 +188,7 @@ public class PlayerListener { private void checkWorldAge() { WorldClient theWorld = Minecraft.getMinecraft().theWorld; - if (MooConfig.notifyFreshServer == 0 && MooConfig.notifyOldServer == 0 || theWorld == null) { + if (!MooConfig.notifyServerAge || MooConfig.notifyFreshServer == 0 && MooConfig.notifyOldServer == 0 || theWorld == null) { return; } long worldTime = theWorld.getWorldTime(); diff --git a/src/main/java/de/cowtipper/cowlection/listener/skyblock/DungeonsListener.java b/src/main/java/de/cowtipper/cowlection/listener/skyblock/DungeonsListener.java index 5a65a36..27da9f0 100644 --- a/src/main/java/de/cowtipper/cowlection/listener/skyblock/DungeonsListener.java +++ b/src/main/java/de/cowtipper/cowlection/listener/skyblock/DungeonsListener.java @@ -501,9 +501,7 @@ public class DungeonsListener { partyMembers.add(playerDetailMatcher.group(1)); } } - if (partyMembers.size() > 0) { - new DungeonsPartyListener(main, partyMembers); - } + main.getDungeonCache().setPotentialPartyMembers(partyMembers); } } } else if (inventory.getName().equals("Group Builder")) { diff --git a/src/main/java/de/cowtipper/cowlection/listener/skyblock/SkyBlockListener.java b/src/main/java/de/cowtipper/cowlection/listener/skyblock/SkyBlockListener.java index a8103bf..b53ef24 100644 --- a/src/main/java/de/cowtipper/cowlection/listener/skyblock/SkyBlockListener.java +++ b/src/main/java/de/cowtipper/cowlection/listener/skyblock/SkyBlockListener.java @@ -5,6 +5,7 @@ import de.cowtipper.cowlection.Cowlection; import de.cowtipper.cowlection.config.MooConfig; import de.cowtipper.cowlection.config.gui.MooConfigGui; import de.cowtipper.cowlection.util.GuiHelper; +import de.cowtipper.cowlection.util.MooChatComponent; import de.cowtipper.cowlection.util.Utils; import net.minecraft.client.Minecraft; import net.minecraft.client.audio.SoundCategory; @@ -31,6 +32,7 @@ import org.apache.commons.lang3.StringUtils; import org.lwjgl.input.Keyboard; import java.awt.*; +import java.io.UnsupportedEncodingException; import java.net.URI; import java.net.URLEncoder; import java.text.NumberFormat; @@ -102,12 +104,20 @@ public class SkyBlockListener { } else if ("CAKE_SOUL".equals(sbId)) { itemBaseName = EnumChatFormatting.LIGHT_PURPLE + "Cake Soul"; } + String link = buildLink(EnumChatFormatting.getTextWithoutFormattingCodes(itemBaseName).trim() + querySuffix, itemLookupType); + if (link == null) { + main.getChatHelper().sendMessage(EnumChatFormatting.RED, "Error: Your operating system doesn't support UTF-8? Huh?"); + return; + } + main.getChatHelper().sendMessage(new MooChatComponent(EnumChatFormatting.DARK_GREEN + " ➡ " + + EnumChatFormatting.GREEN + "Open" + (MooConfig.lookupItemDirectly ? "ing " : " ") + itemLookupType.getDescription() + " for " + itemBaseName).green() + .setUrl(link, itemLookupType.description + ": " + EnumChatFormatting.WHITE + link)); - main.getChatHelper().sendMessage(EnumChatFormatting.GREEN, "Opening " + itemLookupType.getDescription() + " for " + itemBaseName); - boolean success = openLink(EnumChatFormatting.getTextWithoutFormattingCodes(itemBaseName).trim() + querySuffix, itemLookupType); - if (!success) { - main.getChatHelper().sendMessage(EnumChatFormatting.RED, "Error: couldn't open your browser"); - Minecraft.getMinecraft().thePlayer.playSound("mob.villager.no", Minecraft.getMinecraft().gameSettings.getSoundLevel(SoundCategory.MASTER), 1.4f); + if (MooConfig.lookupItemDirectly) { + boolean success = openLink(link); + if (!success) { + main.getChatHelper().sendMessage(EnumChatFormatting.RED, "Error: couldn't open your browser"); + } } } else { // item is blacklisted from lookup @@ -154,12 +164,9 @@ public class SkyBlockListener { // remove unnecessary tooltip entries: dyed leather armor NBTTagCompound nbtDisplay = e.itemStack.getSubCompound("display", false); - if (nbtDisplay != null && nbtDisplay.hasKey("color", Constants.NBT.TAG_INT)) { - if (Minecraft.getMinecraft().gameSettings.advancedItemTooltips) { - e.toolTip.removeIf(line -> line.startsWith("Color: #")); - } else { - e.toolTip.removeIf(line -> line.equals(EnumChatFormatting.ITALIC + StatCollector.translateToLocal("item.dyed"))); - } + if (!Minecraft.getMinecraft().gameSettings.advancedItemTooltips + && nbtDisplay != null && nbtDisplay.hasKey("color", Constants.NBT.TAG_INT)) { + e.toolTip.removeIf(line -> line.equals(EnumChatFormatting.ITALIC + StatCollector.translateToLocal("item.dyed"))); } // remove unnecessary tooltip entries: enchantments (already added via lore) @@ -218,7 +225,7 @@ public class SkyBlockListener { // for auction house: show price for each item if multiple items are sold at once MooConfig.Setting tooltipAuctionHousePriceEachDisplay = MooConfig.getTooltipAuctionHousePriceEachDisplay(); if ((tooltipAuctionHousePriceEachDisplay == MooConfig.Setting.ALWAYS || tooltipAuctionHousePriceEachDisplay == MooConfig.Setting.SPECIAL && MooConfig.isTooltipToggleKeyBindingPressed()) - && e.entityPlayer.openContainer instanceof ContainerChest) { + && (e.entityPlayer.openContainer instanceof ContainerChest || Minecraft.getMinecraft().currentScreen instanceof MooConfigGui)) { int stackSize = e.itemStack.stackSize; if ((stackSize == 1 && !isSubmitBidItem(e.itemStack)) || e.toolTip.size() < 4) { // only 1 item or irrelevant tooltip - nothing to do here, abort! @@ -262,15 +269,20 @@ public class SkyBlockListener { } } - private boolean openLink(String itemName, ItemLookupType itemLookupType) { - String baseUrl = itemLookupType.getBaseUrl(); + private String buildLink(String itemName, ItemLookupType itemLookupType) { + try { + return itemLookupType.getBaseUrl() + URLEncoder.encode(itemName, "UTF-8"); + } catch (UnsupportedEncodingException ignored) { + } + return null; + } + + private boolean openLink(String link) { try { - String url = baseUrl + URLEncoder.encode(itemName, "UTF-8"); - Desktop.getDesktop().browse(new URI(url)); - main.getLogger().info("Opening url: " + url); + Desktop.getDesktop().browse(new URI(link)); return true; } catch (Throwable throwable) { - main.getLogger().error("Couldn't open link: " + baseUrl + itemName, throwable); + main.getLogger().error("Couldn't open link: " + link, throwable); return false; } } diff --git a/src/main/java/de/cowtipper/cowlection/util/GuiHelper.java b/src/main/java/de/cowtipper/cowlection/util/GuiHelper.java index decc579..fdaa9dc 100644 --- a/src/main/java/de/cowtipper/cowlection/util/GuiHelper.java +++ b/src/main/java/de/cowtipper/cowlection/util/GuiHelper.java @@ -1,5 +1,6 @@ package de.cowtipper.cowlection.util; +import de.cowtipper.cowlection.config.MooConfig; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.Gui; @@ -124,7 +125,7 @@ public final class GuiHelper extends GuiScreen { */ private void drawHoveringText(List<String> textLines, final int mouseX, final int mouseY, final int screenWidth, final int screenHeight, final int maxTextWidth, boolean drawGraph) { if (!textLines.isEmpty()) { - FontRenderer font = fontRendererAscii != null ? fontRendererAscii : fontRendererObj; + FontRenderer font = (drawGraph && fontRendererAscii != null) ? fontRendererAscii : fontRendererObj; GlStateManager.disableRescaleNormal(); RenderHelper.disableStandardItemLighting(); @@ -267,7 +268,7 @@ public final class GuiHelper extends GuiScreen { if (drawGraph) { GlStateManager.pushMatrix(); GlStateManager.clear(GL11.GL_DEPTH_BUFFER_BIT); - GL11.glLineWidth(6F); + GL11.glLineWidth(MooConfig.bazaarConnectGraphsLineWidth); GlStateManager.disableTexture2D(); GlStateManager.color(255 / 255F, 170 / 255F, 0 / 255F); WorldRenderer wr = Tessellator.getInstance().getWorldRenderer(); |