9
0
mirror of https://github.com/HibiscusMC/HMCCosmetics.git synced 2025-12-29 11:59:21 +00:00

fix: current placeholder returning null when no cosmetics are equipped

This commit is contained in:
LoJoSho
2023-10-13 11:47:14 -05:00
parent 8ef6692198
commit 57f4d3703c
2 changed files with 4 additions and 4 deletions

View File

@@ -80,7 +80,7 @@ public class HMCPlaceholderExpansion extends PlaceholderExpansion {
if (placeholderArgs.get(1) != null) {
CosmeticSlot slot = CosmeticSlot.valueOf(placeholderArgs.get(1).toUpperCase());
if (slot == null) return null;
if (user.getCosmetic(slot) == null) return null;
if (user.getCosmetic(slot) == null) return "none";
if (placeholderArgs.size() == 2) return user.getCosmetic(slot).getId();
String output;
@@ -104,7 +104,7 @@ public class HMCPlaceholderExpansion extends PlaceholderExpansion {
output = user.getCosmetic(slot).getId();
}
}
return TranslationUtil.getTranslation("current-cosmetic", String.valueOf(output));
return TranslationUtil.getTranslation("current-cosmetic", output);
}
case "unlocked":
if (placeholderArgs == null) {
@@ -216,6 +216,7 @@ public class HMCPlaceholderExpansion extends PlaceholderExpansion {
if (!item.hasItemMeta()) return null;
ItemMeta itemMeta = item.getItemMeta();
if (itemMeta == null) return null;
if (!itemMeta.hasDisplayName()) return null;
return itemMeta.getDisplayName();
}