mirror of
https://github.com/ChestShop-authors/ChestShop-3.git
synced 2024-11-29 05:26:12 +01:00
Adjust to use "new" potion API and improve custom effects
This makes it compile with 1.20.5
This commit is contained in:
parent
b54824052d
commit
60b10a83b6
@ -212,24 +212,22 @@ public class ItemInfoListener implements Listener {
|
||||
|
||||
PotionMeta potionMeta = (PotionMeta) meta;
|
||||
|
||||
StringBuilder message = new StringBuilder(50);
|
||||
|
||||
message.append(ChatColor.GRAY);
|
||||
|
||||
message.append(capitalizeFirstLetter(item.getType().name(), '_')).append(" of ");
|
||||
message.append(capitalizeFirstLetter(potionMeta.getBasePotionData().getType().name(), '_')).append(' ');
|
||||
if (potionMeta.getBasePotionData().isUpgraded()) {
|
||||
message.append("II");
|
||||
} else if (potionMeta.getBasePotionData().isExtended()) {
|
||||
message.append("+");
|
||||
}
|
||||
|
||||
CommandSender sender = event.getSender();
|
||||
|
||||
sender.sendMessage(message.toString());
|
||||
if (potionMeta.getBasePotionType() != null) {
|
||||
StringBuilder message = new StringBuilder(50);
|
||||
|
||||
message.append(ChatColor.GRAY);
|
||||
|
||||
message.append(capitalizeFirstLetter(item.getType().name(), '_')).append(" of ");
|
||||
message.append(capitalizeFirstLetter(potionMeta.getBasePotionType().getKey().getKey(), '_')).append(' ');
|
||||
|
||||
sender.sendMessage(message.toString());
|
||||
}
|
||||
|
||||
for (PotionEffect effect : potionMeta.getCustomEffects()) {
|
||||
sender.sendMessage(ChatColor.DARK_GRAY + capitalizeFirstLetter(effect.getType().getName(), '_') + ' ' + toTime(effect.getDuration() / 20));
|
||||
sender.sendMessage(ChatColor.DARK_GRAY + capitalizeFirstLetter(effect.getType().getKey().getKey(), '_')
|
||||
+ ' ' + (effect.getAmplifier() + 1) + ' ' + toTime(effect.getDuration() / 20));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user