mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-26 15:16:45 +01:00
Fixed bug with only getting one level when there was enough XP for
multiple levels. Fixes MCCORE-191
This commit is contained in:
parent
f6a6316b7a
commit
f5ddf1bc0e
@ -16,6 +16,7 @@ Version 1.3.06-dev
|
||||
= Fixed bug with repairing wooden tools
|
||||
= Fixed bug with Nether Wart not awarding XP
|
||||
= Fixed bug with fishing treasures when treasures list is empty
|
||||
= Fixed bug with only getting one level when there was enough XP for multiple levels.
|
||||
! Changed mcremove to no longer kick players when they are removed from database
|
||||
! Changed mcremove to work on offline users for FlatFile
|
||||
! Changed PlayerProfile constructor to always take a boolean
|
||||
@ -23,6 +24,7 @@ Version 1.3.06-dev
|
||||
! Changed Archery's Daze to deal 4 DMG on proc (2 Hearts)
|
||||
! Changed /addlevel command to work for offline users
|
||||
! Changed party & admin chat handling to be nicer to developers
|
||||
! Changed UpdateXPBar function to hopefully avoid errors
|
||||
|
||||
Version 1.3.05
|
||||
+ Added Skill Shot to Archery which increases damage dealt by 10% every 50 skill levels (caps at 200%)
|
||||
|
@ -964,6 +964,10 @@ public class PlayerProfile {
|
||||
return skillsXp.get(skillType);
|
||||
}
|
||||
|
||||
public void skillUp(SkillType skillType, int newValue) {
|
||||
skills.put(skillType, skills.get(skillType) + newValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds XP to the player, doesn't calculate for XP Rate
|
||||
*
|
||||
@ -1038,6 +1042,27 @@ public class PlayerProfile {
|
||||
lastgained = skillType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove XP from a skill.
|
||||
*
|
||||
* @param skillType Type of skill to modify
|
||||
* @param xp Amount of xp to remove
|
||||
*/
|
||||
public void removeXP(SkillType skillType, int xp) {
|
||||
if (skillType.equals(SkillType.ALL)) {
|
||||
for (SkillType skill : SkillType.values()) {
|
||||
if (skill.equals(SkillType.ALL)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
skillsXp.put(skill, skillsXp.get(skill) - xp);
|
||||
}
|
||||
}
|
||||
else {
|
||||
skillsXp.put(skillType, skillsXp.get(skillType) - xp);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Modify a skill level.
|
||||
*
|
||||
|
@ -11,6 +11,7 @@ import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.PlayerInventory;
|
||||
|
||||
import org.getspout.spoutapi.SpoutManager;
|
||||
import org.getspout.spoutapi.player.SpoutPlayer;
|
||||
|
||||
|
@ -189,14 +189,13 @@ public class Skills {
|
||||
while (PP.getSkillXpLevel(skillType) >= PP.getXpToLevel(skillType)) {
|
||||
if ((skillType.getMaxLevel() >= PP.getSkillLevel(skillType) + 1) && (m.getPowerLevelCap() >= PP.getPowerLevel() + 1)) {
|
||||
skillups++;
|
||||
PP.addLevels(skillType, 1);
|
||||
PP.skillUp(skillType, 1);
|
||||
|
||||
McMMOPlayerLevelUpEvent eventToFire = new McMMOPlayerLevelUpEvent(player, skillType);
|
||||
Bukkit.getPluginManager().callEvent(eventToFire);
|
||||
}
|
||||
else {
|
||||
PP.addLevels(skillType, 0);
|
||||
}
|
||||
|
||||
PP.removeXP(skillType, PP.getXpToLevel(skillType));
|
||||
}
|
||||
|
||||
if (!LoadProperties.useMySQL) {
|
||||
@ -212,15 +211,14 @@ public class Skills {
|
||||
|
||||
if (sPlayer.isSpoutCraftEnabled()) {
|
||||
if (LoadProperties.xpbar) {
|
||||
SpoutStuff.updateXpBar(sPlayer);
|
||||
SpoutStuff.updateXpBar(player);
|
||||
}
|
||||
|
||||
SpoutStuff.levelUpNotification(skillType, sPlayer);
|
||||
|
||||
/* Update custom titles */
|
||||
if(LoadProperties.showPowerLevel) {
|
||||
sPlayer.setTitle(sPlayer.getName()+ "\n" + ChatColor.YELLOW + "P" + ChatColor.GOLD + "lvl"
|
||||
+ ChatColor.WHITE+"." + ChatColor.GREEN + String.valueOf(PP.getPowerLevel()));
|
||||
sPlayer.setTitle(sPlayer.getName()+ "\n" + ChatColor.YELLOW + "P" + ChatColor.GOLD + "lvl" + ChatColor.WHITE + "." + ChatColor.GREEN + String.valueOf(PP.getPowerLevel()));
|
||||
}
|
||||
}
|
||||
else {
|
||||
@ -237,7 +235,7 @@ public class Skills {
|
||||
SpoutPlayer sPlayer = (SpoutPlayer) player;
|
||||
if (sPlayer.isSpoutCraftEnabled()) {
|
||||
if (LoadProperties.xpbar) {
|
||||
SpoutStuff.updateXpBar(sPlayer);
|
||||
SpoutStuff.updateXpBar(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user