From b5e4bebd75eed917e58338bd5cf9d7af826cc802 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Tue, 14 Feb 2012 12:09:02 -0800 Subject: [PATCH] Fixed the negative XP bug on levelup. Fixes #134 --- Changelog.txt | 1 + src/main/java/com/gmail/nossr50/Database.java | 1 + src/main/java/com/gmail/nossr50/skills/Skills.java | 5 +++-- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index e6450910a..de75e1624 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -22,6 +22,7 @@ Version 1.2.11 - Added a success message when executing xprate from console Version 1.2.10 + - Fixed issue that caused negative XP on levelup - Fixed issue with receiving Woodcutting XP for all blocks broken (Issue #103) - Fixed issue with Spout images & sounds not working (Issue #93) - Fixed typo with repairing Leather Armor & Bows diff --git a/src/main/java/com/gmail/nossr50/Database.java b/src/main/java/com/gmail/nossr50/Database.java index 0ac7dbc12..60d41c8bd 100644 --- a/src/main/java/com/gmail/nossr50/Database.java +++ b/src/main/java/com/gmail/nossr50/Database.java @@ -47,6 +47,7 @@ public class Database { System.out.println("VendorError: " + e.getErrorCode()); } } + //Create the DB structure public void createStructure() { Write("CREATE TABLE IF NOT EXISTS `" + LoadProperties.MySQLtablePrefix + "huds` (`user_id` int(10) unsigned NOT NULL," diff --git a/src/main/java/com/gmail/nossr50/skills/Skills.java b/src/main/java/com/gmail/nossr50/skills/Skills.java index d13095e74..ef5991a3f 100644 --- a/src/main/java/com/gmail/nossr50/skills/Skills.java +++ b/src/main/java/com/gmail/nossr50/skills/Skills.java @@ -327,14 +327,15 @@ public class Skills while(PP.getSkillXpLevel(skillType) >= PP.getXpToLevel(skillType)) { - if(getSkillMaxLevel(skillType) >= PP.getSkillLevel(skillType) + 1) { + if(getSkillMaxLevel(skillType) >= PP.getSkillLevel(skillType) + 1) + { skillups++; + PP.removeXP(skillType, PP.getXpToLevel(skillType)); PP.skillUp(skillType, 1); McMMOPlayerLevelUpEvent eventToFire = new McMMOPlayerLevelUpEvent(player, skillType); Bukkit.getPluginManager().callEvent(eventToFire); } - PP.removeXP(skillType, PP.getXpToLevel(skillType)); } if(!LoadProperties.useMySQL)