9
0
mirror of https://github.com/HibiscusMC/HMCCosmetics.git synced 2025-12-30 04:19:28 +00:00

fix: unlocked placeholder producing out of bounds expection

This commit is contained in:
LoJoSho
2023-05-24 12:20:39 -05:00
parent f084d9e782
commit 9b607a099e

View File

@@ -109,13 +109,15 @@ public class HMCPlaceholderExpansion extends PlaceholderExpansion {
}
if (placeholderArgs.get(1) != null) {
Cosmetic cosmetic = Cosmetics.getCosmetic(placeholderArgs.get(1));
if (cosmetic == null) {
if (cosmetic == null && placeholderArgs.size() >= 3) {
Cosmetic secondAttemptCosmetic = Cosmetics.getCosmetic(placeholderArgs.get(1) + "_" + placeholderArgs.get(2));
if (secondAttemptCosmetic == null) {
return "INVALID_COSMETIC";
} else {
cosmetic = secondAttemptCosmetic;
}
} else {
return "INVALID_COSMETIC";
}
return TranslationUtil.getTranslation("unlockedCosmetic", String.valueOf(user.canEquipCosmetic(cosmetic)));
}