Browse Source

Fixed the negative XP bug on levelup.
Fixes #134

nossr50 13 years ago
parent
commit
b5e4bebd75

+ 1 - 0
Changelog.txt

@@ -22,6 +22,7 @@ Version 1.2.11
  - Added a success message when executing xprate from console
  - Added a success message when executing xprate from console
 
 
 Version 1.2.10
 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 receiving Woodcutting XP for all blocks broken (Issue #103)
  - Fixed issue with Spout images & sounds not working (Issue #93)
  - Fixed issue with Spout images & sounds not working (Issue #93)
  - Fixed typo with repairing Leather Armor & Bows
  - Fixed typo with repairing Leather Armor & Bows

+ 1 - 0
src/main/java/com/gmail/nossr50/Database.java

@@ -47,6 +47,7 @@ public class Database {
 			System.out.println("VendorError: " + e.getErrorCode());
 			System.out.println("VendorError: " + e.getErrorCode());
 		}
 		}
 	}
 	}
+	
 	//Create the DB structure
 	//Create the DB structure
 	public void createStructure() {
 	public void createStructure() {
 		Write("CREATE TABLE IF NOT EXISTS `" + LoadProperties.MySQLtablePrefix + "huds` (`user_id` int(10) unsigned NOT NULL,"
 		Write("CREATE TABLE IF NOT EXISTS `" + LoadProperties.MySQLtablePrefix + "huds` (`user_id` int(10) unsigned NOT NULL,"

+ 3 - 2
src/main/java/com/gmail/nossr50/skills/Skills.java

@@ -327,14 +327,15 @@ public class Skills
 			
 			
 			while(PP.getSkillXpLevel(skillType) >= PP.getXpToLevel(skillType))
 			while(PP.getSkillXpLevel(skillType) >= PP.getXpToLevel(skillType))
 			{
 			{
-				if(getSkillMaxLevel(skillType) >= PP.getSkillLevel(skillType) + 1) {
+				if(getSkillMaxLevel(skillType) >= PP.getSkillLevel(skillType) + 1) 
+				{
 					skillups++;
 					skillups++;
+					PP.removeXP(skillType, PP.getXpToLevel(skillType));
 					PP.skillUp(skillType, 1);
 					PP.skillUp(skillType, 1);
 					
 					
 					McMMOPlayerLevelUpEvent eventToFire = new McMMOPlayerLevelUpEvent(player, skillType);
 					McMMOPlayerLevelUpEvent eventToFire = new McMMOPlayerLevelUpEvent(player, skillType);
 					Bukkit.getPluginManager().callEvent(eventToFire);
 					Bukkit.getPluginManager().callEvent(eventToFire);
 				}
 				}
-				PP.removeXP(skillType, PP.getXpToLevel(skillType));
 			}
 			}
 			
 			
 			if(!LoadProperties.useMySQL)
 			if(!LoadProperties.useMySQL)