From 8b07b189d45ffb0720143bc10348118c66969c2f Mon Sep 17 00:00:00 2001 From: nossr50 Date: Wed, 28 Mar 2012 19:45:34 -0700 Subject: [PATCH] Fixed XP Bar --- Changelog.txt | 1 + .../java/com/gmail/nossr50/skills/Skills.java | 16 +++++++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index b6a3d8113..71409fa32 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -8,6 +8,7 @@ Key: - Removal Version 1.3.05-dev + = Fixed XP bar not updating when XP was gained = Fixed bug with repairing wooden tools = Fixed bug where spawned wolves only had 8 health. ! Changed Tree Feller to account for ability durability loss but not leaves. diff --git a/src/main/java/com/gmail/nossr50/skills/Skills.java b/src/main/java/com/gmail/nossr50/skills/Skills.java index e0451173b..1f83e4dd8 100644 --- a/src/main/java/com/gmail/nossr50/skills/Skills.java +++ b/src/main/java/com/gmail/nossr50/skills/Skills.java @@ -190,9 +190,9 @@ public class Skills { */ public static void XpCheckSkill(SkillType skillType, Player player) { PlayerProfile PP = Users.getProfile(player); - + int skillups = 0; + if (PP.getSkillXpLevel(skillType) >= PP.getXpToLevel(skillType)) { - int skillups = 0; while (PP.getSkillXpLevel(skillType) >= PP.getXpToLevel(skillType)) { if (skillType.getMaxLevel() >= PP.getSkillLevel(skillType) + 1) { @@ -222,7 +222,7 @@ public class Skills { if (LoadProperties.xpbar) { SpoutStuff.updateXpBar(sPlayer); } - + SpoutStuff.levelUpNotification(skillType, sPlayer); } else { @@ -233,6 +233,16 @@ public class Skills { player.sendMessage(mcLocale.getString("Skills."+capitalized+"Up", new Object[] {String.valueOf(skillups), PP.getSkillLevel(skillType)})); } } + + /* Always update XP Bar (Check if no levels were gained first to remove redundancy) */ + if(skillups == 0 && player instanceof SpoutPlayer) { + SpoutPlayer sPlayer = (SpoutPlayer) player; + if (sPlayer.isSpoutCraftEnabled()) { + if (LoadProperties.xpbar) { + SpoutStuff.updateXpBar(sPlayer); + } + } + } } /**