mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 22:56:45 +01:00
Refixed NPE due to GainXp task
This commit is contained in:
parent
1b37ba8daa
commit
3e435c419a
@ -61,7 +61,7 @@ public class ExperienceAPI {
|
|||||||
* @param XP The amount of XP to add
|
* @param XP The amount of XP to add
|
||||||
*/
|
*/
|
||||||
public void addXP(Player player, SkillType skillType, int XP) {
|
public void addXP(Player player, SkillType skillType, int XP) {
|
||||||
Users.getProfile(player).addXP(skillType, XP);
|
Users.getProfile(player).addXP(player, skillType, XP);
|
||||||
checkXP(player, skillType);
|
checkXP(player, skillType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1000,13 +1000,11 @@ public class PlayerProfile {
|
|||||||
/**
|
/**
|
||||||
* Adds XP to the player, this is affected by skill modifiers and XP Rate
|
* Adds XP to the player, this is affected by skill modifiers and XP Rate
|
||||||
*
|
*
|
||||||
|
* @param player The player to add XP to
|
||||||
* @param skillType The skill to add XP to
|
* @param skillType The skill to add XP to
|
||||||
* @param newvalue The amount of XP to add
|
* @param newvalue The amount of XP to add
|
||||||
* @param player The player to add XP to
|
|
||||||
*/
|
*/
|
||||||
public void addXP(SkillType skillType, int newValue) {
|
public void addXP(Player player, SkillType skillType, int newValue) {
|
||||||
Player player = mcMMO.p.getServer().getPlayer(playerName);
|
|
||||||
|
|
||||||
if (System.currentTimeMillis() < ((xpGainATS * 1000) + 250) || player.getGameMode().equals(GameMode.CREATIVE)) {
|
if (System.currentTimeMillis() < ((xpGainATS * 1000) + 250) || player.getGameMode().equals(GameMode.CREATIVE)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -306,7 +306,7 @@ public class EntityListener implements Listener {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
PP.addXP(SkillType.TAMING, xp);
|
PP.addXP(player, SkillType.TAMING, xp);
|
||||||
Skills.XpCheckSkill(SkillType.TAMING, player);
|
Skills.XpCheckSkill(SkillType.TAMING, player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ public class GainXp implements Runnable {
|
|||||||
damage += health;
|
damage += health;
|
||||||
}
|
}
|
||||||
|
|
||||||
PP.addXP(skillType, (int) (damage * baseXp));
|
PP.addXP(player, skillType, (int) (damage * baseXp));
|
||||||
Skills.XpCheckSkill(skillType, player);
|
Skills.XpCheckSkill(skillType, player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -99,7 +99,7 @@ public class Excavation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Handle XP related tasks
|
//Handle XP related tasks
|
||||||
PP.addXP(SkillType.EXCAVATION, xp);
|
PP.addXP(player, SkillType.EXCAVATION, xp);
|
||||||
Skills.XpCheckSkill(SkillType.EXCAVATION, player);
|
Skills.XpCheckSkill(SkillType.EXCAVATION, player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,7 +103,7 @@ public class Fishing {
|
|||||||
FishingTreasure treasure = rewards.get(random.nextInt(rewards.size()));
|
FishingTreasure treasure = rewards.get(random.nextInt(rewards.size()));
|
||||||
|
|
||||||
if (random.nextDouble() * 100 <= treasure.getDropChance()) {
|
if (random.nextDouble() * 100 <= treasure.getDropChance()) {
|
||||||
Users.getProfile(player).addXP(SkillType.FISHING, treasure.getXp());
|
Users.getProfile(player).addXP(player, SkillType.FISHING, treasure.getXp());
|
||||||
theCatch.setItemStack(treasure.getDrop());
|
theCatch.setItemStack(treasure.getDrop());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -117,7 +117,7 @@ public class Fishing {
|
|||||||
theCatch.getItemStack().setDurability((short) (random.nextInt(maxDurability))); //Change durability to random value
|
theCatch.getItemStack().setDurability((short) (random.nextInt(maxDurability))); //Change durability to random value
|
||||||
}
|
}
|
||||||
|
|
||||||
PP.addXP(SkillType.FISHING, Config.getInstance().getFishingBaseXP());
|
PP.addXP(player, SkillType.FISHING, Config.getInstance().getFishingBaseXP());
|
||||||
Skills.XpCheckSkill(SkillType.FISHING, player);
|
Skills.XpCheckSkill(SkillType.FISHING, player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -269,7 +269,7 @@ public class Herbalism {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PP.addXP(SkillType.HERBALISM, xp);
|
PP.addXP(player, SkillType.HERBALISM, xp);
|
||||||
Skills.XpCheckSkill(SkillType.HERBALISM, player);
|
Skills.XpCheckSkill(SkillType.HERBALISM, player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -201,7 +201,7 @@ public class Mining {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
PP.addXP(SkillType.MINING, xp);
|
PP.addXP(player, SkillType.MINING, xp);
|
||||||
Skills.XpCheckSkill(SkillType.MINING, player);
|
Skills.XpCheckSkill(SkillType.MINING, player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -160,7 +160,7 @@ public class WoodCutting {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (Permissions.getInstance().woodcutting(player)) {
|
if (Permissions.getInstance().woodcutting(player)) {
|
||||||
PP.addXP(SkillType.WOODCUTTING, xp); //Tree Feller gives nerf'd XP
|
PP.addXP(player, SkillType.WOODCUTTING, xp); //Tree Feller gives nerf'd XP
|
||||||
Skills.XpCheckSkill(SkillType.WOODCUTTING, player);
|
Skills.XpCheckSkill(SkillType.WOODCUTTING, player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -322,7 +322,7 @@ public class WoodCutting {
|
|||||||
}
|
}
|
||||||
|
|
||||||
WoodCutting.woodCuttingProcCheck(player, block);
|
WoodCutting.woodCuttingProcCheck(player, block);
|
||||||
PP.addXP(SkillType.WOODCUTTING, xp);
|
PP.addXP(player, SkillType.WOODCUTTING, xp);
|
||||||
Skills.XpCheckSkill(SkillType.WOODCUTTING, player);
|
Skills.XpCheckSkill(SkillType.WOODCUTTING, player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ public class Acrobatics {
|
|||||||
|
|
||||||
/* Check for death */
|
/* Check for death */
|
||||||
if (health - damage >= 1) {
|
if (health - damage >= 1) {
|
||||||
PP.addXP(SkillType.ACROBATICS, damage * ROLL_XP_MODIFIER);
|
PP.addXP(player, SkillType.ACROBATICS, damage * ROLL_XP_MODIFIER);
|
||||||
Skills.XpCheckSkill(SkillType.ACROBATICS, player);
|
Skills.XpCheckSkill(SkillType.ACROBATICS, player);
|
||||||
|
|
||||||
event.setDamage(newDamage);
|
event.setDamage(newDamage);
|
||||||
@ -77,7 +77,7 @@ public class Acrobatics {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (health - damage >= 1) {
|
else if (health - damage >= 1) {
|
||||||
PP.addXP(SkillType.ACROBATICS, event.getDamage() * FALL_XP_MODIFIER);
|
PP.addXP(player, SkillType.ACROBATICS, event.getDamage() * FALL_XP_MODIFIER);
|
||||||
Skills.XpCheckSkill(SkillType.ACROBATICS, player);
|
Skills.XpCheckSkill(SkillType.ACROBATICS, player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -112,7 +112,7 @@ public class Acrobatics {
|
|||||||
defender.sendMessage(LocaleLoader.getString("Acrobatics.Combat.Proc"));
|
defender.sendMessage(LocaleLoader.getString("Acrobatics.Combat.Proc"));
|
||||||
|
|
||||||
if (System.currentTimeMillis() >= (5000 + PPd.getRespawnATS()) && defender.getHealth() >= 1) {
|
if (System.currentTimeMillis() >= (5000 + PPd.getRespawnATS()) && defender.getHealth() >= 1) {
|
||||||
PPd.addXP(SkillType.ACROBATICS, damage * DODGE_MODIFIER);
|
PPd.addXP(defender, SkillType.ACROBATICS, damage * DODGE_MODIFIER);
|
||||||
Skills.XpCheckSkill(SkillType.ACROBATICS, defender);
|
Skills.XpCheckSkill(SkillType.ACROBATICS, defender);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,7 +139,7 @@ public class Repair {
|
|||||||
dif = (short) (dif / 2);
|
dif = (short) (dif / 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
PP.addXP(SkillType.REPAIR, dif * 10);
|
PP.addXP(player, SkillType.REPAIR, dif * 10);
|
||||||
Skills.XpCheckSkill(SkillType.REPAIR, player);
|
Skills.XpCheckSkill(SkillType.REPAIR, player);
|
||||||
|
|
||||||
//CLANG CLANG
|
//CLANG CLANG
|
||||||
|
Loading…
Reference in New Issue
Block a user