From 00e5df5718157f8bf15d37c8aadf55936642cba6 Mon Sep 17 00:00:00 2001 From: Nonoriri Date: Sun, 24 Nov 2013 12:54:31 -0500 Subject: [PATCH] Fixed rounding error due to using int instead of double. Bonuses are now inserted at the beginning of the item lore instead of at the end. --- .../src/me/kaZep/Base/PlayerListener.java | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/BankEconomyMod/src/me/kaZep/Base/PlayerListener.java b/BankEconomyMod/src/me/kaZep/Base/PlayerListener.java index daf76d6..19d6eef 100644 --- a/BankEconomyMod/src/me/kaZep/Base/PlayerListener.java +++ b/BankEconomyMod/src/me/kaZep/Base/PlayerListener.java @@ -13539,34 +13539,34 @@ class updateInventoryTask implements Runnable { // Bukkit.getLogger().info("Bonus enchantment string: " + appliedEnchant); if (appliedEnchant.equalsIgnoreCase("Critical Chance")) { - bonusesLore.add(ChatColor.YELLOW+"+"+magnitude+"% "+ChatColor.BLUE+"Critical Chance"); + bonusesLore.add(0, ChatColor.YELLOW+"+"+magnitude+"% "+ChatColor.BLUE+"Critical Chance"); } if (appliedEnchant.equalsIgnoreCase("Armor Penetration")) { - bonusesLore.add(ChatColor.YELLOW+"+"+magnitude+" "+ChatColor.BLUE+"Armor Penetration"); + bonusesLore.add(0, ChatColor.YELLOW+"+"+magnitude+" "+ChatColor.BLUE+"Armor Penetration"); } if (appliedEnchant.equalsIgnoreCase("Life Steal")) { - bonusesLore.add(ChatColor.YELLOW+"+"+magnitude+"% "+ChatColor.BLUE+"Life Steal"); + bonusesLore.add(0, ChatColor.YELLOW+"+"+magnitude+"% "+ChatColor.BLUE+"Life Steal"); } if (appliedEnchant.equalsIgnoreCase("Attack Speed")) { - bonusesLore.add(ChatColor.YELLOW+"+"+magnitude+"% "+ChatColor.BLUE+"Attack Speed"); + bonusesLore.add(0, ChatColor.YELLOW+"+"+magnitude+"% "+ChatColor.BLUE+"Attack Speed"); } if (appliedEnchant.equalsIgnoreCase("Damage")) { - bonusesLore.add(ChatColor.YELLOW+"+"+magnitude+" "+ChatColor.BLUE+"Damage"); + bonusesLore.add(0, ChatColor.YELLOW+"+"+magnitude+" "+ChatColor.BLUE+"Damage"); } if (appliedEnchant.equalsIgnoreCase("Health")) { - bonusesLore.add(ChatColor.YELLOW+"+"+magnitude+" "+ChatColor.BLUE+"Health"); + bonusesLore.add(0, ChatColor.YELLOW+"+"+magnitude+" "+ChatColor.BLUE+"Health"); } if (appliedEnchant.equalsIgnoreCase("Damage Reduction")) { - bonusesLore.add(ChatColor.YELLOW+"+"+magnitude+"% "+ChatColor.BLUE+"Damage Reduction"); + bonusesLore.add(0, ChatColor.YELLOW+"+"+magnitude+"% "+ChatColor.BLUE+"Damage Reduction"); } if (appliedEnchant.equalsIgnoreCase("Durability")) { - bonusesLore.add(ChatColor.YELLOW+"+"+magnitude+"% "+ChatColor.BLUE+"Durability"); + bonusesLore.add(0, ChatColor.YELLOW+"+"+magnitude+"% "+ChatColor.BLUE+"Durability"); } if (appliedEnchant.equalsIgnoreCase("Block Chance")) { - bonusesLore.add(ChatColor.YELLOW+"+"+magnitude+"% "+ChatColor.BLUE+"Block Chance"); + bonusesLore.add(0, ChatColor.YELLOW+"+"+magnitude+"% "+ChatColor.BLUE+"Block Chance"); } if (appliedEnchant.equalsIgnoreCase("Speed Boost Chance")) { - bonusesLore.add(ChatColor.YELLOW+"+"+magnitude+"% "+ChatColor.BLUE+"Speed Boost Chance"); + bonusesLore.add(0, ChatColor.YELLOW+"+"+magnitude+"% "+ChatColor.BLUE+"Speed Boost Chance"); } bonusesMeta.setLore(bonusesLore); @@ -13575,7 +13575,7 @@ class updateInventoryTask implements Runnable { } else { // This enchantment exists. Calculate incremental cost. - cost += (int)(12 * itemBonuses.get(appliedEnchant) / probableBonuses.get(appliedEnchant)); // Make sure it's at least one level + cost += (int)(12d * itemBonuses.get(appliedEnchant) / probableBonuses.get(appliedEnchant)); // Make sure it's at least one level cost = Math.min(60, cost); cost = Math.max(1, cost);