mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-24 22:26:46 +01:00
Added Player to addXP arguments, avoids getPlayer call
This commit is contained in:
parent
116adb1167
commit
52cbd15dea
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1008,13 +1008,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 = Bukkit.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;
|
||||||
}
|
}
|
||||||
|
@ -309,7 +309,7 @@ public class mcEntityListener 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,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);
|
||||||
@ -76,7 +76,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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -111,7 +111,7 @@ public class Acrobatics {
|
|||||||
defender.sendMessage(mcLocale.getString("Acrobatics.Dodge"));
|
defender.sendMessage(mcLocale.getString("Acrobatics.Dodge"));
|
||||||
|
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,7 +120,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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,7 +102,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, LoadProperties.mfishing);
|
PP.addXP(player, SkillType.FISHING, LoadProperties.mfishing);
|
||||||
Skills.XpCheckSkill(SkillType.FISHING, player);
|
Skills.XpCheckSkill(SkillType.FISHING, player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -252,7 +252,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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,7 +145,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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,7 +138,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
|
||||||
|
@ -156,7 +156,7 @@ public class WoodCutting {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -301,7 +301,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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user