diff options
author | Cow <cow@volloeko.de> | 2022-10-10 22:59:28 +0200 |
---|---|---|
committer | Cow <cow@volloeko.de> | 2022-10-10 22:59:28 +0200 |
commit | a534e8f516515c9f790b2fd2071e7de088ad778c (patch) | |
tree | 11b50949ea6038369190f6dcb017f7ac7ccda46a /src/main/java | |
parent | 4261cab2d8056540712318586de5be4779ef49a3 (diff) | |
download | Cowlection-a534e8f516515c9f790b2fd2071e7de088ad778c.tar.gz Cowlection-a534e8f516515c9f790b2fd2071e7de088ad778c.tar.bz2 Cowlection-a534e8f516515c9f790b2fd2071e7de088ad778c.zip |
Changed a few bits and pieces
Diffstat (limited to 'src/main/java')
11 files changed, 69 insertions, 64 deletions
diff --git a/src/main/java/de/cowtipper/cowlection/command/MooCommand.java b/src/main/java/de/cowtipper/cowlection/command/MooCommand.java index 908f90b..aa31166 100644 --- a/src/main/java/de/cowtipper/cowlection/command/MooCommand.java +++ b/src/main/java/de/cowtipper/cowlection/command/MooCommand.java @@ -624,7 +624,7 @@ public class MooCommand extends CommandBase { // last save: Pair<String, String> fancyLastSave = activeProfile.getFancyLastSave(); sbStats.appendFreshSibling(new MooChatComponent.KeyValueChatComponent("Last profile save", fancyLastSave != null ? fancyLastSave.first() + " ago" : "unknown").setHover(new MooChatComponent.KeyValueTooltipComponent("Last profile save", fancyLastSave != null ? (fancyLastSave.second() == null ? "today" : fancyLastSave.second()) : "unknown") - .appendFreshSibling(new MooChatComponent("= last time " + (activeProfile.coopCount() == 0 ? stalkedPlayer.getName() : "someone " + EnumChatFormatting.RED + "from " + stalkedPlayer.getName() + "'s profile" + EnumChatFormatting.WHITE) + " has played SkyBlock.").white()))); + .appendFreshSibling(new MooChatComponent("= last time " + (activeProfile.coopCount() == 0 ? stalkedPlayer.getName() : EnumChatFormatting.RED + "someone from " + stalkedPlayer.getName() + "'s profile" + EnumChatFormatting.WHITE) + " has played SkyBlock.").white()))); main.getChatHelper().sendMessage(sbStats); } else { diff --git a/src/main/java/de/cowtipper/cowlection/command/exception/ThrowingConsumer.java b/src/main/java/de/cowtipper/cowlection/command/exception/ThrowingConsumer.java index 9eae1c3..b31c19d 100644 --- a/src/main/java/de/cowtipper/cowlection/command/exception/ThrowingConsumer.java +++ b/src/main/java/de/cowtipper/cowlection/command/exception/ThrowingConsumer.java @@ -29,7 +29,7 @@ public interface ThrowingConsumer<T> extends Consumer<T> { break; } } - handleException(e, new MooChatComponent(EnumChatFormatting.DARK_RED + "Something went wrong: " + EnumChatFormatting.RED + e.toString() + handleException(e, new MooChatComponent(EnumChatFormatting.DARK_RED + "Something went wrong: " + EnumChatFormatting.RED + e + (stackTraceInfo == null ? "" : EnumChatFormatting.GRAY + " (" + EnumChatFormatting.WHITE + "in " + EnumChatFormatting.GRAY + stackTraceInfo + EnumChatFormatting.GRAY + ")"))); } } diff --git a/src/main/java/de/cowtipper/cowlection/config/MooConfig.java b/src/main/java/de/cowtipper/cowlection/config/MooConfig.java index ee5f784..fa1ec29 100644 --- a/src/main/java/de/cowtipper/cowlection/config/MooConfig.java +++ b/src/main/java/de/cowtipper/cowlection/config/MooConfig.java @@ -325,7 +325,7 @@ public class MooConfig { // (not visible in config gui: has opened config? or: knows how to move the dungeon overlay?) Property propHasOpenedConfigGui = cfg.get(configCat.getConfigName(), - "hasOpenedConfigGui", false, "Already opened config gui?") + "hasOpenedConfigGui", false, "Already opened config gui?") .setShowInGui(false); // Sub-Category: API settings @@ -339,7 +339,7 @@ public class MooConfig { subCat = configCat.addSubCategory("Command settings"); propMooCmdAlias = subCat.addConfigEntry(cfg.get(configCat.getConfigName(), - "mooCmdAlias", "m", "Alias for /moo command") + "mooCmdAlias", "m", "Alias for /moo command") .setValidationPattern(Pattern.compile("^[A-Za-z]*$"))); Property propFixReplyCmd = subCat.addConfigEntry(cfg.get(configCat.getConfigName(), "fixReplyCmd", true, "Auto-replace /r?")); @@ -360,7 +360,7 @@ public class MooConfig { " ‣ Online best friends (if the best friend online checker is enabled)"); propTabCompletableNamesCommands = subCat.addConfigEntry(cfg.get(configCat.getConfigName(), - "tabCompletableNamesCommands", new String[]{"p", "ah", "ignore", "msg", "tell", "w", "boop", "profile", "friend", "friends"}, "List of commands with a Tab-completable username argument.") + "tabCompletableNamesCommands", new String[]{"p", "ah", "ignore", "msg", "tell", "w", "boop", "profile", "friend", "friends"}, "List of commands with a Tab-completable username argument.") .setValidationPattern(Pattern.compile("^[A-Za-z]+$"))); // Sub-Category: Other settings @@ -371,7 +371,7 @@ public class MooConfig { "logsDirs", resolveDefaultLogsDirs(), "Directories with Minecraft log files")); Property propDefaultStartDate = subCat.addConfigEntry(cfg.get(CATEGORY_LOGS_SEARCH, - "defaultStartDate", "3", "Default start date (a number means X months ago, alternatively a fixed date à la yyyy-mm-dd can be used)")) + "defaultStartDate", "3", "Default start date (a number means X months ago, alternatively a fixed date à la yyyy-mm-dd can be used)")) .setValidationPattern(Pattern.compile("^[1-9][0-9]{0,2}|(2[0-9]{3}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01]))$")); Property propMaxLogFileSize = subCat.addConfigEntry(cfg.get(CATEGORY_LOGS_SEARCH, "maxLogFileSize", 2048, "Max log file size (in KB)?", 50, 10000)); @@ -399,17 +399,17 @@ public class MooConfig { "Add someone to the best friends list with " + EnumChatFormatting.YELLOW + "/moo add <player>" + EnumChatFormatting.RESET); Property propShowBestFriendNotifications = subCat.addConfigEntry(cfg.get(configCat.getConfigName(), - "showBestFriendNotifications", true, "Set to true to receive best friends' login/logout messages, set to false hide them."), + "showBestFriendNotifications", true, "Set to true to receive best friends' login/logout messages, set to false hide them."), new MooConfigPreview(new ChatComponentText("§a§lBest friend §a> §6Cow §r§ejoined."))); Property propEnableBestFriendNotificationSound = subCat.addConfigEntry(cfg.get(configCat.getConfigName(), - "enableBestFriendNotificationSound", false, "Set to true to play a notification sound when a best friend comes online"), + "enableBestFriendNotificationSound", false, "Set to true to play a notification sound when a best friend comes online"), new MooConfigPreview("random.pop", Minecraft.getMinecraft().gameSettings.getSoundLevel(SoundCategory.MASTER), 1)); Property propShowFriendNotifications = subCat.addConfigEntry(cfg.get(configCat.getConfigName(), - "showFriendNotifications", true, "Set to true to receive friends' login/logout messages, set to false hide them."), + "showFriendNotifications", true, "Set to true to receive friends' login/logout messages, set to false hide them."), new MooConfigPreview(new ChatComponentText("§aFriend > §r§aBob §ejoined."))); Property propShowGuildNotifications = subCat.addConfigEntry(cfg.get(configCat.getConfigName(), - "showGuildNotifications", true, "Set to true to receive guild members' login/logout messages, set to false hide them."), + "showGuildNotifications", true, "Set to true to receive guild members' login/logout messages, set to false hide them."), new MooConfigPreview(new ChatComponentText("§2Guild > §r§7Herobrian §eleft."))); @@ -420,7 +420,7 @@ public class MooConfig { IChatComponent spacer = new MooChatComponent(", ").green(); Property propDoBestFriendsOnlineCheck = subCat.addConfigEntry(cfg.get(configCat.getConfigName(), - "doBestFriendsOnlineCheck", true, "Set to true to check best friends' online status when joining a server, set to false to disable."), + "doBestFriendsOnlineCheck", true, "Set to true to check best friends' online status when joining a server, set to false to disable."), new MooConfigPreview(new MooChatComponent("§a⬤ Online best friends (§24§a/§216§a): ") .appendSibling(MooConfigPreview.createDemoOnline("Alice", "Housing", "1 hour 13 minutes 37 seconds")).appendSibling(spacer) .appendSibling(MooConfigPreview.createDemoOnline("Bob", "Build Battle", "2 hours 13 minutes 37 seconds")).appendSibling(spacer) @@ -482,7 +482,7 @@ public class MooConfig { MooConfigPreview nonStackableItemPreview = new MooConfigPreview(MooConfigPreview.createDemoItem("cake", "§dNew Year Cake", new String[]{"§7Given to every player as a", "§7celebration for the 1st SkyBlock", "§7year!", "", "§d§lSPECIAL"}, demoItemExtraAttributes)); Property propTooltipItemAge = subCat.addConfigEntry(cfg.get(configCat.getConfigName(), - "tooltipItemAge", "always", "Show item age", new String[]{"always", "key press", "never"}), + "tooltipItemAge", "always", "Show item age", new String[]{"always", "key press", "never"}), nonStackableItemPreview); Property propTooltipItemAgeShortened = subCat.addConfigEntry(cfg.get(configCat.getConfigName(), @@ -506,14 +506,14 @@ public class MooConfig { "tooltipAuctionHousePriceEach", "always", "Add price per item if multiple items are bought or sold", new String[]{"always", "key press", "never"}), ahItemPreview); propTooltipAuctionHousePriceEachEnchantments = subCat.addConfigEntry(cfg.get(configCat.getConfigName(), - "tooltipAuctionHousePriceEachEnchantments", new String[]{"overload", "rejuvenate"}, "Price per lvl 1 book enchantment") + "tooltipAuctionHousePriceEachEnchantments", new String[]{"overload", "rejuvenate"}, "Price per lvl 1 book enchantment") .setValidationPattern(Pattern.compile("^[A-Za-z_ -]+$"))); Property propAuctionHouseMarkEndedAuctions = subCat.addConfigEntry(cfg.get(configCat.getConfigName(), "auctionHouseMarkEndedAuctions", "a letter", "Mark ended auctions", new String[]{"a letter", "a word", "disabled"})); Property propBazaarSellAllOrder = subCat.addConfigEntry(cfg.get(configCat.getConfigName(), - "bazaarSellAllOrder", "price (sum)", "Bazaar: sell all order", new String[]{"price (sum)", "item amount", "unordered", "price (each)"}), + "bazaarSellAllOrder", "price (sum)", "Bazaar: sell all order", new String[]{"price (sum)", "item amount", "unordered", "price (each)"}), new MooConfigPreview(MooConfigPreview.createDemoItem("chest", "§aSell Inventory Now", new String[]{"§7Instantly sell anything in", "§7your inventory that can be", "§7sold on the Bazaar.", "", " §a1§7x §aEnchanted Leather §7for §65,263.1 coins", " §a42§7x §fLeather §7for §6436.8 coins", " §a2§7x §fRabbit Hide §7for §642.0 coins", " §a79§7x §fRaw Beef §7for §6450.3 coins", " §a16§7x §aEnchanted Raw Beef §7for §69,867.2 coins", "", "§7You earn: §615,698 coins", "", "§eClick to sell!"}, Collections.emptyMap()))); Property propBazaarSellAllOrderAscDesc = subCat.addConfigEntry(cfg.get(configCat.getConfigName(), @@ -531,7 +531,7 @@ public class MooConfig { "§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"}), + "bazaarConnectGraphsNodes", "always", "Bazaar: connect the graph nodes", new String[]{"always", "key press", "never"}), bazaarGraphPreview); Property propBazaarConnectGraphsLineWidth = subCat.addConfigEntry(cfg.get(configCat.getConfigName(), @@ -544,7 +544,7 @@ public class MooConfig { "", "§7Families Found: §e75§6%", "§3---------------§f----- §b3§3/§b4"}, Maps.newHashMap())); Property propBestiaryOverviewOrder = subCat.addConfigEntry(cfg.get(configCat.getConfigName(), - "bestiaryOverviewOrder", "fewest kills", "Order of the Bestiary overview?", bestiaryOverviewOrderDefaultValues), + "bestiaryOverviewOrder", "fewest kills", "Order of the Bestiary overview?", bestiaryOverviewOrderDefaultValues), bestiaryOverviewPreview); // Sub-Category: Item lookup @@ -580,7 +580,7 @@ public class MooConfig { "showItemQualityAndFloor", "always", "show item quality + obtained floor?", new String[]{"always", "key press", "never"})); Property propDungItemQualityPos = subCat.addConfigEntry(cfg.get(configCat.getConfigName(), - "dungItemQualityPos", "top", "Position of item quality in tooltip", new String[]{"top", "bottom"}), + "dungItemQualityPos", "top", "Position of item quality in tooltip", new String[]{"top", "bottom"}), new MooConfigPreview( MooConfigPreview.createDungeonItem("light", "7/17/20 7:22 PM", "§7Gear Score: §d336 §8(526)", "§7Crit Chance: §c+5% §9(Light +2%)", "§7Crit Damage: §c+30% §9(Light +4%) §8(+48.9%)", "§7Bonus Attack Speed: §c+4% §9(Light +4%)", "", "§7Health: §a+126 HP §9(Light +15 HP) §8(+205.38 HP)", "§7Defense: §a+76 §9(Light +4) §8(+123.88)", "§7Speed: §a+4 §9(Light +4) §8(+6.52)", "", "§9Growth V, §9Protection V", "§9Thorns III", "", "§7Increase the damage you deal", "§7with arrows by §c5%§7.", "", "§6Full Set Bonus: Skeleton Soldier", "§7Increase the damage you deal", "§7with arrows by an extra §c25%§7.", "", "§aPerfect 52500 / 52500", "§5§lEPIC DUNGEON LEGGINGS"), MooConfigPreview.createDungeonItem("clean", "7/11/20 12:27 PM", "§7Gear Score: §d359 §8(561)", "§7Crit Chance: §c+11% §9(Clean +8%)", "§7Crit Damage: §c+26% §8(+42.38%)", "", "§7Health: §a+126 HP §9(Clean +15 HP) §8(+205.38 HP)", "§7Defense: §a+87 §9(Clean +15) §8(+141.81)", "", "§9Growth V, §9Protection V", "§9Thorns III", "", "§7Increase the damage you deal", "§7with arrows by §c5%§7.", "", "§6Full Set Bonus: Skeleton Soldier", "§7Increase the damage you deal", "§7with arrows by an extra §c25%§7.", "", "§aPerfect 52500 / 52500", "§5§lEPIC DUNGEON LEGGINGS"))); @@ -612,7 +612,7 @@ public class MooConfig { "dungOverlayEnabled", true, "Enable Dungeon performance overlay?")); Property propDungOverlayPositionX = subCat.addConfigEntry(cfg.get(configCat.getConfigName(), - "dungOverlayPositionX", 6, "Dungeon performance overlay position: x value", 0, 1000), + "dungOverlayPositionX", 6, "Dungeon performance overlay position: x value", 0, 1000), null, "‰", // per mille (slider) -> { MooConfig.dungOverlayPositionX = slider.getValueInt(); @@ -620,7 +620,7 @@ public class MooConfig { }); Property propDungOverlayPositionY = subCat.addConfigEntry(cfg.get(configCat.getConfigName(), - "dungOverlayPositionY", 200, "Dungeon performance overlay position: y value", 0, 1000), + "dungOverlayPositionY", 200, "Dungeon performance overlay position: y value", 0, 1000), null, "‰", // per mille (slider) -> { MooConfig.dungOverlayPositionY = slider.getValueInt(); @@ -628,7 +628,7 @@ public class MooConfig { }); Property propDungOverlayGuiScale = subCat.addConfigEntry(cfg.get(configCat.getConfigName(), - "dungOverlayGuiScale", 100, "Dungeon performance overlay GUI scale", 50, 200), + "dungOverlayGuiScale", 100, "Dungeon performance overlay GUI scale", 50, 200), null, "%", (slider) -> { MooConfig.dungOverlayGuiScale = slider.getValueInt(); @@ -665,57 +665,57 @@ public class MooConfig { "dungPartyFinderOverlayDrawBackground", true, "Party Finder: draw colored overlay?")); Property propDungPartiesSize = subCat.addConfigEntry(cfg.get(configCat.getConfigName(), - "dungPartiesSize", true, "Show size of parties?"), + "dungPartiesSize", true, "Show size of parties?"), new MooConfigPreview(new MooChatComponent("Marked with: " + EnumChatFormatting.WHITE + "1 - 4").gray())); Property propDungDungeonReqMin = subCat.addConfigEntry(cfg.get(configCat.getConfigName(), - "dungDungeonReqMin", 0, "Marks parties with lower Dungeon level req than this value") + "dungDungeonReqMin", 0, "Marks parties with lower Dungeon level req than this value") .setMinValue(0).setMaxValue(50), new MooConfigPreview(new MooChatComponent("Marked with: " + EnumChatFormatting.DARK_RED + EnumChatFormatting.BOLD + "ᐯ").gray())); Property propDungClassMin = subCat.addConfigEntry(cfg.get(configCat.getConfigName(), - "dungClassMin", 0, "Marks parties with members with lower class level than this value") + "dungClassMin", 0, "Marks parties with members with lower class level than this value") .setMinValue(0).setMaxValue(50), new MooConfigPreview(new MooChatComponent("Marked with: " + EnumChatFormatting.RED + EnumChatFormatting.BOLD + "ᐯ").gray())); Property propDungMarkPartiesWithArcher = subCat.addConfigEntry(cfg.get(configCat.getConfigName(), - "dungMarkPartiesWithArcher", "if dupe: " + EnumChatFormatting.GOLD + "⬛", "Mark parties with Archer class?", - new String[]{ - "if dupe: " + EnumChatFormatting.GOLD + "⬛", "always: " + EnumChatFormatting.GOLD + "⬛", - "if dupe: " + EnumChatFormatting.RED + "⬛", "always: " + EnumChatFormatting.RED + "⬛", - "do not mark"}), + "dungMarkPartiesWithArcher", "if dupe: " + EnumChatFormatting.GOLD + "⬛", "Mark parties with Archer class?", + new String[]{ + "if dupe: " + EnumChatFormatting.GOLD + "⬛", "always: " + EnumChatFormatting.GOLD + "⬛", + "if dupe: " + EnumChatFormatting.RED + "⬛", "always: " + EnumChatFormatting.RED + "⬛", + "do not mark"}), new MooConfigPreview(DataHelper.DungeonClass.ARCHER)); Property propDungMarkPartiesWithBerserk = subCat.addConfigEntry(cfg.get(configCat.getConfigName(), - "dungMarkPartiesWithBerserk", "do not mark", "Mark parties with Berserk class?", - new String[]{ - "if dupe: " + EnumChatFormatting.GOLD + "⬛", "always: " + EnumChatFormatting.GOLD + "⬛", - "if dupe: " + EnumChatFormatting.RED + "⬛", "always: " + EnumChatFormatting.RED + "⬛", - "do not mark"}), + "dungMarkPartiesWithBerserk", "do not mark", "Mark parties with Berserk class?", + new String[]{ + "if dupe: " + EnumChatFormatting.GOLD + "⬛", "always: " + EnumChatFormatting.GOLD + "⬛", + "if dupe: " + EnumChatFormatting.RED + "⬛", "always: " + EnumChatFormatting.RED + "⬛", + "do not mark"}), new MooConfigPreview(DataHelper.DungeonClass.BERSERK)); Property propDungMarkPartiesWithHealer = subCat.addConfigEntry(cfg.get(configCat.getConfigName(), - "dungMarkPartiesWithHealer", "do not mark", "Mark parties with Healer class?", - new String[]{ - "if dupe: " + EnumChatFormatting.GOLD + "⬛", "always: " + EnumChatFormatting.GOLD + "⬛", - "if dupe: " + EnumChatFormatting.RED + "⬛", "always: " + EnumChatFormatting.RED + "⬛", - "do not mark"}), + "dungMarkPartiesWithHealer", "do not mark", "Mark parties with Healer class?", + new String[]{ + "if dupe: " + EnumChatFormatting.GOLD + "⬛", "always: " + EnumChatFormatting.GOLD + "⬛", + "if dupe: " + EnumChatFormatting.RED + "⬛", "always: " + EnumChatFormatting.RED + "⬛", + "do not mark"}), new MooConfigPreview(DataHelper.DungeonClass.HEALER)); Property propDungMarkPartiesWithMage = subCat.addConfigEntry(cfg.get(configCat.getConfigName(), - "dungMarkPartiesWithMage", "do not mark", "Mark parties with Mage class?", - new String[]{ - "if dupe: " + EnumChatFormatting.GOLD + "⬛", "always: " + EnumChatFormatting.GOLD + "⬛", - "if dupe: " + EnumChatFormatting.RED + "⬛", "always: " + EnumChatFormatting.RED + "⬛", - "do not mark"}), + "dungMarkPartiesWithMage", "do not mark", "Mark parties with Mage class?", + new String[]{ + "if dupe: " + EnumChatFormatting.GOLD + "⬛", "always: " + EnumChatFormatting.GOLD + "⬛", + "if dupe: " + EnumChatFormatting.RED + "⬛", "always: " + EnumChatFormatting.RED + "⬛", + "do not mark"}), new MooConfigPreview(DataHelper.DungeonClass.MAGE)); Property propDungMarkPartiesWithTank = subCat.addConfigEntry(cfg.get(configCat.getConfigName(), - "dungMarkPartiesWithTank", "do not mark", "Mark parties with Tank class?", - new String[]{ - "if dupe: " + EnumChatFormatting.GOLD + "⬛", "always: " + EnumChatFormatting.GOLD + "⬛", - "if dupe: " + EnumChatFormatting.RED + "⬛", "always: " + EnumChatFormatting.RED + "⬛", - "do not mark"}), + "dungMarkPartiesWithTank", "do not mark", "Mark parties with Tank class?", + new String[]{ + "if dupe: " + EnumChatFormatting.GOLD + "⬛", "always: " + EnumChatFormatting.GOLD + "⬛", + "if dupe: " + EnumChatFormatting.RED + "⬛", "always: " + EnumChatFormatting.RED + "⬛", + "do not mark"}), new MooConfigPreview(DataHelper.DungeonClass.TANK)); Property propDungPartyFinderRuleEditorSimplified = subCat.addConfigEntry(cfg.get(configCat.getConfigName(), diff --git a/src/main/java/de/cowtipper/cowlection/data/HyPlayerData.java b/src/main/java/de/cowtipper/cowlection/data/HyPlayerData.java index 9046b72..5bb9a85 100644 --- a/src/main/java/de/cowtipper/cowlection/data/HyPlayerData.java +++ b/src/main/java/de/cowtipper/cowlection/data/HyPlayerData.java @@ -68,7 +68,7 @@ public class HyPlayerData { } /** - * Player's Rank prefix: https://github.com/HypixelDev/PublicAPI/wiki/Common-Questions#how-do-i-get-a-players-rank-prefix + * Player's Rank prefix: <a href="https://github.com/HypixelDev/PublicAPI/wiki/Common-Questions#how-do-i-get-a-players-rank-prefix">API Docs: How do I get a player's rank prefix?</a> * * @return formatted rank */ diff --git a/src/main/java/de/cowtipper/cowlection/listener/ChatListener.java b/src/main/java/de/cowtipper/cowlection/listener/ChatListener.java index 6e66ec5..18f50e9 100644 --- a/src/main/java/de/cowtipper/cowlection/listener/ChatListener.java +++ b/src/main/java/de/cowtipper/cowlection/listener/ChatListener.java @@ -36,10 +36,10 @@ public class ChatListener { * - §aFriend > §r§aNAME §r§eleft.§r * - §2Guild > §r§aNAME §r§eleft.§r */ - private static final Pattern LOGIN_LOGOUT_NOTIFICATION = Pattern.compile("^(?<type>§aFriend|§2Guild) > §r(?<rank>§[0-9a-f])(?<playerName>[\\w]+)(?<joinLeaveSuffix> §r§e(?<joinedLeft>joined|left)\\.)§r$"); + private static final Pattern LOGIN_LOGOUT_NOTIFICATION = Pattern.compile("^(?<type>§aFriend|§2Guild) > §r(?<rank>§[0-9a-f])(?<playerName>\\w+)(?<joinLeaveSuffix> §r§e(?<joinedLeft>joined|left)\\.)§r$"); private static final Pattern CHAT_MESSAGE_RECEIVED_PATTERN = Pattern.compile("^(?:Party|Guild) > (?:\\[.*?] )?(\\w+)(?: \\[.*?])?: "); private static final Pattern PRIVATE_MESSAGE_RECEIVED_PATTERN = Pattern.compile("^From (?:\\[.*?] )?(\\w+): "); - private static final Pattern PARTY_OR_GAME_INVITE_PATTERN = Pattern.compile("^[-]+\\s+(?:\\[.*?] )?(\\w+) has invited you "); + private static final Pattern PARTY_OR_GAME_INVITE_PATTERN = Pattern.compile("^-+\\s+(?:\\[.*?] )?(\\w+) has invited you "); private static final Pattern DUNGEON_FINDER_JOINED_PATTERN = Pattern.compile("^Dungeon Finder > (\\w+) joined the dungeon group! \\(([A-Z][a-z]+) Level (\\d+)\\)$"); private final Cowlection main; private String lastTypedChars = ""; 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 6c0815f..8adc188 100644 --- a/src/main/java/de/cowtipper/cowlection/listener/skyblock/DungeonsListener.java +++ b/src/main/java/de/cowtipper/cowlection/listener/skyblock/DungeonsListener.java @@ -99,8 +99,8 @@ public class DungeonsListener { * <li> ☠ You were killed by [mob] and became a ghost.</li> * </ul> */ - private final Pattern DUNGEON_DEATH_PATTERN = Pattern.compile("^ ☠ (\\w+) (?:.+) and became a ghost\\.$"); - private final Pattern DUNGEON_REVIVED_PATTERN = Pattern.compile("^ ❣ (\\w+) was revived(?:.*?)$"); + private final Pattern DUNGEON_DEATH_PATTERN = Pattern.compile("^ ☠ (\\w+) .+ and became a ghost\\.$"); + private final Pattern DUNGEON_REVIVED_PATTERN = Pattern.compile("^ ❣ (\\w+) was revived.*?$"); /** * Class milestones: * <ul> @@ -667,8 +667,7 @@ public class DungeonsListener { try { int floorNrArabic = Integer.parseInt(floorMatcher.group(3)); floorNr = Utils.convertArabicToRoman(floorNrArabic); // floor == [0-9]+ - } catch (NumberFormatException ex) { - floorNr = null; + } catch (NumberFormatException ignored) { } } main.getDungeonCache().setQueuedFloor(floorNr); 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 a75bc20..4f9b386 100644 --- a/src/main/java/de/cowtipper/cowlection/listener/skyblock/SkyBlockListener.java +++ b/src/main/java/de/cowtipper/cowlection/listener/skyblock/SkyBlockListener.java @@ -67,8 +67,8 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; public class SkyBlockListener { - private static final Pattern ITEM_COUNT_PREFIXED_PATTERN = Pattern.compile("^(?:§[0-9a-fl-or])*[\\d]+x "); - private static final Pattern ITEM_COUNT_SUFFIXED_PATTERN = Pattern.compile(" (?:§[0-9a-fl-or])*x[\\d]+$"); + private static final Pattern ITEM_COUNT_PREFIXED_PATTERN = Pattern.compile("^(?:§[0-9a-fl-or])*\\d+x "); + private static final Pattern ITEM_COUNT_SUFFIXED_PATTERN = Pattern.compile(" (?:§[0-9a-fl-or])*x\\d+$"); private static final Pattern PET_NAME_PATTERN = Pattern.compile("^§7\\[Lvl (\\d+)] (§[0-9a-f])"); private static final Pattern TIER_SUFFIX_PATTERN = Pattern.compile(" [IVX0-9]+$"); // example: " §a42§7x §fLeather §7for §6436.8 coins" @@ -607,7 +607,11 @@ public class SkyBlockListener { || toolTipLineUnformatted.startsWith("New bid: ") /* special case: 'Submit Bid' item */) { try { - long price = numberFormatter.parse(StringUtils.substringBetween(toolTipLineUnformatted, ": ", " coins")).longValue(); + String hopefullyAPrice = StringUtils.substringBetween(toolTipLineUnformatted, ": ", " coins"); + if (hopefullyAPrice == null) { + return; + } + long price = numberFormatter.parse(hopefullyAPrice).longValue(); double priceEach = price / (double) itemAmount; String formattedPriceEach = priceEach < 5000 ? numberFormatter.format(priceEach) : Utils.formatNumberWithAbbreviations(priceEach); if (superEnchantName != null) { diff --git a/src/main/java/de/cowtipper/cowlection/partyfinder/RuleEditorGui.java b/src/main/java/de/cowtipper/cowlection/partyfinder/RuleEditorGui.java index 23b725b..3c2650b 100644 --- a/src/main/java/de/cowtipper/cowlection/partyfinder/RuleEditorGui.java +++ b/src/main/java/de/cowtipper/cowlection/partyfinder/RuleEditorGui.java @@ -53,7 +53,7 @@ public class RuleEditorGui extends GuiScreen { colorCodesExplanation.add(EnumChatFormatting.BOLD + "Minecraft color codes:"); for (EnumChatFormatting chatFormatting : EnumChatFormatting.values()) { if (chatFormatting.isColor()) { - colorCodesExplanation.add(Utils.toHumanColorCodes(chatFormatting.toString()) + " → " + chatFormatting.toString() + chatFormatting.getFriendlyName()); + colorCodesExplanation.add(Utils.toHumanColorCodes(chatFormatting.toString()) + " → " + chatFormatting + chatFormatting.getFriendlyName()); } } } @@ -114,6 +114,8 @@ public class RuleEditorGui extends GuiScreen { EnumChatFormatting.GRAY + "plz,pls,help" + EnumChatFormatting.RESET + "\" matches \"" + EnumChatFormatting.GRAY + "plz" + EnumChatFormatting.RESET + "\", \"" + EnumChatFormatting.GRAY + "pls" + EnumChatFormatting.RESET + "\" and \"" + EnumChatFormatting.GRAY + "help" + EnumChatFormatting.RESET + "\""); helpTooltip.add(EnumChatFormatting.YELLOW + " ➊+➋ " + EnumChatFormatting.RESET + "combination of both " + EnumChatFormatting.YELLOW + "(,)" + EnumChatFormatting.RESET + ": for example \"" + EnumChatFormatting.GRAY + "carry( pls, plz)" + EnumChatFormatting.RESET + "\" matches \"" + EnumChatFormatting.GRAY + "carry" + EnumChatFormatting.RESET + "\", but not \"" + EnumChatFormatting.GRAY + "carry pls" + EnumChatFormatting.RESET + "\" or \"" + EnumChatFormatting.GRAY + "carry plz" + EnumChatFormatting.RESET + "\""); + helpTooltip.add(""); + helpTooltip.add(EnumChatFormatting.GRAY + "If you want to use Regular Expressions (regex), you can enable them via " + EnumChatFormatting.YELLOW + "/moo config regex"); drawHoveringText(helpTooltip, mouseX, mouseY); } else if (btnClose.isMouseOver()) { drawHoveringText(Arrays.asList(EnumChatFormatting.RED + "Save & Close", "" + EnumChatFormatting.GRAY + EnumChatFormatting.ITALIC + "Hint:" + EnumChatFormatting.RESET + " alternatively press ESC"), mouseX, mouseY); diff --git a/src/main/java/de/cowtipper/cowlection/util/ApiUtils.java b/src/main/java/de/cowtipper/cowlection/util/ApiUtils.java index 0695c1e..4e81004 100644 --- a/src/main/java/de/cowtipper/cowlection/util/ApiUtils.java +++ b/src/main/java/de/cowtipper/cowlection/util/ApiUtils.java @@ -28,7 +28,7 @@ import java.util.concurrent.Executors; public class ApiUtils { public static final String UUID_NOT_FOUND = "UUID-NOT-FOUND"; private static final String NAME_TO_UUID_URL = "https://api.mojang.com/users/profiles/minecraft/"; - private static final String UUID_TO_NAME_URL = "https://api.mojang.com/user/profile/%s"; + private static final String UUID_TO_NAME_URL = "https://sessionserver.mojang.com/session/minecraft/profile/%s"; private static final String ONLINE_STATUS_URL = "https://api.hypixel.net/status?key=%s&uuid=%s"; private static final String SKYBLOCK_STATS_URL = "https://api.hypixel.net/skyblock/profiles?key=%s&uuid=%s"; private static final String BAZAAR_URL = "https://api.hypixel.net/skyblock/bazaar"; diff --git a/src/main/java/de/cowtipper/cowlection/util/MooChatComponent.java b/src/main/java/de/cowtipper/cowlection/util/MooChatComponent.java index 856cbb3..5500345 100644 --- a/src/main/java/de/cowtipper/cowlection/util/MooChatComponent.java +++ b/src/main/java/de/cowtipper/cowlection/util/MooChatComponent.java @@ -145,7 +145,7 @@ public class MooChatComponent extends ChatComponentText { public MooChatComponent setOpenFile(File filePath) { setChatStyle(getChatStyle().setChatClickEvent(new ClickEvent(ClickEvent.Action.OPEN_FILE, filePath.getAbsolutePath()))); - setHover(new MooChatComponent(filePath.isFile() ? "Open " + filePath.getName() : "Open folder: " + filePath.toString()).yellow()); + setHover(new MooChatComponent(filePath.isFile() ? "Open " + filePath.getName() : "Open folder: " + filePath).yellow()); return this; } @@ -171,7 +171,7 @@ public class MooChatComponent extends ChatComponentText { /** * Appends the given component in a new line, without inheriting formatting of previous siblings. * - * @see ChatComponentText#appendSibling appendSibling + * @see ChatComponentText#appendSibling */ public MooChatComponent appendFreshSibling(IChatComponent sibling) { this.siblings.add(new ChatComponentText("\n").appendSibling(sibling)); diff --git a/src/main/java/de/cowtipper/cowlection/util/Utils.java b/src/main/java/de/cowtipper/cowlection/util/Utils.java index 85a8ae0..344ab64 100644 --- a/src/main/java/de/cowtipper/cowlection/util/Utils.java +++ b/src/main/java/de/cowtipper/cowlection/util/Utils.java @@ -33,7 +33,7 @@ import java.util.stream.Collectors; public final class Utils { public static final Pattern VALID_UUID_PATTERN = Pattern.compile("^(\\w{8})-(\\w{4})-(\\w{4})-(\\w{4})-(\\w{12})$"); - private static final Pattern VALID_USERNAME = Pattern.compile("^[\\w]{1,16}$"); + private static final Pattern VALID_USERNAME = Pattern.compile("^\\w{1,16}$"); private static final Pattern ALTERNATE_COLOR_CODES_PATTERN = Pattern.compile("&([0-9a-fk-or])"); private static final Pattern MC_COLOR_CODES_PATTERN = Pattern.compile("§([0-9a-fk-or])"); private static final NavigableMap<Double, Character> NUMBER_SUFFIXES = new TreeMap<>(); @@ -449,7 +449,7 @@ public final class Utils { .appendSibling(new MooChatComponent(" [open folder]").darkAqua().setOpenFile(targetNormalized.getParentFile()))); } catch (IOException | UnsupportedOperationException e) { e.printStackTrace(); - Cowlection.getInstance().getChatHelper().sendMessage(EnumChatFormatting.RED, "Couldn't save " + what + ": " + e.toString()); + Cowlection.getInstance().getChatHelper().sendMessage(EnumChatFormatting.RED, "Couldn't save " + what + ": " + e); } } } |