add potion preview

Former-commit-id: c4c95593c3d84b05815810567e5a47b6cd6c61ed
This commit is contained in:
Ghost_chu committed 2018-08-04 16:19:44 +08:00
1 parent 65d13bd936
commit 41efccc486
2 files changed
+9 -4

No files matched your search

@@ -221,7 +221,7 @@ public class MsgUtil {
String PotionString = potion.getName().trim();
String Potion_i18n = null;
try {
Potion_i18n = enchi18n.getString("potioni18n."+PotionString);
Potion_i18n = potioni18n.getString("potioni18n."+PotionString);
}catch (Exception e) {
e.printStackTrace();
Potion_i18n = null;
@@ -716,18 +716,23 @@ public class Util {
List<String> pEffects = new ArrayList<String>();
PotionMeta pMeta = (PotionMeta)iStack.getItemMeta();
if(pMeta.getBasePotionData().getType()!=null) {
pEffects.add(MsgUtil.getPotioni18n(pMeta.getBasePotionData().getType().getEffectType()));
if(!(pMeta.getBasePotionData().isUpgraded())){
pEffects.add(ChatColor.BLUE+MsgUtil.getPotioni18n(pMeta.getBasePotionData().getType().getEffectType()));
}else {
pEffects.add(ChatColor.BLUE+MsgUtil.getPotioni18n(pMeta.getBasePotionData().getType().getEffectType())+" II");
}
}
if(pMeta.hasCustomEffects()) {
List<PotionEffect> cEffects = pMeta.getCustomEffects();
for (PotionEffect potionEffect : cEffects) {
pEffects.add(MsgUtil.getPotioni18n(potionEffect.getType()));
pEffects.add(MsgUtil.getPotioni18n(potionEffect.getType())+" "+formatEnchLevel(potionEffect.getAmplifier()));
}
}
if(pEffects != null && pEffects.isEmpty() == false) {
String result = new String();
for (String effectString : pEffects) {
result+=ChatColor.BLUE + effectString+"\n";
result+=effectString+"\n";
}
return result;
}else {