Skip to content

Commit

Permalink
fix: remove favorite icon from pet display name
Browse files Browse the repository at this point in the history
  • Loading branch information
Fix3dll committed Oct 27, 2024
1 parent 007544d commit 8f24c96
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
public class PetManager {
//private static final Pattern SELECTED_PET_PATTERN = Pattern.compile("(?:§.)*Selected pet: §(?<rarity>\\w)(?<pet>[\\w ]+)");
private static final Pattern PET_LEVEL_PATTERN = Pattern.compile("(§7\\[Lvl )(?<level>\\d+)(] )(§8\\[§.)?(?<cosmeticLevel>\\d+)?(.*)");
private static final Pattern FAVORITE_PATTERN = Pattern.compile("§e⭐ ");

/** The PetManager instance.*/
@Getter private static final PetManager instance = new PetManager();
Expand Down Expand Up @@ -180,7 +181,12 @@ public void updatePetItem(String rarityColor, String petItem) {
* @author Fix3dll
*/
private Pet getPetFromItemStack(ItemStack stack) {
String displayName = stack.getDisplayName();
String displayName;
if (stack.hasDisplayName()) {
displayName = FAVORITE_PATTERN.matcher(stack.getDisplayName()).replaceAll("");
} else {
return null;
}

int petLevel = TextUtils.getPetLevelFromDisplayName(displayName);
if (petLevel == -1) return null;
Expand Down

0 comments on commit 8f24c96

Please sign in to comment.