Skip to content

Commit

Permalink
use updated method to show potion names
Browse files Browse the repository at this point in the history
  • Loading branch information
Brokkonaut committed Jan 13, 2024
1 parent 4df5ba7 commit f4bd919
Showing 1 changed file with 11 additions and 21 deletions.
32 changes: 11 additions & 21 deletions src/main/java/com/Acrobot/ChestShop/Listeners/ItemInfoListener.java
Expand Up @@ -133,28 +133,18 @@ public static void addInfo(ItemInfoEvent event) {
}
}

if (meta instanceof PotionMeta) {
PotionMeta potion = (PotionMeta) meta;
StringBuilder message = new StringBuilder(50).append(" ").append(ChatColor.GRAY);
PotionData base = potion.getBasePotionData();
if (base != null) {
if (base.isExtended()) {
message.append("Extended ");
}
if (type == Material.SPLASH_POTION) {
message.append("Splash ");
}
if (type == Material.LINGERING_POTION) {
message.append("Lingering ");
}
message.append(PotionNames.getName(base.getType())).append(' ');
if (base.isUpgraded()) {
message.append("II ");
}
sender.sendMessage(message.toString());
if (meta instanceof PotionMeta potionMeta) {
String itemName = PotionNames.getName(potionMeta.getBasePotionType());
if (type == Material.SPLASH_POTION) {
itemName = itemName.replace("Potion", "Splash Potion");
}
if (type == Material.LINGERING_POTION) {
itemName = itemName.replace("Potion", "Lingering Potion");
}
if (potion.hasCustomEffects()) {
for (PotionEffect effect : potion.getCustomEffects()) {
sender.sendMessage(" " + ChatColor.GRAY + itemName);

if (potionMeta.hasCustomEffects()) {
for (PotionEffect effect : potionMeta.getCustomEffects()) {
sender.sendMessage(" " + ChatColor.GRAY + capitalizeFirstLetter(effect.getType().getName(), '_') + ' ' + toTime(effect.getDuration() / 20));
}
}
Expand Down

0 comments on commit f4bd919

Please sign in to comment.