From d53e28e7f72640de3bad1b6e31c69d622dabdf46 Mon Sep 17 00:00:00 2001 From: Indyuce Date: Mon, 10 Aug 2020 21:37:26 +0200 Subject: [PATCH] Fixed display issues --- src/main/java/net/Indyuce/mmoitems/stat/Abilities.java | 2 +- src/main/java/net/Indyuce/mmoitems/stat/DyeColor.java | 1 + src/main/java/net/Indyuce/mmoitems/stat/Elements.java | 10 +++++----- .../net/Indyuce/mmoitems/stat/PermanentEffects.java | 6 +++--- src/main/java/net/Indyuce/mmoitems/stat/Restore.java | 8 ++++---- .../net/Indyuce/mmoitems/stat/type/BooleanStat.java | 2 +- 6 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/main/java/net/Indyuce/mmoitems/stat/Abilities.java b/src/main/java/net/Indyuce/mmoitems/stat/Abilities.java index 94676aec..9a22802d 100644 --- a/src/main/java/net/Indyuce/mmoitems/stat/Abilities.java +++ b/src/main/java/net/Indyuce/mmoitems/stat/Abilities.java @@ -127,7 +127,7 @@ public class Abilities extends ItemStat { @Override public void whenDisplayed(List lore, Optional optional) { lore.add(ChatColor.GRAY + "Current Abilities: " + ChatColor.GOLD - + (optional.isPresent() ? "0" : ((RandomAbilityListData) optional.get()).getAbilities().size())); + + (optional.isPresent() ? ((RandomAbilityListData) optional.get()).getAbilities().size() : 0)); lore.add(""); lore.add(ChatColor.YELLOW + AltChar.listDash + " Click to edit the item abilities."); } diff --git a/src/main/java/net/Indyuce/mmoitems/stat/DyeColor.java b/src/main/java/net/Indyuce/mmoitems/stat/DyeColor.java index ff402e4e..7f5d5a66 100644 --- a/src/main/java/net/Indyuce/mmoitems/stat/DyeColor.java +++ b/src/main/java/net/Indyuce/mmoitems/stat/DyeColor.java @@ -65,6 +65,7 @@ public class DyeColor extends ItemStat { @Override public void whenDisplayed(List lore, Optional optional) { lore.add(ChatColor.GRAY + "Current Value: " + (optional.isPresent() ? ChatColor.GREEN + optional.get().toString() : ChatColor.RED + "None")); + lore.add(""); lore.add(ChatColor.YELLOW + AltChar.listDash + " Click to change this value."); lore.add(ChatColor.YELLOW + AltChar.listDash + " Right click to remove the dye color."); } diff --git a/src/main/java/net/Indyuce/mmoitems/stat/Elements.java b/src/main/java/net/Indyuce/mmoitems/stat/Elements.java index 5f959fb7..06d883c2 100644 --- a/src/main/java/net/Indyuce/mmoitems/stat/Elements.java +++ b/src/main/java/net/Indyuce/mmoitems/stat/Elements.java @@ -81,11 +81,11 @@ public class Elements extends ItemStat { if (optional.isPresent()) { lore.add(ChatColor.GRAY + "Current Value:"); - ElementListData data = (ElementListData) optional.get(); - data.getDamageElements() - .forEach(element -> lore.add(ChatColor.GRAY + "* " + element.getName() + " Damage: " + data.getDamage(element) + "%")); - data.getDefenseElements() - .forEach(element -> lore.add(ChatColor.GRAY + "* " + element.getName() + " Damage: " + data.getDefense(element) + "%")); + RandomElementListData data = (RandomElementListData) optional.get(); + data.getDamageElements().forEach( + element -> lore.add(ChatColor.GRAY + "* " + element.getName() + " Damage: " + ChatColor.RED + data.getDamage(element) + " (%)")); + data.getDefenseElements().forEach( + element -> lore.add(ChatColor.GRAY + "* " + element.getName() + " Damage: " + ChatColor.RED + data.getDefense(element) + " (%)")); } else lore.add(ChatColor.GRAY + "Current Value: " + ChatColor.RED + "None"); diff --git a/src/main/java/net/Indyuce/mmoitems/stat/PermanentEffects.java b/src/main/java/net/Indyuce/mmoitems/stat/PermanentEffects.java index 36f9d713..1940e114 100644 --- a/src/main/java/net/Indyuce/mmoitems/stat/PermanentEffects.java +++ b/src/main/java/net/Indyuce/mmoitems/stat/PermanentEffects.java @@ -103,10 +103,10 @@ public class PermanentEffects extends ItemStat { if (optional.isPresent()) { lore.add(ChatColor.GRAY + "Current Value:"); - PotionEffectListData data = (PotionEffectListData) optional.get(); - for (PotionEffectData effect : data.getEffects()) + RandomPotionEffectListData data = (RandomPotionEffectListData) optional.get(); + for (RandomPotionEffectData effect : data.getEffects()) lore.add(ChatColor.GRAY + "* " + ChatColor.GREEN + MMOUtils.caseOnWords(effect.getType().getName().replace("_", " ").toLowerCase()) - + " " + MMOUtils.intToRoman(effect.getLevel())); + + " " + effect.getLevel().toString()); } else lore.add(ChatColor.GRAY + "Current Value: " + ChatColor.RED + "None"); diff --git a/src/main/java/net/Indyuce/mmoitems/stat/Restore.java b/src/main/java/net/Indyuce/mmoitems/stat/Restore.java index 57772101..48168520 100644 --- a/src/main/java/net/Indyuce/mmoitems/stat/Restore.java +++ b/src/main/java/net/Indyuce/mmoitems/stat/Restore.java @@ -62,10 +62,10 @@ public class Restore extends ItemStat { public void whenDisplayed(List lore, Optional optional) { if (optional.isPresent()) { - RestoreData data = (RestoreData) optional.get(); - lore.add(ChatColor.GRAY + "* Restore Health: " + ChatColor.GREEN + data.getHealth()); - lore.add(ChatColor.GRAY + "* Restore Food: " + ChatColor.GREEN + data.getFood()); - lore.add(ChatColor.GRAY + "* Restore Saturation: " + ChatColor.GREEN + data.getSaturation()); + RandomRestoreData data = (RandomRestoreData) optional.get(); + lore.add(ChatColor.GRAY + "* Restore Health: " + ChatColor.RED + data.getHealth()); + lore.add(ChatColor.GRAY + "* Restore Food: " + ChatColor.RED + data.getFood()); + lore.add(ChatColor.GRAY + "* Restore Saturation: " + ChatColor.RED + data.getSaturation()); } else lore.add(ChatColor.GRAY + "Current Value: " + ChatColor.RED + "None"); diff --git a/src/main/java/net/Indyuce/mmoitems/stat/type/BooleanStat.java b/src/main/java/net/Indyuce/mmoitems/stat/type/BooleanStat.java index 45c2e040..9bebd4fc 100644 --- a/src/main/java/net/Indyuce/mmoitems/stat/type/BooleanStat.java +++ b/src/main/java/net/Indyuce/mmoitems/stat/type/BooleanStat.java @@ -86,7 +86,7 @@ public class BooleanStat extends ItemStat { if (optional.isPresent()) { double chance = ((RandomBooleanData) optional.get()).getChance(); lore.add(ChatColor.GRAY + "Current Value: " + (chance >= 1 ? ChatColor.GREEN + "True" - : chance <= 0 ? ChatColor.RED + "False" : ChatColor.GREEN + digit.format(chance * 100) + "%")); + : chance <= 0 ? ChatColor.RED + "False" : ChatColor.GREEN + digit.format(chance * 100) + "% Chance")); } else lore.add(ChatColor.GRAY + "Current Value: " + ChatColor.RED + "False");