Using doubles in most places again to avoid precision loss

This commit is contained in:
nossr50 2019-06-04 21:12:10 -07:00
parent 32fa6cee96
commit fc6c6ed2c4
59 changed files with 382 additions and 351 deletions

View File

@ -42,7 +42,7 @@ public final class ExperienceAPI {
* @param primarySkillType target skill * @param primarySkillType target skill
* @return this players personal XP rate for target PrimarySkillType * @return this players personal XP rate for target PrimarySkillType
*/ */
public float getPlayersPersonalXPRate(McMMOPlayer player, PrimarySkillType primarySkillType) { public double getPlayersPersonalXPRate(McMMOPlayer player, PrimarySkillType primarySkillType) {
//First check if the player has ANY of the custom perks //First check if the player has ANY of the custom perks
return player.getPlayerSpecificXPMult(primarySkillType); return player.getPlayerSpecificXPMult(primarySkillType);
} }
@ -65,7 +65,7 @@ public final class ExperienceAPI {
@Deprecated @Deprecated
public static void addRawXP(Player player, String skillType, int XP) { public static void addRawXP(Player player, String skillType, int XP) {
addRawXP(player, skillType, (float) XP); addRawXP(player, skillType, (double) XP);
} }
/** /**
@ -79,7 +79,7 @@ public final class ExperienceAPI {
* @throws InvalidSkillException if the given skill is not valid * @throws InvalidSkillException if the given skill is not valid
*/ */
@Deprecated @Deprecated
public static void addRawXP(Player player, String skillType, float XP) { public static void addRawXP(Player player, String skillType, double XP) {
addRawXP(player, skillType, XP, "UNKNOWN"); addRawXP(player, skillType, XP, "UNKNOWN");
} }
@ -95,7 +95,7 @@ public final class ExperienceAPI {
* @throws InvalidSkillException if the given skill is not valid * @throws InvalidSkillException if the given skill is not valid
* @throws InvalidXPGainReasonException if the given xpGainReason is not valid * @throws InvalidXPGainReasonException if the given xpGainReason is not valid
*/ */
public static void addRawXP(Player player, String skillType, float XP, String xpGainReason) { public static void addRawXP(Player player, String skillType, double XP, String xpGainReason) {
addRawXP(player, skillType, XP, xpGainReason, false); addRawXP(player, skillType, XP, xpGainReason, false);
} }
@ -112,7 +112,7 @@ public final class ExperienceAPI {
* @throws InvalidSkillException if the given skill is not valid * @throws InvalidSkillException if the given skill is not valid
* @throws InvalidXPGainReasonException if the given xpGainReason is not valid * @throws InvalidXPGainReasonException if the given xpGainReason is not valid
*/ */
public static void addRawXP(Player player, String skillType, float XP, String xpGainReason, boolean isUnshared) { public static void addRawXP(Player player, String skillType, double XP, String xpGainReason, boolean isUnshared) {
if (isUnshared) { if (isUnshared) {
getPlayer(player).beginUnsharedXpGain(getSkillType(skillType), XP, getXPGainReason(xpGainReason), XPGainSource.CUSTOM); getPlayer(player).beginUnsharedXpGain(getSkillType(skillType), XP, getXPGainReason(xpGainReason), XPGainSource.CUSTOM);
return; return;
@ -126,12 +126,12 @@ public final class ExperienceAPI {
* </br> * </br>
* This function is designed for API usage. * This function is designed for API usage.
* *
* @deprecated We're using float for our XP values now * @deprecated We're using double for our XP values now
* replaced by {@link #addRawXPOffline(String playerName, String skillType, float XP)} * replaced by {@link #addRawXPOffline(String playerName, String skillType, double XP)}
*/ */
@Deprecated @Deprecated
public static void addRawXPOffline(String playerName, String skillType, int XP) { public static void addRawXPOffline(String playerName, String skillType, int XP) {
addRawXPOffline(playerName, skillType, (float) XP); addRawXPOffline(playerName, skillType, (double) XP);
} }
/** /**
@ -145,10 +145,10 @@ public final class ExperienceAPI {
* @throws InvalidSkillException if the given skill is not valid * @throws InvalidSkillException if the given skill is not valid
* @throws InvalidPlayerException if the given player does not exist in the database * @throws InvalidPlayerException if the given player does not exist in the database
* @deprecated We're using uuids to get an offline player * @deprecated We're using uuids to get an offline player
* replaced by {@link #addRawXPOffline(UUID uuid, String skillType, float XP)} * replaced by {@link #addRawXPOffline(UUID uuid, String skillType, double XP)}
*/ */
@Deprecated @Deprecated
public static void addRawXPOffline(String playerName, String skillType, float XP) { public static void addRawXPOffline(String playerName, String skillType, double XP) {
addOfflineXP(playerName, getSkillType(skillType), (int) Math.floor(XP)); addOfflineXP(playerName, getSkillType(skillType), (int) Math.floor(XP));
} }
@ -163,7 +163,7 @@ public final class ExperienceAPI {
* @throws InvalidSkillException if the given skill is not valid * @throws InvalidSkillException if the given skill is not valid
* @throws InvalidPlayerException if the given player does not exist in the database * @throws InvalidPlayerException if the given player does not exist in the database
*/ */
public static void addRawXPOffline(UUID uuid, String skillType, float XP) { public static void addRawXPOffline(UUID uuid, String skillType, double XP) {
addOfflineXP(uuid, getSkillType(skillType), (int) Math.floor(XP)); addOfflineXP(uuid, getSkillType(skillType), (int) Math.floor(XP));
} }
@ -402,7 +402,7 @@ public final class ExperienceAPI {
* @throws InvalidSkillException if the given skill is not valid * @throws InvalidSkillException if the given skill is not valid
* @throws UnsupportedOperationException if the given skill is a child skill * @throws UnsupportedOperationException if the given skill is a child skill
*/ */
public static float getXPRaw(Player player, String skillType) { public static double getXPRaw(Player player, String skillType) {
return getPlayer(player).getSkillXpLevelRaw(getNonChildSkillType(skillType)); return getPlayer(player).getSkillXpLevelRaw(getNonChildSkillType(skillType));
} }
@ -419,7 +419,7 @@ public final class ExperienceAPI {
* @throws UnsupportedOperationException if the given skill is a child skill * @throws UnsupportedOperationException if the given skill is a child skill
*/ */
@Deprecated @Deprecated
public static float getOfflineXPRaw(String playerName, String skillType) { public static double getOfflineXPRaw(String playerName, String skillType) {
return getOfflineProfile(playerName).getSkillXpLevelRaw(getNonChildSkillType(skillType)); return getOfflineProfile(playerName).getSkillXpLevelRaw(getNonChildSkillType(skillType));
} }
@ -435,7 +435,7 @@ public final class ExperienceAPI {
* @throws InvalidPlayerException if the given player does not exist in the database * @throws InvalidPlayerException if the given player does not exist in the database
* @throws UnsupportedOperationException if the given skill is a child skill * @throws UnsupportedOperationException if the given skill is a child skill
*/ */
public static float getOfflineXPRaw(UUID uuid, String skillType) { public static double getOfflineXPRaw(UUID uuid, String skillType) {
return getOfflineProfile(uuid).getSkillXpLevelRaw(getNonChildSkillType(skillType)); return getOfflineProfile(uuid).getSkillXpLevelRaw(getNonChildSkillType(skillType));
} }
@ -538,7 +538,7 @@ public final class ExperienceAPI {
* @throws InvalidPlayerException if the given player does not exist in the database * @throws InvalidPlayerException if the given player does not exist in the database
* @throws UnsupportedOperationException if the given skill is a child skill * @throws UnsupportedOperationException if the given skill is a child skill
*/ */
public static float getOfflineXPRemaining(UUID uuid, String skillType) { public static double getOfflineXPRemaining(UUID uuid, String skillType) {
PrimarySkillType skill = getNonChildSkillType(skillType); PrimarySkillType skill = getNonChildSkillType(skillType);
PlayerProfile profile = getOfflineProfile(uuid); PlayerProfile profile = getOfflineProfile(uuid);

View File

@ -22,7 +22,7 @@ public class AddlevelsCommand extends ExperienceCommand {
@Override @Override
protected void handleCommand(Player player, PlayerProfile profile, PrimarySkillType skill, int value) { protected void handleCommand(Player player, PlayerProfile profile, PrimarySkillType skill, int value) {
float xpRemoved = profile.getSkillXpLevelRaw(skill); double xpRemoved = profile.getSkillXpLevelRaw(skill);
profile.addLevels(skill, value); profile.addLevels(skill, value);
if (player == null) { if (player == null) {

View File

@ -23,7 +23,7 @@ public class MmoeditCommand extends ExperienceCommand {
@Override @Override
protected void handleCommand(Player player, PlayerProfile profile, PrimarySkillType skill, int value) { protected void handleCommand(Player player, PlayerProfile profile, PrimarySkillType skill, int value) {
int skillLevel = profile.getSkillLevel(skill); int skillLevel = profile.getSkillLevel(skill);
float xpRemoved = profile.getSkillXpLevelRaw(skill); double xpRemoved = profile.getSkillXpLevelRaw(skill);
profile.modifySkill(skill, value); profile.modifySkill(skill, value);

View File

@ -122,7 +122,7 @@ public class SkillresetCommand implements TabExecutor {
protected void handleCommand(Player player, PlayerProfile profile, PrimarySkillType skill) { protected void handleCommand(Player player, PlayerProfile profile, PrimarySkillType skill) {
int levelsRemoved = profile.getSkillLevel(skill); int levelsRemoved = profile.getSkillLevel(skill);
float xpRemoved = profile.getSkillXpLevelRaw(skill); double xpRemoved = profile.getSkillXpLevelRaw(skill);
profile.modifySkill(skill, 0); profile.modifySkill(skill, 0);

View File

@ -26,7 +26,7 @@ public class AcrobaticsCommand extends SkillCommand {
} }
@Override @Override
protected void dataCalculations(Player player, float skillValue) { protected void dataCalculations(Player player, double skillValue) {
// ACROBATICS_DODGE // ACROBATICS_DODGE
if (canDodge) { if (canDodge) {
String[] dodgeStrings = getAbilityDisplayValues(player, SubSkillType.ACROBATICS_DODGE); String[] dodgeStrings = getAbilityDisplayValues(player, SubSkillType.ACROBATICS_DODGE);
@ -42,7 +42,7 @@ public class AcrobaticsCommand extends SkillCommand {
} }
@Override @Override
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) { protected List<String> statsDisplay(Player player, double skillValue, boolean hasEndurance, boolean isLucky) {
List<String> messages = new ArrayList<>(); List<String> messages = new ArrayList<>();
if (canDodge) { if (canDodge) {

View File

@ -42,7 +42,7 @@
//// } //// }
// //
// @Override // @Override
// protected void dataCalculations(Player player, float skillValue) { // protected void dataCalculations(Player player, double skillValue) {
// // ALCHEMY_CATALYSIS // // ALCHEMY_CATALYSIS
//// if (canCatalysis) { //// if (canCatalysis) {
//// String[] catalysisStrings = calculateAbilityDisplayValues(player); //// String[] catalysisStrings = calculateAbilityDisplayValues(player);
@ -66,7 +66,7 @@
// } // }
// //
// @Override // @Override
// protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) { // protected List<String> statsDisplay(Player player, double skillValue, boolean hasEndurance, boolean isLucky) {
// List<String> messages = new ArrayList<>(); // List<String> messages = new ArrayList<>();
// //
//// if (canCatalysis) { //// if (canCatalysis) {

View File

@ -28,7 +28,7 @@ public class ArcheryCommand extends SkillCommand {
} }
@Override @Override
protected void dataCalculations(Player player, float skillValue) { protected void dataCalculations(Player player, double skillValue) {
// ARCHERY_ARROW_RETRIEVAL // ARCHERY_ARROW_RETRIEVAL
if (canRetrieve) { if (canRetrieve) {
String[] retrieveStrings = getAbilityDisplayValues(player, SubSkillType.ARCHERY_ARROW_RETRIEVAL); String[] retrieveStrings = getAbilityDisplayValues(player, SubSkillType.ARCHERY_ARROW_RETRIEVAL);
@ -57,7 +57,7 @@ public class ArcheryCommand extends SkillCommand {
} }
@Override @Override
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) { protected List<String> statsDisplay(Player player, double skillValue, boolean hasEndurance, boolean isLucky) {
List<String> messages = new ArrayList<>(); List<String> messages = new ArrayList<>();
if (canRetrieve) { if (canRetrieve) {

View File

@ -35,7 +35,7 @@ public class AxesCommand extends SkillCommand {
} }
@Override @Override
protected void dataCalculations(Player player, float skillValue) { protected void dataCalculations(Player player, double skillValue) {
// ARMOR IMPACT // ARMOR IMPACT
if (canImpact) { if (canImpact) {
impactDamage = UserManager.getPlayer(player).getAxesManager().getImpactDurabilityDamage(); impactDamage = UserManager.getPlayer(player).getAxesManager().getImpactDurabilityDamage();
@ -71,7 +71,7 @@ public class AxesCommand extends SkillCommand {
} }
@Override @Override
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) { protected List<String> statsDisplay(Player player, double skillValue, boolean hasEndurance, boolean isLucky) {
List<String> messages = new ArrayList<>(); List<String> messages = new ArrayList<>();
if (canImpact) { if (canImpact) {

View File

@ -24,7 +24,7 @@ public class ExcavationCommand extends SkillCommand {
} }
@Override @Override
protected void dataCalculations(Player player, float skillValue) { protected void dataCalculations(Player player, double skillValue) {
// GIGA DRILL BREAKER // GIGA DRILL BREAKER
if (canGigaDrill) { if (canGigaDrill) {
String[] gigaDrillStrings = calculateLengthDisplayValues(player, skillValue); String[] gigaDrillStrings = calculateLengthDisplayValues(player, skillValue);
@ -40,7 +40,7 @@ public class ExcavationCommand extends SkillCommand {
} }
@Override @Override
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) { protected List<String> statsDisplay(Player player, double skillValue, boolean hasEndurance, boolean isLucky) {
List<String> messages = new ArrayList<>(); List<String> messages = new ArrayList<>();
if (canGigaDrill) { if (canGigaDrill) {

View File

@ -51,7 +51,7 @@ public class FishingCommand extends SkillCommand {
} }
@Override @Override
protected void dataCalculations(Player player, float skillValue) { protected void dataCalculations(Player player, double skillValue) {
FishingManager fishingManager = UserManager.getPlayer(player).getFishingManager(); FishingManager fishingManager = UserManager.getPlayer(player).getFishingManager();
// TREASURE HUNTER // TREASURE HUNTER
@ -133,7 +133,7 @@ public class FishingCommand extends SkillCommand {
} }
@Override @Override
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) { protected List<String> statsDisplay(Player player, double skillValue, boolean hasEndurance, boolean isLucky) {
List<String> messages = new ArrayList<>(); List<String> messages = new ArrayList<>();
if (canFishermansDiet) { if (canFishermansDiet) {

View File

@ -40,7 +40,7 @@ public class HerbalismCommand extends SkillCommand {
} }
@Override @Override
protected void dataCalculations(Player player, float skillValue) { protected void dataCalculations(Player player, double skillValue) {
// DOUBLE DROPS // DOUBLE DROPS
if (canDoubleDrop) { if (canDoubleDrop) {
@ -97,7 +97,7 @@ public class HerbalismCommand extends SkillCommand {
} }
@Override @Override
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) { protected List<String> statsDisplay(Player player, double skillValue, boolean hasEndurance, boolean isLucky) {
List<String> messages = new ArrayList<>(); List<String> messages = new ArrayList<>();
if (canDoubleDrop) { if (canDoubleDrop) {

View File

@ -38,7 +38,7 @@ public class MiningCommand extends SkillCommand {
} }
@Override @Override
protected void dataCalculations(Player player, float skillValue) { protected void dataCalculations(Player player, double skillValue) {
// BLAST MINING // BLAST MINING
if (canBlast || canDemoExpert || canBiggerBombs) { if (canBlast || canDemoExpert || canBiggerBombs) {
MiningManager miningManager = UserManager.getPlayer(player).getMiningManager(); MiningManager miningManager = UserManager.getPlayer(player).getMiningManager();
@ -76,7 +76,7 @@ public class MiningCommand extends SkillCommand {
} }
@Override @Override
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) { protected List<String> statsDisplay(Player player, double skillValue, boolean hasEndurance, boolean isLucky) {
List<String> messages = new ArrayList<>(); List<String> messages = new ArrayList<>();
if (canBiggerBombs) { if (canBiggerBombs) {

View File

@ -46,7 +46,7 @@ public class RepairCommand extends SkillCommand {
} }
@Override @Override
protected void dataCalculations(Player player, float skillValue) { protected void dataCalculations(Player player, double skillValue) {
// We're using pickaxes here, not the best but it works // We're using pickaxes here, not the best but it works
Repairable diamondRepairable = mcMMO.getRepairableManager().getRepairable(Material.DIAMOND_PICKAXE); Repairable diamondRepairable = mcMMO.getRepairableManager().getRepairable(Material.DIAMOND_PICKAXE);
Repairable goldRepairable = mcMMO.getRepairableManager().getRepairable(Material.GOLDEN_PICKAXE); Repairable goldRepairable = mcMMO.getRepairableManager().getRepairable(Material.GOLDEN_PICKAXE);
@ -88,7 +88,7 @@ public class RepairCommand extends SkillCommand {
} }
@Override @Override
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) { protected List<String> statsDisplay(Player player, double skillValue, boolean hasEndurance, boolean isLucky) {
List<String> messages = new ArrayList<>(); List<String> messages = new ArrayList<>();
if (canArcaneForge) { if (canArcaneForge) {

View File

@ -23,7 +23,7 @@ public class SalvageCommand extends SkillCommand {
} }
@Override @Override
protected void dataCalculations(Player player, float skillValue) { protected void dataCalculations(Player player, double skillValue) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
} }
@ -35,7 +35,7 @@ public class SalvageCommand extends SkillCommand {
} }
@Override @Override
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) { protected List<String> statsDisplay(Player player, double skillValue, boolean hasEndurance, boolean isLucky) {
List<String> messages = new ArrayList<>(); List<String> messages = new ArrayList<>();
SalvageManager salvageManager = UserManager.getPlayer(player).getSalvageManager(); SalvageManager salvageManager = UserManager.getPlayer(player).getSalvageManager();

View File

@ -76,7 +76,7 @@ public abstract class SkillCommand implements TabExecutor {
boolean isLucky = Permissions.lucky(player, skill); boolean isLucky = Permissions.lucky(player, skill);
boolean hasEndurance = (PerksUtils.handleActivationPerks(player, 0, 0) != 0); boolean hasEndurance = (PerksUtils.handleActivationPerks(player, 0, 0) != 0);
float skillValue = mcMMOPlayer.getSkillLevel(skill); double skillValue = mcMMOPlayer.getSkillLevel(skill);
//Send the players a few blank lines to make finding the top of the skill command easier //Send the players a few blank lines to make finding the top of the skill command easier
if (AdvancedConfig.getInstance().doesSkillCommandSendBlankLines()) if (AdvancedConfig.getInstance().doesSkillCommandSendBlankLines())
@ -129,7 +129,7 @@ public abstract class SkillCommand implements TabExecutor {
} }
} }
private void getStatMessages(Player player, boolean isLucky, boolean hasEndurance, float skillValue) { private void getStatMessages(Player player, boolean isLucky, boolean hasEndurance, double skillValue) {
List<String> statsMessages = statsDisplay(player, skillValue, hasEndurance, isLucky); List<String> statsMessages = statsDisplay(player, skillValue, hasEndurance, isLucky);
if (!statsMessages.isEmpty()) { if (!statsMessages.isEmpty()) {
@ -224,7 +224,7 @@ public abstract class SkillCommand implements TabExecutor {
} }
} }
protected int calculateRank(float skillValue, int maxLevel, int rankChangeLevel) { protected int calculateRank(double skillValue, int maxLevel, int rankChangeLevel) {
return Math.min((int) skillValue, maxLevel) / rankChangeLevel; return Math.min((int) skillValue, maxLevel) / rankChangeLevel;
} }
@ -232,7 +232,7 @@ public abstract class SkillCommand implements TabExecutor {
return RandomChanceUtil.calculateAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, subSkill); return RandomChanceUtil.calculateAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, subSkill);
} }
protected String[] calculateLengthDisplayValues(Player player, float skillValue) { protected String[] calculateLengthDisplayValues(Player player, double skillValue) {
int maxLength = skill.getAbility().getMaxLength(); int maxLength = skill.getAbility().getMaxLength();
int abilityLengthVar = AdvancedConfig.getInstance().getAbilityLength(); int abilityLengthVar = AdvancedConfig.getInstance().getAbilityLength();
int abilityLengthCap = AdvancedConfig.getInstance().getAbilityLengthCap(); int abilityLengthCap = AdvancedConfig.getInstance().getAbilityLengthCap();
@ -270,13 +270,13 @@ public abstract class SkillCommand implements TabExecutor {
} }
} }
protected abstract void dataCalculations(Player player, float skillValue); protected abstract void dataCalculations(Player player, double skillValue);
protected abstract void permissionsCheck(Player player); protected abstract void permissionsCheck(Player player);
//protected abstract List<String> effectsDisplay(); //protected abstract List<String> effectsDisplay();
protected abstract List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky); protected abstract List<String> statsDisplay(Player player, double skillValue, boolean hasEndurance, boolean isLucky);
protected abstract List<TextComponent> getTextComponents(Player player); protected abstract List<TextComponent> getTextComponents(Player player);

View File

@ -30,7 +30,7 @@ public class SmeltingCommand extends SkillCommand {
} }
@Override @Override
protected void dataCalculations(Player player, float skillValue) { protected void dataCalculations(Player player, double skillValue) {
// FUEL EFFICIENCY // FUEL EFFICIENCY
if (canFuelEfficiency) { if (canFuelEfficiency) {
burnTimeModifier = String.valueOf(UserManager.getPlayer(player).getSmeltingManager().getFuelEfficiencyMultiplier()); burnTimeModifier = String.valueOf(UserManager.getPlayer(player).getSmeltingManager().getFuelEfficiencyMultiplier());
@ -60,7 +60,7 @@ public class SmeltingCommand extends SkillCommand {
} }
@Override @Override
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) { protected List<String> statsDisplay(Player player, double skillValue, boolean hasEndurance, boolean isLucky) {
List<String> messages = new ArrayList<>(); List<String> messages = new ArrayList<>();
/*if (canFluxMine) { /*if (canFluxMine) {

View File

@ -33,7 +33,7 @@ public class SwordsCommand extends SkillCommand {
} }
@Override @Override
protected void dataCalculations(Player player, float skillValue) { protected void dataCalculations(Player player, double skillValue) {
// SWORDS_COUNTER_ATTACK // SWORDS_COUNTER_ATTACK
if (canCounter) { if (canCounter) {
String[] counterStrings = getAbilityDisplayValues(player, SubSkillType.SWORDS_COUNTER_ATTACK); String[] counterStrings = getAbilityDisplayValues(player, SubSkillType.SWORDS_COUNTER_ATTACK);
@ -66,7 +66,7 @@ public class SwordsCommand extends SkillCommand {
} }
@Override @Override
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) { protected List<String> statsDisplay(Player player, double skillValue, boolean hasEndurance, boolean isLucky) {
List<String> messages = new ArrayList<>(); List<String> messages = new ArrayList<>();
int ruptureTicks = UserManager.getPlayer(player).getSwordsManager().getRuptureBleedTicks(); int ruptureTicks = UserManager.getPlayer(player).getSwordsManager().getRuptureBleedTicks();

View File

@ -32,7 +32,7 @@ public class TamingCommand extends SkillCommand {
} }
@Override @Override
protected void dataCalculations(Player player, float skillValue) { protected void dataCalculations(Player player, double skillValue) {
if (canGore) { if (canGore) {
String[] goreStrings = getAbilityDisplayValues(player, SubSkillType.TAMING_GORE); String[] goreStrings = getAbilityDisplayValues(player, SubSkillType.TAMING_GORE);
goreChance = goreStrings[0]; goreChance = goreStrings[0];
@ -54,7 +54,7 @@ public class TamingCommand extends SkillCommand {
} }
@Override @Override
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) { protected List<String> statsDisplay(Player player, double skillValue, boolean hasEndurance, boolean isLucky) {
List<String> messages = new ArrayList<>(); List<String> messages = new ArrayList<>();
if (canEnvironmentallyAware) { if (canEnvironmentallyAware) {

View File

@ -36,7 +36,7 @@ public class UnarmedCommand extends SkillCommand {
} }
@Override @Override
protected void dataCalculations(Player player, float skillValue) { protected void dataCalculations(Player player, double skillValue) {
// UNARMED_ARROW_DEFLECT // UNARMED_ARROW_DEFLECT
if (canDeflect) { if (canDeflect) {
String[] deflectStrings = getAbilityDisplayValues(player, SubSkillType.UNARMED_ARROW_DEFLECT); String[] deflectStrings = getAbilityDisplayValues(player, SubSkillType.UNARMED_ARROW_DEFLECT);
@ -82,7 +82,7 @@ public class UnarmedCommand extends SkillCommand {
} }
@Override @Override
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) { protected List<String> statsDisplay(Player player, double skillValue, boolean hasEndurance, boolean isLucky) {
List<String> messages = new ArrayList<>(); List<String> messages = new ArrayList<>();
if (canDeflect) { if (canDeflect) {

View File

@ -30,7 +30,7 @@ public class WoodcuttingCommand extends SkillCommand {
} }
@Override @Override
protected void dataCalculations(Player player, float skillValue) { protected void dataCalculations(Player player, double skillValue) {
// DOUBLE DROPS // DOUBLE DROPS
if (canDoubleDrop) { if (canDoubleDrop) {
setDoubleDropClassicChanceStrings(player); setDoubleDropClassicChanceStrings(player);
@ -61,7 +61,7 @@ public class WoodcuttingCommand extends SkillCommand {
} }
@Override @Override
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) { protected List<String> statsDisplay(Player player, double skillValue, boolean hasEndurance, boolean isLucky) {
List<String> messages = new ArrayList<>(); List<String> messages = new ArrayList<>();
if (canDoubleDrop) { if (canDoubleDrop) {

View File

@ -56,7 +56,7 @@ public class ConfigExploitPrevention {
return getConfigSectionExploitFishing().getFishingRodSpamMilliseconds(); return getConfigSectionExploitFishing().getFishingRodSpamMilliseconds();
} }
public float getOverFishingAreaSize() { public double getOverFishingAreaSize() {
return getConfigSectionExploitFishing().getOverFishingAreaSize(); return getConfigSectionExploitFishing().getOverFishingAreaSize();
} }

View File

@ -8,7 +8,7 @@ public class ConfigSectionExploitFishing {
public static final int OVER_FISHING_LIMIT_DEFAULT = 10; public static final int OVER_FISHING_LIMIT_DEFAULT = 10;
public static final boolean ADMINS_OVER_FISHING_DEFAULT = true; public static final boolean ADMINS_OVER_FISHING_DEFAULT = true;
public static final float OVER_FISHING_SIZE = 1.0F; public static final double OVER_FISHING_SIZE = 1.0;
public static final int FISHING_ROD_SPAM_THRESHOLD_MILLISECONDS_DEFAULT = 200; public static final int FISHING_ROD_SPAM_THRESHOLD_MILLISECONDS_DEFAULT = 200;
private static final boolean PREVENT_FISHING_EXPLOITS_DEFAULT = true; private static final boolean PREVENT_FISHING_EXPLOITS_DEFAULT = true;
@Setting(value = "Prevent-Fishing-AFK-Farming", @Setting(value = "Prevent-Fishing-AFK-Farming",
@ -32,7 +32,7 @@ public class ConfigSectionExploitFishing {
"\nWhen you catch a new fish it makes a new bounding box at that location and checks to see if it overlaps with the bounding box of the last place you caught a fish," + "\nWhen you catch a new fish it makes a new bounding box at that location and checks to see if it overlaps with the bounding box of the last place you caught a fish," +
"\n if they intersect then that increases your fish counter, if you are at your fishing limit then you get nothing." + "\n if they intersect then that increases your fish counter, if you are at your fishing limit then you get nothing." +
"\nDefault value: " + OVER_FISHING_SIZE) "\nDefault value: " + OVER_FISHING_SIZE)
private float overFishingAreaSize = OVER_FISHING_SIZE; private double overFishingAreaSize = OVER_FISHING_SIZE;
@Setting(value = "Alert-Admins-To-Overfishing-Abuse", comment = "If someone is triggering over-fishing exploit detection too often, alert admins." + @Setting(value = "Alert-Admins-To-Overfishing-Abuse", comment = "If someone is triggering over-fishing exploit detection too often, alert admins." +
"\nThis will send a message to ops in game and to the console, and to anyone with the admin chat permission node." + "\nThis will send a message to ops in game and to the console, and to anyone with the admin chat permission node." +
@ -49,7 +49,7 @@ public class ConfigSectionExploitFishing {
return fishingRodSpamMilliseconds; return fishingRodSpamMilliseconds;
} }
public float getOverFishingAreaSize() { public double getOverFishingAreaSize() {
return overFishingAreaSize; return overFishingAreaSize;
} }

View File

@ -34,7 +34,7 @@ public class ConfigSectionExploitSkills {
return configSectionExploitFishing.getFishingRodSpamMilliseconds(); return configSectionExploitFishing.getFishingRodSpamMilliseconds();
} }
public float getOverFishingAreaSize() { public double getOverFishingAreaSize() {
return configSectionExploitFishing.getOverFishingAreaSize(); return configSectionExploitFishing.getOverFishingAreaSize();
} }

View File

@ -12,12 +12,12 @@ import java.util.HashMap;
@ConfigSerializable @ConfigSerializable
public class ConfigExperience { public class ConfigExperience {
private static final float GLOBAL_XP_MULT_DEFAULT = 1.0F; private static final double GLOBAL_XP_MULT_DEFAULT = 1.0F;
@Setting(value = "Global-XP-Multiplier", comment = "This multiplier is applied at the very end of every XP gain, you can use it as a shortcut to increase or decrease xp gains across the entire plugin" + @Setting(value = "Global-XP-Multiplier", comment = "This multiplier is applied at the very end of every XP gain, you can use it as a shortcut to increase or decrease xp gains across the entire plugin" +
"\nThis value is temporarily overridden by xprate events." + "\nThis value is temporarily overridden by xprate events." +
"\nDefault value: " + GLOBAL_XP_MULT_DEFAULT) "\nDefault value: " + GLOBAL_XP_MULT_DEFAULT)
private float globalXPMultiplier = GLOBAL_XP_MULT_DEFAULT; private double globalXPMultiplier = GLOBAL_XP_MULT_DEFAULT;
@Setting(value = "Global-Skill-XP-Multipliers", comment = "This multiplier is applied at the very end of an XP calculation specific to its corresponding skill, this value is applied before the global multiplier is applied.") @Setting(value = "Global-Skill-XP-Multipliers", comment = "This multiplier is applied at the very end of an XP calculation specific to its corresponding skill, this value is applied before the global multiplier is applied.")
private ConfigExperienceSkillMultiplier configExperienceSkillMultiplier = new ConfigExperienceSkillMultiplier(); private ConfigExperienceSkillMultiplier configExperienceSkillMultiplier = new ConfigExperienceSkillMultiplier();
@ -104,11 +104,11 @@ public class ConfigExperience {
return getConfigExperienceSkills().getSmeltingExperienceMap(); return getConfigExperienceSkills().getSmeltingExperienceMap();
} }
public float getItemMaterialXPMultiplier(ItemMaterialCategory itemMaterialCategory) { public double getItemMaterialXPMultiplier(ItemMaterialCategory itemMaterialCategory) {
return getConfigExperienceSkills().getItemMaterialXPMultiplier(itemMaterialCategory); return getConfigExperienceSkills().getItemMaterialXPMultiplier(itemMaterialCategory);
} }
public Float getRepairXPBase() { public Double getRepairXPBase() {
return getConfigExperienceSkills().getRepairXPBase(); return getConfigExperienceSkills().getRepairXPBase();
} }
@ -116,7 +116,7 @@ public class ConfigExperience {
return getConfigExperienceSkills().getAcrobaticsXPMap(); return getConfigExperienceSkills().getAcrobaticsXPMap();
} }
public Float getFeatherFallMultiplier() { public Double getFeatherFallMultiplier() {
return getConfigExperienceSkills().getFeatherFallMultiplier(); return getConfigExperienceSkills().getFeatherFallMultiplier();
} }
@ -160,15 +160,15 @@ public class ConfigExperience {
return getConfigExperienceSkills().isPvpXPEnabled(); return getConfigExperienceSkills().isPvpXPEnabled();
} }
public HashMap<String, Float> getCombatExperienceMap() { public HashMap<String, Double> getCombatExperienceMap() {
return getConfigExperienceSkills().getCombatExperienceMap(); return getConfigExperienceSkills().getCombatExperienceMap();
} }
public HashMap<SpecialXPKey, Float> getSpecialCombatExperienceMap() { public HashMap<SpecialXPKey, Double> getSpecialCombatExperienceMap() {
return configExperienceSkills.getSpecialCombatExperienceMap(); return configExperienceSkills.getSpecialCombatExperienceMap();
} }
public Float getDistanceMultiplier() { public double getDistanceMultiplier() {
return getConfigExperienceSkills().getDistanceMultiplier(); return getConfigExperienceSkills().getDistanceMultiplier();
} }
@ -196,7 +196,7 @@ public class ConfigExperience {
return configExperienceSkills; return configExperienceSkills;
} }
public Float getGlobalXPMultiplier() { public double getGlobalXPMultiplier() {
return globalXPMultiplier; return globalXPMultiplier;
} }
} }

View File

@ -9,7 +9,7 @@ import java.util.HashMap;
public class ConfigExperienceAcrobatics { public class ConfigExperienceAcrobatics {
private final static HashMap<String, Integer> ACROBATICS_DEFAULT_XP_MAP; private final static HashMap<String, Integer> ACROBATICS_DEFAULT_XP_MAP;
private static final float FEATHER_FALL_MULTIPLIER_DEFAULT = 2.0F; private static final double FEATHER_FALL_MULTIPLIER_DEFAULT = 2.0F;
static { static {
ACROBATICS_DEFAULT_XP_MAP = new HashMap<>(); ACROBATICS_DEFAULT_XP_MAP = new HashMap<>();
@ -24,13 +24,13 @@ public class ConfigExperienceAcrobatics {
@Setting(value = "Feather-Fall-XP-Multiplier", comment = "Feather Fall grants bonus XP to fall related XP gains." + @Setting(value = "Feather-Fall-XP-Multiplier", comment = "Feather Fall grants bonus XP to fall related XP gains." +
"\nThis value is multiplied against your XP to give the bonus." + "\nThis value is multiplied against your XP to give the bonus." +
"\nDefault value: " + FEATHER_FALL_MULTIPLIER_DEFAULT) "\nDefault value: " + FEATHER_FALL_MULTIPLIER_DEFAULT)
private Float featherFallMultiplier = FEATHER_FALL_MULTIPLIER_DEFAULT; private Double featherFallMultiplier = FEATHER_FALL_MULTIPLIER_DEFAULT;
public HashMap<String, Integer> getAcrobaticsXPMap() { public HashMap<String, Integer> getAcrobaticsXPMap() {
return acrobaticsXPMap; return acrobaticsXPMap;
} }
public Float getFeatherFallMultiplier() { public Double getFeatherFallMultiplier() {
return featherFallMultiplier; return featherFallMultiplier;
} }

View File

@ -6,7 +6,7 @@ import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ConfigSerializable @ConfigSerializable
public class ConfigExperienceArchery { public class ConfigExperienceArchery {
public static final float DISTANCE_MULTIPLIER_DEFAULT = 0.025F; public static final double DISTANCE_MULTIPLIER_DEFAULT = 0.025F;
@Setting(value = "Distance-Multiplier", comment = "The distance multiplier is multiplied against the distance an " + @Setting(value = "Distance-Multiplier", comment = "The distance multiplier is multiplied against the distance an " +
"arrow travels before hitting its target to determine final XP values awarded." + "arrow travels before hitting its target to determine final XP values awarded." +
@ -14,9 +14,9 @@ public class ConfigExperienceArchery {
"\nDistance is in blocks traveled." + "\nDistance is in blocks traveled." +
"\nThis value is added on to normal XP gains from damage for Archery." + "\nThis value is added on to normal XP gains from damage for Archery." +
"\nDefault value: " + DISTANCE_MULTIPLIER_DEFAULT) "\nDefault value: " + DISTANCE_MULTIPLIER_DEFAULT)
private float distanceMultiplier = DISTANCE_MULTIPLIER_DEFAULT; private double distanceMultiplier = DISTANCE_MULTIPLIER_DEFAULT;
public float getDistanceMultiplier() { public double getDistanceMultiplier() {
return distanceMultiplier; return distanceMultiplier;
} }
} }

View File

@ -9,82 +9,82 @@ import java.util.HashMap;
@ConfigSerializable @ConfigSerializable
public class ConfigExperienceCombat { public class ConfigExperienceCombat {
private static final HashMap<String, Float> COMBAT_EXPERIENCE_DEFAULT; private static final HashMap<String, Double> COMBAT_EXPERIENCE_DEFAULT;
private static final HashMap<SpecialXPKey, Float> SPECIAL_COMBAT_EXPERIENCE_DEFAULT; private static final HashMap<SpecialXPKey, Double> SPECIAL_COMBAT_EXPERIENCE_DEFAULT;
private static final boolean PVP_XP_ENABLED_DEFAULT = false; private static final boolean PVP_XP_ENABLED_DEFAULT = false;
static { static {
COMBAT_EXPERIENCE_DEFAULT = new HashMap<>(); COMBAT_EXPERIENCE_DEFAULT = new HashMap<>();
COMBAT_EXPERIENCE_DEFAULT.put("creeper", 4.0F); COMBAT_EXPERIENCE_DEFAULT.put("creeper", 4.0);
COMBAT_EXPERIENCE_DEFAULT.put("cat", 1.0F); COMBAT_EXPERIENCE_DEFAULT.put("cat", 1.0);
COMBAT_EXPERIENCE_DEFAULT.put("fox", 1.0F); COMBAT_EXPERIENCE_DEFAULT.put("fox", 1.0);
COMBAT_EXPERIENCE_DEFAULT.put("panda", 1.0F); COMBAT_EXPERIENCE_DEFAULT.put("panda", 1.0);
COMBAT_EXPERIENCE_DEFAULT.put("pillager", 2.0F); COMBAT_EXPERIENCE_DEFAULT.put("pillager", 2.0);
COMBAT_EXPERIENCE_DEFAULT.put("ravager", 4.0F); COMBAT_EXPERIENCE_DEFAULT.put("ravager", 4.0);
COMBAT_EXPERIENCE_DEFAULT.put("trader_llama", 1.0F); COMBAT_EXPERIENCE_DEFAULT.put("trader_llama", 1.0);
COMBAT_EXPERIENCE_DEFAULT.put("skeleton", 3.0F); COMBAT_EXPERIENCE_DEFAULT.put("skeleton", 3.0);
COMBAT_EXPERIENCE_DEFAULT.put("spider", 2.0F); COMBAT_EXPERIENCE_DEFAULT.put("spider", 2.0);
COMBAT_EXPERIENCE_DEFAULT.put("giant", 4.0F); COMBAT_EXPERIENCE_DEFAULT.put("giant", 4.0);
COMBAT_EXPERIENCE_DEFAULT.put("zombie", 2.0F); COMBAT_EXPERIENCE_DEFAULT.put("zombie", 2.0);
COMBAT_EXPERIENCE_DEFAULT.put("slime", 2.0F); COMBAT_EXPERIENCE_DEFAULT.put("slime", 2.0);
COMBAT_EXPERIENCE_DEFAULT.put("ghast", 3.0F); COMBAT_EXPERIENCE_DEFAULT.put("ghast", 3.0);
COMBAT_EXPERIENCE_DEFAULT.put("pig_zombie", 3.0F); COMBAT_EXPERIENCE_DEFAULT.put("pig_zombie", 3.0);
COMBAT_EXPERIENCE_DEFAULT.put("enderman", 1.0F); COMBAT_EXPERIENCE_DEFAULT.put("enderman", 1.0);
COMBAT_EXPERIENCE_DEFAULT.put("cave_spider", 3.0F); COMBAT_EXPERIENCE_DEFAULT.put("cave_spider", 3.0);
COMBAT_EXPERIENCE_DEFAULT.put("silverfish", 3.0F); COMBAT_EXPERIENCE_DEFAULT.put("silverfish", 3.0);
COMBAT_EXPERIENCE_DEFAULT.put("blaze", 3.0F); COMBAT_EXPERIENCE_DEFAULT.put("blaze", 3.0);
COMBAT_EXPERIENCE_DEFAULT.put("magma_cube", 2.0F); COMBAT_EXPERIENCE_DEFAULT.put("magma_cube", 2.0);
COMBAT_EXPERIENCE_DEFAULT.put("ender_dragon", 1.0F); COMBAT_EXPERIENCE_DEFAULT.put("ender_dragon", 1.0);
COMBAT_EXPERIENCE_DEFAULT.put("wither", 1.0F); COMBAT_EXPERIENCE_DEFAULT.put("wither", 1.0);
COMBAT_EXPERIENCE_DEFAULT.put("witch", 0.1F); COMBAT_EXPERIENCE_DEFAULT.put("witch", 0.1);
COMBAT_EXPERIENCE_DEFAULT.put("iron_golem", 2.0F); COMBAT_EXPERIENCE_DEFAULT.put("iron_golem", 2.0);
COMBAT_EXPERIENCE_DEFAULT.put("wither_skeleton", 4.0F); COMBAT_EXPERIENCE_DEFAULT.put("wither_skeleton", 4.0);
COMBAT_EXPERIENCE_DEFAULT.put("endermite", 2.0F); COMBAT_EXPERIENCE_DEFAULT.put("endermite", 2.0);
COMBAT_EXPERIENCE_DEFAULT.put("guardian", 1.0F); COMBAT_EXPERIENCE_DEFAULT.put("guardian", 1.0);
COMBAT_EXPERIENCE_DEFAULT.put("elder_guardian", 4.0F); COMBAT_EXPERIENCE_DEFAULT.put("elder_guardian", 4.0);
COMBAT_EXPERIENCE_DEFAULT.put("shulker", 2.0F); COMBAT_EXPERIENCE_DEFAULT.put("shulker", 2.0);
COMBAT_EXPERIENCE_DEFAULT.put("donkey", 1.0F); COMBAT_EXPERIENCE_DEFAULT.put("donkey", 1.0);
COMBAT_EXPERIENCE_DEFAULT.put("mule", 1.0F); COMBAT_EXPERIENCE_DEFAULT.put("mule", 1.0);
COMBAT_EXPERIENCE_DEFAULT.put("horse", 1.0F); COMBAT_EXPERIENCE_DEFAULT.put("horse", 1.0);
COMBAT_EXPERIENCE_DEFAULT.put("zombie_villager", 2.0F); COMBAT_EXPERIENCE_DEFAULT.put("zombie_villager", 2.0);
COMBAT_EXPERIENCE_DEFAULT.put("skeleton_horse", 1.0F); COMBAT_EXPERIENCE_DEFAULT.put("skeleton_horse", 1.0);
COMBAT_EXPERIENCE_DEFAULT.put("zombie_horse", 1.2F); COMBAT_EXPERIENCE_DEFAULT.put("zombie_horse", 1.2);
COMBAT_EXPERIENCE_DEFAULT.put("husk", 3.0F); COMBAT_EXPERIENCE_DEFAULT.put("husk", 3.0);
COMBAT_EXPERIENCE_DEFAULT.put("evoker", 3.0F); COMBAT_EXPERIENCE_DEFAULT.put("evoker", 3.0);
COMBAT_EXPERIENCE_DEFAULT.put("polar_bear", 2.0F); COMBAT_EXPERIENCE_DEFAULT.put("polar_bear", 2.0);
COMBAT_EXPERIENCE_DEFAULT.put("llama", 1.0F); COMBAT_EXPERIENCE_DEFAULT.put("llama", 1.0);
COMBAT_EXPERIENCE_DEFAULT.put("vindicator", 3.0F); COMBAT_EXPERIENCE_DEFAULT.put("vindicator", 3.0);
COMBAT_EXPERIENCE_DEFAULT.put("stray", 2.0F); COMBAT_EXPERIENCE_DEFAULT.put("stray", 2.0);
COMBAT_EXPERIENCE_DEFAULT.put("rabbit", 1.0F); COMBAT_EXPERIENCE_DEFAULT.put("rabbit", 1.0);
COMBAT_EXPERIENCE_DEFAULT.put("chicken", 1.0F); COMBAT_EXPERIENCE_DEFAULT.put("chicken", 1.0);
COMBAT_EXPERIENCE_DEFAULT.put("bat", 1.0F); COMBAT_EXPERIENCE_DEFAULT.put("bat", 1.0);
COMBAT_EXPERIENCE_DEFAULT.put("mushroom_cow", 1.2F); COMBAT_EXPERIENCE_DEFAULT.put("mushroom_cow", 1.2);
COMBAT_EXPERIENCE_DEFAULT.put("cow", 1.0F); COMBAT_EXPERIENCE_DEFAULT.put("cow", 1.0);
COMBAT_EXPERIENCE_DEFAULT.put("turtle", 1.0F); COMBAT_EXPERIENCE_DEFAULT.put("turtle", 1.0);
COMBAT_EXPERIENCE_DEFAULT.put("sheep", 1.0F); COMBAT_EXPERIENCE_DEFAULT.put("sheep", 1.0);
COMBAT_EXPERIENCE_DEFAULT.put("pig", 1.0F); COMBAT_EXPERIENCE_DEFAULT.put("pig", 1.0);
COMBAT_EXPERIENCE_DEFAULT.put("squid", 1.0F); COMBAT_EXPERIENCE_DEFAULT.put("squid", 1.0);
COMBAT_EXPERIENCE_DEFAULT.put("ocelot", 1.0F); COMBAT_EXPERIENCE_DEFAULT.put("ocelot", 1.0);
COMBAT_EXPERIENCE_DEFAULT.put("villager", 1.0F); COMBAT_EXPERIENCE_DEFAULT.put("villager", 1.0);
COMBAT_EXPERIENCE_DEFAULT.put("snowman", 0.0F); COMBAT_EXPERIENCE_DEFAULT.put("snowman", 0.0);
COMBAT_EXPERIENCE_DEFAULT.put("parrot", 1.0F); COMBAT_EXPERIENCE_DEFAULT.put("parrot", 1.0);
COMBAT_EXPERIENCE_DEFAULT.put("illusioner", 1.0F); COMBAT_EXPERIENCE_DEFAULT.put("illusioner", 1.0);
COMBAT_EXPERIENCE_DEFAULT.put("drowned", 1.0F); COMBAT_EXPERIENCE_DEFAULT.put("drowned", 1.0);
COMBAT_EXPERIENCE_DEFAULT.put("dolphin", 1.0F); COMBAT_EXPERIENCE_DEFAULT.put("dolphin", 1.0);
COMBAT_EXPERIENCE_DEFAULT.put("phantom", 4.0F); COMBAT_EXPERIENCE_DEFAULT.put("phantom", 4.0);
COMBAT_EXPERIENCE_DEFAULT.put("wandering_trader", 1.0F); COMBAT_EXPERIENCE_DEFAULT.put("wandering_trader", 1.0);
//SPECIAL //SPECIAL
SPECIAL_COMBAT_EXPERIENCE_DEFAULT = new HashMap<>(); SPECIAL_COMBAT_EXPERIENCE_DEFAULT = new HashMap<>();
SPECIAL_COMBAT_EXPERIENCE_DEFAULT.put(SpecialXPKey.ANIMALS, 1.0F); //TODO: this seems like a dumb config option SPECIAL_COMBAT_EXPERIENCE_DEFAULT.put(SpecialXPKey.ANIMALS, 1.0); //TODO: this seems like a dumb config option
SPECIAL_COMBAT_EXPERIENCE_DEFAULT.put(SpecialXPKey.SPAWNED, 0.0F); SPECIAL_COMBAT_EXPERIENCE_DEFAULT.put(SpecialXPKey.SPAWNED, 0.0);
SPECIAL_COMBAT_EXPERIENCE_DEFAULT.put(SpecialXPKey.PVP, 1.0F); SPECIAL_COMBAT_EXPERIENCE_DEFAULT.put(SpecialXPKey.PVP, 1.0);
SPECIAL_COMBAT_EXPERIENCE_DEFAULT.put(SpecialXPKey.PETS, 1.0F); SPECIAL_COMBAT_EXPERIENCE_DEFAULT.put(SpecialXPKey.PETS, 1.0);
} }
@Setting(value = "Combat-XP-Multipliers") @Setting(value = "Combat-XP-Multipliers")
private HashMap<String, Float> combatExperienceMap = COMBAT_EXPERIENCE_DEFAULT; private HashMap<String, Double> combatExperienceMap = COMBAT_EXPERIENCE_DEFAULT;
@Setting(value = "Special-Combat-XP-Multipliers", comment = "Special XP settings which apply to a mobs matching certain criteria" + @Setting(value = "Special-Combat-XP-Multipliers", comment = "Special XP settings which apply to a mobs matching certain criteria" +
"\nAnimals - Non-hostile mobs, anything not considered a Monster" + "\nAnimals - Non-hostile mobs, anything not considered a Monster" +
@ -93,7 +93,7 @@ public class ConfigExperienceCombat {
"\nPets - Either tamed or from breeding" + "\nPets - Either tamed or from breeding" +
"\nThese all default to 1.0 except for spawned, which defaults to 0.0" + "\nThese all default to 1.0 except for spawned, which defaults to 0.0" +
"\nIf you want spawned mobs to give XP simply turn the value for spawned above 0.0") "\nIf you want spawned mobs to give XP simply turn the value for spawned above 0.0")
private HashMap<SpecialXPKey, Float> specialCombatExperienceMap = SPECIAL_COMBAT_EXPERIENCE_DEFAULT; private HashMap<SpecialXPKey, Double> specialCombatExperienceMap = SPECIAL_COMBAT_EXPERIENCE_DEFAULT;
@Setting(value = "PVP-XP", comment = "If true, players will gain XP from PVP interactions." + @Setting(value = "PVP-XP", comment = "If true, players will gain XP from PVP interactions." +
"\nBe careful turning this on as this can potentially allow for unwanted behaviour from players." + "\nBe careful turning this on as this can potentially allow for unwanted behaviour from players." +
@ -104,11 +104,11 @@ public class ConfigExperienceCombat {
return pvpXPEnabled; return pvpXPEnabled;
} }
public HashMap<String, Float> getCombatExperienceMap() { public HashMap<String, Double> getCombatExperienceMap() {
return combatExperienceMap; return combatExperienceMap;
} }
public HashMap<SpecialXPKey, Float> getSpecialCombatExperienceMap() { public HashMap<SpecialXPKey, Double> getSpecialCombatExperienceMap() {
return specialCombatExperienceMap; return specialCombatExperienceMap;
} }
} }

View File

@ -14,10 +14,18 @@ public class ConfigExperienceCustomBoosts {
static { static {
CUSTOM_BOOST_SET_DEFAULT = new ArrayList<>(); CUSTOM_BOOST_SET_DEFAULT = new ArrayList<>();
CustomXPPerk customXPPerk = new CustomXPPerk("examplecustomxpperk");
customXPPerk.setCustomXPValue(PrimarySkillType.MINING, 13.37f); CustomXPPerk exampleA = new CustomXPPerk("example-beneficial-xpperk");
customXPPerk.setCustomXPValue(PrimarySkillType.WOODCUTTING, 4.0f); exampleA.setCustomXPValue(PrimarySkillType.MINING, 13.37);
CUSTOM_BOOST_SET_DEFAULT.add(customXPPerk); exampleA.setCustomXPValue(PrimarySkillType.EXCAVATION, 4.20);
CustomXPPerk exampleB = new CustomXPPerk("example-detrimental-xpperk");
exampleB.setCustomXPValue(PrimarySkillType.WOODCUTTING, 0.01);
exampleB.setCustomXPValue(PrimarySkillType.UNARMED, 0.02);
exampleB.setCustomXPValue(PrimarySkillType.SWORDS, 0.03);
CUSTOM_BOOST_SET_DEFAULT.add(exampleA);
CUSTOM_BOOST_SET_DEFAULT.add(exampleB);
} }
@Setting(value = "Custom-Global-XP-Permissions", comment = "You can give custom global xp perks to players by adding 'mcmmo.customperks.xp.<PERK NAME HERE>' to your players" + @Setting(value = "Custom-Global-XP-Permissions", comment = "You can give custom global xp perks to players by adding 'mcmmo.customperks.xp.<PERK NAME HERE>' to your players" +

View File

@ -9,26 +9,26 @@ import java.util.HashMap;
@ConfigSerializable @ConfigSerializable
public class ConfigExperienceRepair { public class ConfigExperienceRepair {
private static final float REPAIR_XP_BASE_DEFAULT = 1000.0F; private static final double REPAIR_XP_BASE_DEFAULT = 1000.0F;
private static final HashMap<ItemMaterialCategory, Float> ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT; private static final HashMap<ItemMaterialCategory, Double> ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT;
static { static {
ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT = new HashMap<>(); ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT = new HashMap<>();
ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT.put(ItemMaterialCategory.WOOD, 0.6F); ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT.put(ItemMaterialCategory.WOOD, 0.6);
ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT.put(ItemMaterialCategory.STONE, 1.3F); ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT.put(ItemMaterialCategory.STONE, 1.3);
ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT.put(ItemMaterialCategory.IRON, 2.5F); ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT.put(ItemMaterialCategory.IRON, 2.5);
ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT.put(ItemMaterialCategory.GOLD, 0.3F); ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT.put(ItemMaterialCategory.GOLD, 0.3);
ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT.put(ItemMaterialCategory.DIAMOND, 5.0F); ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT.put(ItemMaterialCategory.DIAMOND, 5.0);
ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT.put(ItemMaterialCategory.LEATHER, 1.6F); ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT.put(ItemMaterialCategory.LEATHER, 1.6);
ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT.put(ItemMaterialCategory.STRING, 1.8F); ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT.put(ItemMaterialCategory.STRING, 1.8);
ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT.put(ItemMaterialCategory.OTHER, 1.5F); ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT.put(ItemMaterialCategory.OTHER, 1.5);
} }
@Setting(value = "Item-Material-Category-XP-Multiplier", comment = "The material of your item is determined by mcMMO and used to influence XP, " + @Setting(value = "Item-Material-Category-XP-Multiplier", comment = "The material of your item is determined by mcMMO and used to influence XP, " +
"if your Item doesn't fit into a known category it will use OTHER." + "if your Item doesn't fit into a known category it will use OTHER." +
"\nFor the most part, items belong to categories of materials that they are made out of.") "\nFor the most part, items belong to categories of materials that they are made out of.")
private HashMap<ItemMaterialCategory, Float> itemMaterialXPMultiplier = ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT; private HashMap<ItemMaterialCategory, Double> itemMaterialXPMultiplier = ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT;
@Setting(value = "Repair-XP-Base", comment = "The base amount of XP for repairing an item." + @Setting(value = "Repair-XP-Base", comment = "The base amount of XP for repairing an item." +
"\nThe repair XP formula is a simple multiplication of these 4 values in this order" + "\nThe repair XP formula is a simple multiplication of these 4 values in this order" +
@ -37,13 +37,13 @@ public class ConfigExperienceRepair {
"\nThe Base Repair XP defined here (default 1000.0)" + "\nThe Base Repair XP defined here (default 1000.0)" +
"\nAnd finally, the XP multiplier of the item material category defined in this config." + "\nAnd finally, the XP multiplier of the item material category defined in this config." +
"\nDefault value: " + REPAIR_XP_BASE_DEFAULT) "\nDefault value: " + REPAIR_XP_BASE_DEFAULT)
private Float repairXPBase = REPAIR_XP_BASE_DEFAULT; private Double repairXPBase = REPAIR_XP_BASE_DEFAULT;
public float getItemMaterialXPMultiplier(ItemMaterialCategory itemMaterialCategory) { public double getItemMaterialXPMultiplier(ItemMaterialCategory itemMaterialCategory) {
return itemMaterialXPMultiplier.get(itemMaterialCategory); return itemMaterialXPMultiplier.get(itemMaterialCategory);
} }
public Float getRepairXPBase() { public Double getRepairXPBase() {
return repairXPBase; return repairXPBase;
} }
} }

View File

@ -11,27 +11,27 @@ import static com.gmail.nossr50.datatypes.skills.PrimarySkillType.*;
@ConfigSerializable @ConfigSerializable
public class ConfigExperienceSkillMultiplier { public class ConfigExperienceSkillMultiplier {
private static final HashMap<PrimarySkillType, Float> SKILL_GLOBAL_MULT_DEFAULT; private static final HashMap<PrimarySkillType, Double> SKILL_GLOBAL_MULT_DEFAULT;
static { static {
SKILL_GLOBAL_MULT_DEFAULT = new HashMap<>(); SKILL_GLOBAL_MULT_DEFAULT = new HashMap<>();
SKILL_GLOBAL_MULT_DEFAULT.put(ACROBATICS, 1.0f); SKILL_GLOBAL_MULT_DEFAULT.put(ACROBATICS, 1.0);
SKILL_GLOBAL_MULT_DEFAULT.put(ALCHEMY, 1.0f); SKILL_GLOBAL_MULT_DEFAULT.put(ALCHEMY, 1.0);
SKILL_GLOBAL_MULT_DEFAULT.put(ARCHERY, 1.0f); SKILL_GLOBAL_MULT_DEFAULT.put(ARCHERY, 1.0);
SKILL_GLOBAL_MULT_DEFAULT.put(AXES, 1.0f); SKILL_GLOBAL_MULT_DEFAULT.put(AXES, 1.0);
SKILL_GLOBAL_MULT_DEFAULT.put(EXCAVATION, 1.0f); SKILL_GLOBAL_MULT_DEFAULT.put(EXCAVATION, 1.0);
SKILL_GLOBAL_MULT_DEFAULT.put(FISHING, 1.0f); SKILL_GLOBAL_MULT_DEFAULT.put(FISHING, 1.0);
SKILL_GLOBAL_MULT_DEFAULT.put(HERBALISM, 1.0f); SKILL_GLOBAL_MULT_DEFAULT.put(HERBALISM, 1.0);
SKILL_GLOBAL_MULT_DEFAULT.put(MINING, 1.0f); SKILL_GLOBAL_MULT_DEFAULT.put(MINING, 1.0);
SKILL_GLOBAL_MULT_DEFAULT.put(REPAIR, 1.0f); SKILL_GLOBAL_MULT_DEFAULT.put(REPAIR, 1.0);
SKILL_GLOBAL_MULT_DEFAULT.put(SWORDS, 1.0f); SKILL_GLOBAL_MULT_DEFAULT.put(SWORDS, 1.0);
SKILL_GLOBAL_MULT_DEFAULT.put(TAMING, 1.0f); SKILL_GLOBAL_MULT_DEFAULT.put(TAMING, 1.0);
SKILL_GLOBAL_MULT_DEFAULT.put(UNARMED, 1.0f); SKILL_GLOBAL_MULT_DEFAULT.put(UNARMED, 1.0);
SKILL_GLOBAL_MULT_DEFAULT.put(WOODCUTTING, 1.0f); SKILL_GLOBAL_MULT_DEFAULT.put(WOODCUTTING, 1.0);
} }
@Setting(value = "Skill-XP-Multipliers") @Setting(value = "Skill-XP-Multipliers")
private HashMap<PrimarySkillType, Float> perSkillGlobalMultiplier = SKILL_GLOBAL_MULT_DEFAULT; private HashMap<PrimarySkillType, Double> perSkillGlobalMultiplier = SKILL_GLOBAL_MULT_DEFAULT;
public double getSkillGlobalMultiplier(PrimarySkillType primarySkillType) { public double getSkillGlobalMultiplier(PrimarySkillType primarySkillType) {
return perSkillGlobalMultiplier.get(primarySkillType); return perSkillGlobalMultiplier.get(primarySkillType);

View File

@ -109,11 +109,11 @@ public class ConfigExperienceSkills {
return experienceSmelting.getSmeltingExperienceMap(); return experienceSmelting.getSmeltingExperienceMap();
} }
public float getItemMaterialXPMultiplier(ItemMaterialCategory itemMaterialCategory) { public double getItemMaterialXPMultiplier(ItemMaterialCategory itemMaterialCategory) {
return experienceRepair.getItemMaterialXPMultiplier(itemMaterialCategory); return experienceRepair.getItemMaterialXPMultiplier(itemMaterialCategory);
} }
public float getRepairXPBase() { public double getRepairXPBase() {
return experienceRepair.getRepairXPBase(); return experienceRepair.getRepairXPBase();
} }
@ -121,7 +121,7 @@ public class ConfigExperienceSkills {
return experienceAcrobatics.getAcrobaticsXPMap(); return experienceAcrobatics.getAcrobaticsXPMap();
} }
public float getFeatherFallMultiplier() { public double getFeatherFallMultiplier() {
return experienceAcrobatics.getFeatherFallMultiplier(); return experienceAcrobatics.getFeatherFallMultiplier();
} }
@ -165,15 +165,15 @@ public class ConfigExperienceSkills {
return experienceCombat.isPvpXPEnabled(); return experienceCombat.isPvpXPEnabled();
} }
public HashMap<String, Float> getCombatExperienceMap() { public HashMap<String, Double> getCombatExperienceMap() {
return experienceCombat.getCombatExperienceMap(); return experienceCombat.getCombatExperienceMap();
} }
public HashMap<SpecialXPKey, Float> getSpecialCombatExperienceMap() { public HashMap<SpecialXPKey, Double> getSpecialCombatExperienceMap() {
return experienceCombat.getSpecialCombatExperienceMap(); return experienceCombat.getSpecialCombatExperienceMap();
} }
public float getDistanceMultiplier() { public double getDistanceMultiplier() {
return experienceArchery.getDistanceMultiplier(); return experienceArchery.getDistanceMultiplier();
} }

View File

@ -11,24 +11,24 @@ import java.util.HashMap;
public class ConfigExperienceFormula { public class ConfigExperienceFormula {
private static final boolean CUMULATIVE_CURVE_DEFAULT = false; private static final boolean CUMULATIVE_CURVE_DEFAULT = false;
private static final HashMap<PrimarySkillType, Float> SKILL_FORMULA_MODIFIER_DEFAULT; private static final HashMap<PrimarySkillType, Double> SKILL_FORMULA_MODIFIER_DEFAULT;
static { static {
SKILL_FORMULA_MODIFIER_DEFAULT = new HashMap<>(); SKILL_FORMULA_MODIFIER_DEFAULT = new HashMap<>();
//TODO: This code is causing compiler issues //TODO: This code is causing compiler issues
SKILL_FORMULA_MODIFIER_DEFAULT.put(PrimarySkillType.ACROBATICS, 1.0f); SKILL_FORMULA_MODIFIER_DEFAULT.put(PrimarySkillType.ACROBATICS, 1.0);
SKILL_FORMULA_MODIFIER_DEFAULT.put(PrimarySkillType.ALCHEMY, 1.0f); SKILL_FORMULA_MODIFIER_DEFAULT.put(PrimarySkillType.ALCHEMY, 1.0);
SKILL_FORMULA_MODIFIER_DEFAULT.put(PrimarySkillType.AXES, 1.0f); SKILL_FORMULA_MODIFIER_DEFAULT.put(PrimarySkillType.AXES, 1.0);
SKILL_FORMULA_MODIFIER_DEFAULT.put(PrimarySkillType.ARCHERY, 1.0f); SKILL_FORMULA_MODIFIER_DEFAULT.put(PrimarySkillType.ARCHERY, 1.0);
SKILL_FORMULA_MODIFIER_DEFAULT.put(PrimarySkillType.EXCAVATION, 1.0f); SKILL_FORMULA_MODIFIER_DEFAULT.put(PrimarySkillType.EXCAVATION, 1.0);
SKILL_FORMULA_MODIFIER_DEFAULT.put(PrimarySkillType.FISHING, 1.0f); SKILL_FORMULA_MODIFIER_DEFAULT.put(PrimarySkillType.FISHING, 1.0);
SKILL_FORMULA_MODIFIER_DEFAULT.put(PrimarySkillType.HERBALISM, 1.0f); SKILL_FORMULA_MODIFIER_DEFAULT.put(PrimarySkillType.HERBALISM, 1.0);
SKILL_FORMULA_MODIFIER_DEFAULT.put(PrimarySkillType.MINING, 1.0f); SKILL_FORMULA_MODIFIER_DEFAULT.put(PrimarySkillType.MINING, 1.0);
SKILL_FORMULA_MODIFIER_DEFAULT.put(PrimarySkillType.REPAIR, 1.0f); SKILL_FORMULA_MODIFIER_DEFAULT.put(PrimarySkillType.REPAIR, 1.0);
SKILL_FORMULA_MODIFIER_DEFAULT.put(PrimarySkillType.SWORDS, 1.0f); SKILL_FORMULA_MODIFIER_DEFAULT.put(PrimarySkillType.SWORDS, 1.0);
SKILL_FORMULA_MODIFIER_DEFAULT.put(PrimarySkillType.TAMING, 1.0f); SKILL_FORMULA_MODIFIER_DEFAULT.put(PrimarySkillType.TAMING, 1.0);
SKILL_FORMULA_MODIFIER_DEFAULT.put(PrimarySkillType.UNARMED, 1.0f); SKILL_FORMULA_MODIFIER_DEFAULT.put(PrimarySkillType.UNARMED, 1.0);
SKILL_FORMULA_MODIFIER_DEFAULT.put(PrimarySkillType.WOODCUTTING, 1.0f); SKILL_FORMULA_MODIFIER_DEFAULT.put(PrimarySkillType.WOODCUTTING, 1.0);
} }
@Setting(value = "Player-XP-Formula-Type", comment = "Determines which formula is used to determine XP needed to level" + @Setting(value = "Player-XP-Formula-Type", comment = "Determines which formula is used to determine XP needed to level" +
@ -50,13 +50,13 @@ public class ConfigExperienceFormula {
@Setting(value = "Skill-Formula-Multipliers", comment = "The end result of how much XP is needed to level is determined by multiplying against this value" + @Setting(value = "Skill-Formula-Multipliers", comment = "The end result of how much XP is needed to level is determined by multiplying against this value" +
"\nHigher values will make skills take longer to level, lower values will decrease time to level instead.") "\nHigher values will make skills take longer to level, lower values will decrease time to level instead.")
private HashMap<PrimarySkillType, Float> skillXpModifier = SKILL_FORMULA_MODIFIER_DEFAULT; private HashMap<PrimarySkillType, Double> skillXpModifier = SKILL_FORMULA_MODIFIER_DEFAULT;
public FormulaType getFormulaType() { public FormulaType getFormulaType() {
return formulaType; return formulaType;
} }
public float getSkillXpFormulaModifier(PrimarySkillType primarySkillType) { public double getSkillXpFormulaModifier(PrimarySkillType primarySkillType) {
return skillXpModifier.get(primarySkillType); return skillXpModifier.get(primarySkillType);
} }
@ -72,7 +72,7 @@ public class ConfigExperienceFormula {
return configExperienceFormulaExponential; return configExperienceFormulaExponential;
} }
public float getMultiplier(FormulaType formulaType) { public double getMultiplier(FormulaType formulaType) {
switch (formulaType) { switch (formulaType) {
case LINEAR: case LINEAR:
return getLinearMultiplier(); return getLinearMultiplier();
@ -98,11 +98,11 @@ public class ConfigExperienceFormula {
return configExperienceFormulaExponential.getExponentialBaseModifier(); return configExperienceFormulaExponential.getExponentialBaseModifier();
} }
public float getExponentialMultiplier() { public double getExponentialMultiplier() {
return configExperienceFormulaExponential.getExponentialMultiplier(); return configExperienceFormulaExponential.getExponentialMultiplier();
} }
public float getExponentialExponent() { public double getExponentialExponent() {
return configExperienceFormulaExponential.getExponentialExponent(); return configExperienceFormulaExponential.getExponentialExponent();
} }
@ -110,7 +110,7 @@ public class ConfigExperienceFormula {
return configExperienceFormulaLinear.getLinearBaseModifier(); return configExperienceFormulaLinear.getLinearBaseModifier();
} }
public float getLinearMultiplier() { public double getLinearMultiplier() {
return configExperienceFormulaLinear.getLinearMultiplier(); return configExperienceFormulaLinear.getLinearMultiplier();
} }
} }

View File

@ -7,27 +7,27 @@ import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
public class ConfigExperienceFormulaExponential { public class ConfigExperienceFormulaExponential {
private static final int BASE_DEFAULT = 2000; private static final int BASE_DEFAULT = 2000;
private static final float MULTIPLIER_DEFAULT = 0.1f; private static final double MULTIPLIER_DEFAULT = 0.1f;
private static final float EXPONENT_DEFAULT = 1.80f; private static final double EXPONENT_DEFAULT = 1.80f;
@Setting(value = "Base-Amount", comment = "Default value: " + BASE_DEFAULT) @Setting(value = "Base-Amount", comment = "Default value: " + BASE_DEFAULT)
private int baseModifier = BASE_DEFAULT; private int baseModifier = BASE_DEFAULT;
@Setting(value = "Multiplier", comment = "Default value: " + MULTIPLIER_DEFAULT) @Setting(value = "Multiplier", comment = "Default value: " + MULTIPLIER_DEFAULT)
private float multiplier = MULTIPLIER_DEFAULT; private double multiplier = MULTIPLIER_DEFAULT;
@Setting(value = "Exponent", comment = "Default value: " + EXPONENT_DEFAULT) @Setting(value = "Exponent", comment = "Default value: " + EXPONENT_DEFAULT)
private float exponent = EXPONENT_DEFAULT; private double exponent = EXPONENT_DEFAULT;
public int getExponentialBaseModifier() { public int getExponentialBaseModifier() {
return baseModifier; return baseModifier;
} }
public float getExponentialMultiplier() { public double getExponentialMultiplier() {
return multiplier; return multiplier;
} }
public float getExponentialExponent() { public double getExponentialExponent() {
return exponent; return exponent;
} }
} }

View File

@ -7,19 +7,19 @@ import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
public class ConfigExperienceFormulaLinear { public class ConfigExperienceFormulaLinear {
private static final int BASE_DEFAULT = 1020; private static final int BASE_DEFAULT = 1020;
private static final float MULTIPLIER_DEFAULT = 20.0F; private static final double MULTIPLIER_DEFAULT = 20.0F;
@Setting(value = "Base-Amount", comment = "Default value: " + BASE_DEFAULT) @Setting(value = "Base-Amount", comment = "Default value: " + BASE_DEFAULT)
private int baseModifier = BASE_DEFAULT; private int baseModifier = BASE_DEFAULT;
@Setting(value = "Multiplier", comment = "Default value: " + MULTIPLIER_DEFAULT) @Setting(value = "Multiplier", comment = "Default value: " + MULTIPLIER_DEFAULT)
private float multiplier = MULTIPLIER_DEFAULT; private double multiplier = MULTIPLIER_DEFAULT;
public int getLinearBaseModifier() { public int getLinearBaseModifier() {
return baseModifier; return baseModifier;
} }
public float getLinearMultiplier() { public double getLinearMultiplier() {
return multiplier; return multiplier;
} }

View File

@ -86,7 +86,7 @@ public class ConfigLeveling {
return configExperienceBars; return configExperienceBars;
} }
public float getGuaranteedMinimums() { public double getGuaranteedMinimums() {
return configLevelingDiminishedReturns.getGuaranteedMinimums(); return configLevelingDiminishedReturns.getGuaranteedMinimums();
} }

View File

@ -25,8 +25,8 @@ public class CustomXPPerkSerializer implements TypeSerializer<CustomXPPerk> {
public CustomXPPerk deserialize(@NonNull TypeToken<?> type, @NonNull ConfigurationNode value) throws ObjectMappingException { public CustomXPPerk deserialize(@NonNull TypeToken<?> type, @NonNull ConfigurationNode value) throws ObjectMappingException {
String perkName = value.getNode(PERK_NAME).getValue(TypeToken.of(String.class)); String perkName = value.getNode(PERK_NAME).getValue(TypeToken.of(String.class));
Map<PrimarySkillType, Float> map = value.getNode(XP_BOOST_NODE_ROOT).getValue(new TypeToken<Map<PrimarySkillType, Float>>(){}); Map<PrimarySkillType, Double> map = value.getNode(XP_BOOST_NODE_ROOT).getValue(new TypeToken<Map<PrimarySkillType, Double>>(){});
HashMap<PrimarySkillType, Float> xpBoostHashMap = new HashMap<>(map); HashMap<PrimarySkillType, Double> xpBoostHashMap = new HashMap<>(map);
CustomXPPerk customXPPerk = new CustomXPPerk(perkName); CustomXPPerk customXPPerk = new CustomXPPerk(perkName);
customXPPerk.setCustomXPMultiplierMap(xpBoostHashMap); customXPPerk.setCustomXPMultiplierMap(xpBoostHashMap);
@ -38,15 +38,15 @@ public class CustomXPPerkSerializer implements TypeSerializer<CustomXPPerk> {
public void serialize(@NonNull TypeToken<?> type, @Nullable CustomXPPerk obj, @NonNull ConfigurationNode value) throws ObjectMappingException { public void serialize(@NonNull TypeToken<?> type, @Nullable CustomXPPerk obj, @NonNull ConfigurationNode value) throws ObjectMappingException {
String name = obj.getPerkName(); String name = obj.getPerkName();
HashMap<PrimarySkillType, Float> xpBoostMap = new HashMap<>(); HashMap<PrimarySkillType, Double> xpBoostMap = new HashMap<>();
value.getNode(PERK_NAME).setValue(name); value.getNode(PERK_NAME).setValue(name);
for (PrimarySkillType primarySkillType : PrimarySkillType.values()) { for (PrimarySkillType primarySkillType : PrimarySkillType.values()) {
float xpMultValue = obj.getXPMultiplierValue(primarySkillType); Double xpMultValue = obj.getXPMultiplierValue(primarySkillType);
//Ignore default values //Ignore default values
if (xpMultValue == 1.0F) if (xpMultValue == 1.0)
continue; continue;
xpBoostMap.put(primarySkillType, obj.getXPMultiplierValue(primarySkillType)); xpBoostMap.put(primarySkillType, obj.getXPMultiplierValue(primarySkillType));

View File

@ -17,8 +17,8 @@ public class DamagePropertySerializer implements TypeSerializer<DamageProperty>
@Nullable @Nullable
@Override @Override
public DamageProperty deserialize(@NonNull TypeToken<?> type, @NonNull ConfigurationNode value) throws ObjectMappingException { public DamageProperty deserialize(@NonNull TypeToken<?> type, @NonNull ConfigurationNode value) throws ObjectMappingException {
Float pvp = value.getNode(PVP_NODE).getValue(TypeToken.of(Float.class)); Double pvp = value.getNode(PVP_NODE).getValue(TypeToken.of(Double.class));
Float pve = value.getNode(PVE_NODE).getValue(TypeToken.of(Float.class)); Double pve = value.getNode(PVE_NODE).getValue(TypeToken.of(Double.class));
DamageProperty damageProperty = new AbstractDamageProperty(pve, pvp); DamageProperty damageProperty = new AbstractDamageProperty(pve, pvp);
return damageProperty; return damageProperty;
} }

View File

@ -1118,7 +1118,7 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
private PlayerProfile loadFromLine(String[] character) { private PlayerProfile loadFromLine(String[] character) {
Map<PrimarySkillType, Integer> skills = getSkillMapFromLine(character); // Skill levels Map<PrimarySkillType, Integer> skills = getSkillMapFromLine(character); // Skill levels
Map<PrimarySkillType, Float> skillsXp = new EnumMap<>(PrimarySkillType.class); // Skill & XP Map<PrimarySkillType, Double> skillsXp = new EnumMap<>(PrimarySkillType.class); // Skill & XP
Map<SuperAbilityType, Integer> skillsDATS = new EnumMap<>(SuperAbilityType.class); // Ability & Cooldown Map<SuperAbilityType, Integer> skillsDATS = new EnumMap<>(SuperAbilityType.class); // Ability & Cooldown
Map<UniqueDataType, Integer> uniquePlayerDataMap = new EnumMap<>(UniqueDataType.class); Map<UniqueDataType, Integer> uniquePlayerDataMap = new EnumMap<>(UniqueDataType.class);
MobHealthbarType mobHealthbarType; MobHealthbarType mobHealthbarType;
@ -1126,19 +1126,19 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
// TODO on updates, put new values in a try{} ? // TODO on updates, put new values in a try{} ?
skillsXp.put(PrimarySkillType.TAMING, (float) Integer.valueOf(character[EXP_TAMING])); skillsXp.put(PrimarySkillType.TAMING, (double) Integer.valueOf(character[EXP_TAMING]));
skillsXp.put(PrimarySkillType.MINING, (float) Integer.valueOf(character[EXP_MINING])); skillsXp.put(PrimarySkillType.MINING, (double) Integer.valueOf(character[EXP_MINING]));
skillsXp.put(PrimarySkillType.REPAIR, (float) Integer.valueOf(character[EXP_REPAIR])); skillsXp.put(PrimarySkillType.REPAIR, (double) Integer.valueOf(character[EXP_REPAIR]));
skillsXp.put(PrimarySkillType.WOODCUTTING, (float) Integer.valueOf(character[EXP_WOODCUTTING])); skillsXp.put(PrimarySkillType.WOODCUTTING, (double) Integer.valueOf(character[EXP_WOODCUTTING]));
skillsXp.put(PrimarySkillType.UNARMED, (float) Integer.valueOf(character[EXP_UNARMED])); skillsXp.put(PrimarySkillType.UNARMED, (double) Integer.valueOf(character[EXP_UNARMED]));
skillsXp.put(PrimarySkillType.HERBALISM, (float) Integer.valueOf(character[EXP_HERBALISM])); skillsXp.put(PrimarySkillType.HERBALISM, (double) Integer.valueOf(character[EXP_HERBALISM]));
skillsXp.put(PrimarySkillType.EXCAVATION, (float) Integer.valueOf(character[EXP_EXCAVATION])); skillsXp.put(PrimarySkillType.EXCAVATION, (double) Integer.valueOf(character[EXP_EXCAVATION]));
skillsXp.put(PrimarySkillType.ARCHERY, (float) Integer.valueOf(character[EXP_ARCHERY])); skillsXp.put(PrimarySkillType.ARCHERY, (double) Integer.valueOf(character[EXP_ARCHERY]));
skillsXp.put(PrimarySkillType.SWORDS, (float) Integer.valueOf(character[EXP_SWORDS])); skillsXp.put(PrimarySkillType.SWORDS, (double) Integer.valueOf(character[EXP_SWORDS]));
skillsXp.put(PrimarySkillType.AXES, (float) Integer.valueOf(character[EXP_AXES])); skillsXp.put(PrimarySkillType.AXES, (double) Integer.valueOf(character[EXP_AXES]));
skillsXp.put(PrimarySkillType.ACROBATICS, (float) Integer.valueOf(character[EXP_ACROBATICS])); skillsXp.put(PrimarySkillType.ACROBATICS, (double) Integer.valueOf(character[EXP_ACROBATICS]));
skillsXp.put(PrimarySkillType.FISHING, (float) Integer.valueOf(character[EXP_FISHING])); skillsXp.put(PrimarySkillType.FISHING, (double) Integer.valueOf(character[EXP_FISHING]));
skillsXp.put(PrimarySkillType.ALCHEMY, (float) Integer.valueOf(character[EXP_ALCHEMY])); skillsXp.put(PrimarySkillType.ALCHEMY, (double) Integer.valueOf(character[EXP_ALCHEMY]));
// Taming - Unused // Taming - Unused
skillsDATS.put(SuperAbilityType.SUPER_BREAKER, Integer.valueOf(character[COOLDOWN_SUPER_BREAKER])); skillsDATS.put(SuperAbilityType.SUPER_BREAKER, Integer.valueOf(character[COOLDOWN_SUPER_BREAKER]));

View File

@ -1049,7 +1049,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
private PlayerProfile loadFromResult(String playerName, ResultSet result) throws SQLException { private PlayerProfile loadFromResult(String playerName, ResultSet result) throws SQLException {
Map<PrimarySkillType, Integer> skills = new EnumMap<>(PrimarySkillType.class); // Skill & Level Map<PrimarySkillType, Integer> skills = new EnumMap<>(PrimarySkillType.class); // Skill & Level
Map<PrimarySkillType, Float> skillsXp = new EnumMap<>(PrimarySkillType.class); // Skill & XP Map<PrimarySkillType, Double> skillsXp = new EnumMap<>(PrimarySkillType.class); // Skill & XP
Map<SuperAbilityType, Integer> skillsDATS = new EnumMap<>(SuperAbilityType.class); // Ability & Cooldown Map<SuperAbilityType, Integer> skillsDATS = new EnumMap<>(SuperAbilityType.class); // Ability & Cooldown
Map<UniqueDataType, Integer> uniqueData = new EnumMap<>(UniqueDataType.class); //Chimaera wing cooldown and other misc info Map<UniqueDataType, Integer> uniqueData = new EnumMap<>(UniqueDataType.class); //Chimaera wing cooldown and other misc info
MobHealthbarType mobHealthbarType; MobHealthbarType mobHealthbarType;
@ -1076,19 +1076,19 @@ public final class SQLDatabaseManager implements DatabaseManager {
skills.put(PrimarySkillType.FISHING, result.getInt(OFFSET_SKILLS + 12)); skills.put(PrimarySkillType.FISHING, result.getInt(OFFSET_SKILLS + 12));
skills.put(PrimarySkillType.ALCHEMY, result.getInt(OFFSET_SKILLS + 13)); skills.put(PrimarySkillType.ALCHEMY, result.getInt(OFFSET_SKILLS + 13));
skillsXp.put(PrimarySkillType.TAMING, result.getFloat(OFFSET_XP + 1)); skillsXp.put(PrimarySkillType.TAMING, result.getDouble(OFFSET_XP + 1));
skillsXp.put(PrimarySkillType.MINING, result.getFloat(OFFSET_XP + 2)); skillsXp.put(PrimarySkillType.MINING, result.getDouble(OFFSET_XP + 2));
skillsXp.put(PrimarySkillType.REPAIR, result.getFloat(OFFSET_XP + 3)); skillsXp.put(PrimarySkillType.REPAIR, result.getDouble(OFFSET_XP + 3));
skillsXp.put(PrimarySkillType.WOODCUTTING, result.getFloat(OFFSET_XP + 4)); skillsXp.put(PrimarySkillType.WOODCUTTING, result.getDouble(OFFSET_XP + 4));
skillsXp.put(PrimarySkillType.UNARMED, result.getFloat(OFFSET_XP + 5)); skillsXp.put(PrimarySkillType.UNARMED, result.getDouble(OFFSET_XP + 5));
skillsXp.put(PrimarySkillType.HERBALISM, result.getFloat(OFFSET_XP + 6)); skillsXp.put(PrimarySkillType.HERBALISM, result.getDouble(OFFSET_XP + 6));
skillsXp.put(PrimarySkillType.EXCAVATION, result.getFloat(OFFSET_XP + 7)); skillsXp.put(PrimarySkillType.EXCAVATION, result.getDouble(OFFSET_XP + 7));
skillsXp.put(PrimarySkillType.ARCHERY, result.getFloat(OFFSET_XP + 8)); skillsXp.put(PrimarySkillType.ARCHERY, result.getDouble(OFFSET_XP + 8));
skillsXp.put(PrimarySkillType.SWORDS, result.getFloat(OFFSET_XP + 9)); skillsXp.put(PrimarySkillType.SWORDS, result.getDouble(OFFSET_XP + 9));
skillsXp.put(PrimarySkillType.AXES, result.getFloat(OFFSET_XP + 10)); skillsXp.put(PrimarySkillType.AXES, result.getDouble(OFFSET_XP + 10));
skillsXp.put(PrimarySkillType.ACROBATICS, result.getFloat(OFFSET_XP + 11)); skillsXp.put(PrimarySkillType.ACROBATICS, result.getDouble(OFFSET_XP + 11));
skillsXp.put(PrimarySkillType.FISHING, result.getFloat(OFFSET_XP + 12)); skillsXp.put(PrimarySkillType.FISHING, result.getDouble(OFFSET_XP + 12));
skillsXp.put(PrimarySkillType.ALCHEMY, result.getFloat(OFFSET_XP + 13)); skillsXp.put(PrimarySkillType.ALCHEMY, result.getDouble(OFFSET_XP + 13));
// Taming - Unused - result.getInt(OFFSET_DATS + 1) // Taming - Unused - result.getInt(OFFSET_DATS + 1)
skillsDATS.put(SuperAbilityType.SUPER_BREAKER, result.getInt(OFFSET_DATS + 2)); skillsDATS.put(SuperAbilityType.SUPER_BREAKER, result.getInt(OFFSET_DATS + 2));

View File

@ -7,7 +7,7 @@ import java.util.HashMap;
public class CustomXPPerk { public class CustomXPPerk {
private String perkName; private String perkName;
private HashMap<PrimarySkillType, Float> customXPMultiplierMap; private HashMap<PrimarySkillType, Double> customXPMultiplierMap;
public CustomXPPerk(String perkName) { public CustomXPPerk(String perkName) {
this.perkName = perkName; this.perkName = perkName;
@ -20,7 +20,7 @@ public class CustomXPPerk {
* @param primarySkillType target skill * @param primarySkillType target skill
* @param xpMult xp multiplier * @param xpMult xp multiplier
*/ */
public void setCustomXPValue(PrimarySkillType primarySkillType, float xpMult) { public void setCustomXPValue(PrimarySkillType primarySkillType, Double xpMult) {
customXPMultiplierMap.put(primarySkillType, xpMult); customXPMultiplierMap.put(primarySkillType, xpMult);
} }
@ -31,7 +31,7 @@ public class CustomXPPerk {
* @param primarySkillType target skill * @param primarySkillType target skill
* @return this custom perks XP multiplier for target skill, defaults to 1.0D if it doesn't exist * @return this custom perks XP multiplier for target skill, defaults to 1.0D if it doesn't exist
*/ */
public float getXPMultiplierValue(PrimarySkillType primarySkillType) { public double getXPMultiplierValue(PrimarySkillType primarySkillType) {
if (customXPMultiplierMap.get(primarySkillType) == null) if (customXPMultiplierMap.get(primarySkillType) == null)
return 1.0F; return 1.0F;
@ -51,7 +51,7 @@ public class CustomXPPerk {
* Set the custom XP multiplier map for this perk (this will override all values currently held) * Set the custom XP multiplier map for this perk (this will override all values currently held)
* @param customXPMultiplierMap new custom xp multiplier map * @param customXPMultiplierMap new custom xp multiplier map
*/ */
public void setCustomXPMultiplierMap(HashMap<PrimarySkillType, Float> customXPMultiplierMap) { public void setCustomXPMultiplierMap(HashMap<PrimarySkillType, Double> customXPMultiplierMap) {
this.customXPMultiplierMap = customXPMultiplierMap; this.customXPMultiplierMap = customXPMultiplierMap;
} }

View File

@ -8,10 +8,10 @@ import java.util.concurrent.TimeUnit;
public class SkillXpGain implements Delayed { public class SkillXpGain implements Delayed {
private final long expiryTime; private final long expiryTime;
private final float xp; private final double xp;
private final PrimarySkillType type; private final PrimarySkillType type;
public SkillXpGain(PrimarySkillType type, float xp) { public SkillXpGain(PrimarySkillType type, double xp) {
this.expiryTime = System.currentTimeMillis() + getDuration(); this.expiryTime = System.currentTimeMillis() + getDuration();
this.xp = xp; this.xp = xp;
this.type = type; this.type = type;
@ -25,7 +25,7 @@ public class SkillXpGain implements Delayed {
return type; return type;
} }
public float getXp() { public double getXp() {
return xp; return xp;
} }

View File

@ -33,7 +33,7 @@ public class Party {
private boolean locked; private boolean locked;
private Party ally; private Party ally;
private int level; private int level;
private float xp; private double xp;
private ShareMode xpShareMode = ShareMode.NONE; private ShareMode xpShareMode = ShareMode.NONE;
private ShareMode itemShareMode = ShareMode.NONE; private ShareMode itemShareMode = ShareMode.NONE;
@ -171,20 +171,20 @@ public class Party {
this.level = level; this.level = level;
} }
public float getXp() { public double getXp() {
return xp; return xp;
} }
public void setXp(float xp) { public void setXp(double xp) {
this.xp = xp; this.xp = xp;
} }
public void addXp(float xp) { public void addXp(double xp) {
setXp(getXp() + xp); setXp(getXp() + xp);
} }
protected float levelUp() { protected double levelUp() {
float xpRemoved = getXpToLevel(); double xpRemoved = getXpToLevel();
setLevel(getLevel() + 1); setLevel(getLevel() + 1);
setXp(getXp() - xpRemoved); setXp(getXp() - xpRemoved);
@ -206,7 +206,7 @@ public class Party {
* *
* @param xp Experience amount to add * @param xp Experience amount to add
*/ */
public void applyXpGain(float xp) { public void applyXpGain(double xp) {
if (!EventUtils.handlePartyXpGainEvent(this, xp)) { if (!EventUtils.handlePartyXpGainEvent(this, xp)) {
return; return;
} }
@ -216,7 +216,7 @@ public class Party {
} }
int levelsGained = 0; int levelsGained = 0;
float xpRemoved = 0; double xpRemoved = 0;
while (getXp() >= getXpToLevel()) { while (getXp() >= getXpToLevel()) {
/*if (hasReachedLevelCap()) { /*if (hasReachedLevelCap()) {

View File

@ -89,7 +89,7 @@ public class McMMOPlayer {
//private int chimeraWingLastUse; //private int chimeraWingLastUse;
private Location teleportCommence; private Location teleportCommence;
private boolean isUsingUnarmed; private boolean isUsingUnarmed;
private HashMap<PrimarySkillType, Float> personalXPModifiers; private HashMap<PrimarySkillType, Double> personalXPModifiers;
public McMMOPlayer(Player player, PlayerProfile profile) { public McMMOPlayer(Player player, PlayerProfile profile) {
String playerName = player.getName(); String playerName = player.getName();
@ -155,7 +155,7 @@ public class McMMOPlayer {
* @param primarySkillType target primary skill * @param primarySkillType target primary skill
* @return this players personal XP multiplier for target PrimarySkillType * @return this players personal XP multiplier for target PrimarySkillType
*/ */
public float getPlayerSpecificXPMult(PrimarySkillType primarySkillType) { public Double getPlayerSpecificXPMult(PrimarySkillType primarySkillType) {
return personalXPModifiers.get(primarySkillType); return personalXPModifiers.get(primarySkillType);
} }
@ -479,7 +479,7 @@ public class McMMOPlayer {
* @param skill Skill being used * @param skill Skill being used
* @param xp Experience amount to process * @param xp Experience amount to process
*/ */
public void beginXpGain(PrimarySkillType skill, float xp, XPGainReason xpGainReason, XPGainSource xpGainSource) { public void beginXpGain(PrimarySkillType skill, double xp, XPGainReason xpGainReason, XPGainSource xpGainSource) {
Validate.isTrue(xp >= 0.0, "XP gained should be greater than or equal to zero."); Validate.isTrue(xp >= 0.0, "XP gained should be greater than or equal to zero.");
if (xp <= 0.0) { if (xp <= 0.0) {
@ -488,7 +488,7 @@ public class McMMOPlayer {
if (skill.isChildSkill()) { if (skill.isChildSkill()) {
Set<PrimarySkillType> parentSkills = FamilyTree.getParents(skill); Set<PrimarySkillType> parentSkills = FamilyTree.getParents(skill);
float splitXp = xp / parentSkills.size(); double splitXp = xp / parentSkills.size();
for (PrimarySkillType parentSkill : parentSkills) { for (PrimarySkillType parentSkill : parentSkills) {
if (parentSkill.getPermissions(player)) { if (parentSkill.getPermissions(player)) {
@ -513,7 +513,7 @@ public class McMMOPlayer {
* @param skill Skill being used * @param skill Skill being used
* @param xp Experience amount to process * @param xp Experience amount to process
*/ */
public void beginUnsharedXpGain(PrimarySkillType skill, float xp, XPGainReason xpGainReason, XPGainSource xpGainSource) { public void beginUnsharedXpGain(PrimarySkillType skill, double xp, XPGainReason xpGainReason, XPGainSource xpGainSource) {
if(player.getGameMode() == GameMode.CREATIVE) if(player.getGameMode() == GameMode.CREATIVE)
return; return;
@ -534,7 +534,7 @@ public class McMMOPlayer {
* @param primarySkillType Skill being used * @param primarySkillType Skill being used
* @param xp Experience amount to add * @param xp Experience amount to add
*/ */
public void applyXpGain(PrimarySkillType primarySkillType, float xp, XPGainReason xpGainReason, XPGainSource xpGainSource) { public void applyXpGain(PrimarySkillType primarySkillType, double xp, XPGainReason xpGainReason, XPGainSource xpGainSource) {
if (!primarySkillType.getPermissions(player)) { if (!primarySkillType.getPermissions(player)) {
return; return;
} }
@ -569,7 +569,7 @@ public class McMMOPlayer {
} }
int levelsGained = 0; int levelsGained = 0;
float xpRemoved = 0; double xpRemoved = 0;
while (getSkillXpLevelRaw(primarySkillType) >= getXpToLevel(primarySkillType)) { while (getSkillXpLevelRaw(primarySkillType) >= getXpToLevel(primarySkillType)) {
if (mcMMO.getPlayerLevelingSettings().isLevelCapEnabled(primarySkillType) if (mcMMO.getPlayerLevelingSettings().isLevelCapEnabled(primarySkillType)
@ -769,14 +769,14 @@ public class McMMOPlayer {
* @param xp Experience amount to process * @param xp Experience amount to process
* @return Modified experience * @return Modified experience
*/ */
private float modifyXpGain(PrimarySkillType primarySkillType, float xp) { private double modifyXpGain(PrimarySkillType primarySkillType, double xp) {
if (((primarySkillType.getMaxLevel() <= getSkillLevel(primarySkillType)) if (((primarySkillType.getMaxLevel() <= getSkillLevel(primarySkillType))
&& mcMMO.getPlayerLevelingSettings().isLevelCapEnabled(primarySkillType)) && mcMMO.getPlayerLevelingSettings().isLevelCapEnabled(primarySkillType))
|| (mcMMO.getPlayerLevelingSettings().getConfigSectionLevelCaps().getPowerLevel().getLevelCap() <= getPowerLevel())) { || (mcMMO.getPlayerLevelingSettings().getConfigSectionLevelCaps().getPowerLevel().getLevelCap() <= getPowerLevel())) {
return 0; return 0;
} }
xp = (float) (xp / primarySkillType.getXpModifier() * mcMMO.getDynamicSettingsManager().getExperienceManager().getGlobalXpMult()); xp = (double) (xp / primarySkillType.getXpModifier() * mcMMO.getDynamicSettingsManager().getExperienceManager().getGlobalXpMult());
//Multiply by the players personal XP rate //Multiply by the players personal XP rate
return xp * personalXPModifiers.get(primarySkillType); return xp * personalXPModifiers.get(primarySkillType);
@ -950,7 +950,7 @@ public class McMMOPlayer {
return profile.getSkillLevel(skill); return profile.getSkillLevel(skill);
} }
public float getSkillXpLevelRaw(PrimarySkillType skill) { public double getSkillXpLevelRaw(PrimarySkillType skill) {
return profile.getSkillXpLevelRaw(skill); return profile.getSkillXpLevelRaw(skill);
} }
@ -958,7 +958,7 @@ public class McMMOPlayer {
return profile.getSkillXpLevel(skill); return profile.getSkillXpLevel(skill);
} }
public void setSkillXpLevel(PrimarySkillType skill, float xpLevel) { public void setSkillXpLevel(PrimarySkillType skill, double xpLevel) {
profile.setSkillXpLevel(skill, xpLevel); profile.setSkillXpLevel(skill, xpLevel);
} }
@ -978,7 +978,7 @@ public class McMMOPlayer {
profile.addLevels(skill, levels); profile.addLevels(skill, levels);
} }
public void addXp(PrimarySkillType skill, float xp) { public void addXp(PrimarySkillType skill, double xp) {
profile.addXp(skill, xp); profile.addXp(skill, xp);
} }

View File

@ -20,7 +20,7 @@ public class PlayerProfile {
private final String playerName; private final String playerName;
/* Skill Data */ /* Skill Data */
private final Map<PrimarySkillType, Integer> skills = new HashMap<>(); // Skill & Level private final Map<PrimarySkillType, Integer> skills = new HashMap<>(); // Skill & Level
private final Map<PrimarySkillType, Float> skillsXp = new HashMap<>(); // Skill & XP private final Map<PrimarySkillType, Double> skillsXp = new HashMap<>(); // Skill & XP
private final Map<SuperAbilityType, Integer> abilityDATS = new HashMap<>(); // Ability & Cooldown private final Map<SuperAbilityType, Integer> abilityDATS = new HashMap<>(); // Ability & Cooldown
private final Map<UniqueDataType, Integer> uniquePlayerData = new HashMap<>(); //Misc data that doesn't fit into other categories (chimaera wing, etc..) private final Map<UniqueDataType, Integer> uniquePlayerData = new HashMap<>(); //Misc data that doesn't fit into other categories (chimaera wing, etc..)
private UUID uuid; private UUID uuid;
@ -32,7 +32,7 @@ public class PlayerProfile {
private int saveAttempts = 0; private int saveAttempts = 0;
// Store previous XP gains for diminished returns // Store previous XP gains for diminished returns
private DelayQueue<SkillXpGain> gainedSkillsXp = new DelayQueue<SkillXpGain>(); private DelayQueue<SkillXpGain> gainedSkillsXp = new DelayQueue<SkillXpGain>();
private HashMap<PrimarySkillType, Float> rollingSkillsXp = new HashMap<PrimarySkillType, Float>(); private HashMap<PrimarySkillType, Double> rollingSkillsXp = new HashMap<PrimarySkillType, Double>();
@Deprecated @Deprecated
public PlayerProfile(String playerName) { public PlayerProfile(String playerName) {
@ -52,7 +52,7 @@ public class PlayerProfile {
for (PrimarySkillType primarySkillType : PrimarySkillType.NON_CHILD_SKILLS) { for (PrimarySkillType primarySkillType : PrimarySkillType.NON_CHILD_SKILLS) {
skills.put(primarySkillType, mcMMO.getPlayerLevelingSettings().getConfigSectionLevelingGeneral().getStartingLevel()); skills.put(primarySkillType, mcMMO.getPlayerLevelingSettings().getConfigSectionLevelingGeneral().getStartingLevel());
skillsXp.put(primarySkillType, 0F); skillsXp.put(primarySkillType, 0.0);
} }
//Misc Cooldowns //Misc Cooldowns
@ -70,7 +70,7 @@ public class PlayerProfile {
this.loaded = isLoaded; this.loaded = isLoaded;
} }
public PlayerProfile(String playerName, UUID uuid, Map<PrimarySkillType, Integer> levelData, Map<PrimarySkillType, Float> xpData, Map<SuperAbilityType, Integer> cooldownData, MobHealthbarType mobHealthbarType, int scoreboardTipsShown, Map<UniqueDataType, Integer> uniqueProfileData) { public PlayerProfile(String playerName, UUID uuid, Map<PrimarySkillType, Integer> levelData, Map<PrimarySkillType, Double> xpData, Map<SuperAbilityType, Integer> cooldownData, MobHealthbarType mobHealthbarType, int scoreboardTipsShown, Map<UniqueDataType, Integer> uniqueProfileData) {
this.playerName = playerName; this.playerName = playerName;
this.uuid = uuid; this.uuid = uuid;
this.mobHealthbarType = mobHealthbarType; this.mobHealthbarType = mobHealthbarType;
@ -235,7 +235,7 @@ public class PlayerProfile {
return skill.isChildSkill() ? getChildSkillLevel(skill) : skills.get(skill); return skill.isChildSkill() ? getChildSkillLevel(skill) : skills.get(skill);
} }
public float getSkillXpLevelRaw(PrimarySkillType skill) { public double getSkillXpLevelRaw(PrimarySkillType skill) {
return skillsXp.get(skill); return skillsXp.get(skill);
} }
@ -243,7 +243,7 @@ public class PlayerProfile {
return (int) Math.floor(getSkillXpLevelRaw(skill)); return (int) Math.floor(getSkillXpLevelRaw(skill));
} }
public void setSkillXpLevel(PrimarySkillType skill, float xpLevel) { public void setSkillXpLevel(PrimarySkillType skill, double xpLevel) {
if (skill.isChildSkill()) { if (skill.isChildSkill()) {
return; return;
} }
@ -253,8 +253,8 @@ public class PlayerProfile {
skillsXp.put(skill, xpLevel); skillsXp.put(skill, xpLevel);
} }
protected float levelUp(PrimarySkillType skill) { protected double levelUp(PrimarySkillType skill) {
float xpRemoved = getXpToLevel(skill); double xpRemoved = getXpToLevel(skill);
changed = true; changed = true;
@ -280,7 +280,7 @@ public class PlayerProfile {
skillsXp.put(skill, skillsXp.get(skill) - xp); skillsXp.put(skill, skillsXp.get(skill) - xp);
} }
public void removeXp(PrimarySkillType skill, float xp) { public void removeXp(PrimarySkillType skill, double xp) {
if (skill.isChildSkill()) { if (skill.isChildSkill()) {
return; return;
} }
@ -308,7 +308,7 @@ public class PlayerProfile {
level = 0; level = 0;
skills.put(skill, level); skills.put(skill, level);
skillsXp.put(skill, 0F); skillsXp.put(skill, 0.0);
} }
/** /**
@ -327,12 +327,12 @@ public class PlayerProfile {
* @param skill Type of skill to add experience to * @param skill Type of skill to add experience to
* @param xp Number of experience to add * @param xp Number of experience to add
*/ */
public void addXp(PrimarySkillType skill, float xp) { public void addXp(PrimarySkillType skill, double xp) {
changed = true; changed = true;
if (skill.isChildSkill()) { if (skill.isChildSkill()) {
Set<PrimarySkillType> parentSkills = FamilyTree.getParents(skill); Set<PrimarySkillType> parentSkills = FamilyTree.getParents(skill);
float dividedXP = (xp / parentSkills.size()); double dividedXP = (xp / parentSkills.size());
for (PrimarySkillType parentSkill : parentSkills) { for (PrimarySkillType parentSkill : parentSkills) {
skillsXp.put(parentSkill, skillsXp.get(parentSkill) + dividedXP); skillsXp.put(parentSkill, skillsXp.get(parentSkill) + dividedXP);
@ -348,8 +348,8 @@ public class PlayerProfile {
* *
* @return xp Experience amount registered * @return xp Experience amount registered
*/ */
public float getRegisteredXpGain(PrimarySkillType primarySkillType) { public double getRegisteredXpGain(PrimarySkillType primarySkillType) {
float xp = 0F; double xp = 0F;
if (rollingSkillsXp.get(primarySkillType) != null) { if (rollingSkillsXp.get(primarySkillType) != null) {
xp = rollingSkillsXp.get(primarySkillType); xp = rollingSkillsXp.get(primarySkillType);
@ -365,7 +365,7 @@ public class PlayerProfile {
* @param primarySkillType Skill being used * @param primarySkillType Skill being used
* @param xp Experience amount to add * @param xp Experience amount to add
*/ */
public void registerXpGain(PrimarySkillType primarySkillType, float xp) { public void registerXpGain(PrimarySkillType primarySkillType, double xp) {
gainedSkillsXp.add(new SkillXpGain(primarySkillType, xp)); gainedSkillsXp.add(new SkillXpGain(primarySkillType, xp));
rollingSkillsXp.put(primarySkillType, getRegisteredXpGain(primarySkillType) + xp); rollingSkillsXp.put(primarySkillType, getRegisteredXpGain(primarySkillType) + xp);
} }

View File

@ -10,15 +10,15 @@ import org.bukkit.event.HandlerList;
*/ */
public class McMMOPlayerXpGainEvent extends McMMOPlayerExperienceEvent { public class McMMOPlayerXpGainEvent extends McMMOPlayerExperienceEvent {
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
private float xpGained; private double xpGained;
@Deprecated @Deprecated
public McMMOPlayerXpGainEvent(Player player, PrimarySkillType skill, float xpGained) { public McMMOPlayerXpGainEvent(Player player, PrimarySkillType skill, double xpGained) {
super(player, skill, XPGainReason.UNKNOWN); super(player, skill, XPGainReason.UNKNOWN);
this.xpGained = xpGained; this.xpGained = xpGained;
} }
public McMMOPlayerXpGainEvent(Player player, PrimarySkillType skill, float xpGained, XPGainReason xpGainReason) { public McMMOPlayerXpGainEvent(Player player, PrimarySkillType skill, double xpGained, XPGainReason xpGainReason) {
super(player, skill, xpGainReason); super(player, skill, xpGainReason);
this.xpGained = xpGained; this.xpGained = xpGained;
} }
@ -30,14 +30,14 @@ public class McMMOPlayerXpGainEvent extends McMMOPlayerExperienceEvent {
/** /**
* @return The amount of experience gained in this event * @return The amount of experience gained in this event
*/ */
public float getRawXpGained() { public double getRawXpGained() {
return xpGained; return xpGained;
} }
/** /**
* @param xpGained int amount of experience gained in this event * @param xpGained int amount of experience gained in this event
*/ */
public void setRawXpGained(float xpGained) { public void setRawXpGained(double xpGained) {
this.xpGained = xpGained; this.xpGained = xpGained;
} }

View File

@ -13,10 +13,10 @@ public class McMMOPlayerDeathPenaltyEvent extends PlayerEvent implements Cancell
**/ **/
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
private HashMap<String, Integer> levelChanged; private HashMap<String, Integer> levelChanged;
private HashMap<String, Float> experienceChanged; private HashMap<String, Double> experienceChanged;
private boolean cancelled; private boolean cancelled;
public McMMOPlayerDeathPenaltyEvent(Player player, HashMap<String, Integer> levelChanged, HashMap<String, Float> experienceChanged) { public McMMOPlayerDeathPenaltyEvent(Player player, HashMap<String, Integer> levelChanged, HashMap<String, Double> experienceChanged) {
super(player); super(player);
this.levelChanged = levelChanged; this.levelChanged = levelChanged;
this.experienceChanged = experienceChanged; this.experienceChanged = experienceChanged;
@ -41,11 +41,11 @@ public class McMMOPlayerDeathPenaltyEvent extends PlayerEvent implements Cancell
this.levelChanged = levelChanged; this.levelChanged = levelChanged;
} }
public HashMap<String, Float> getExperienceChanged() { public HashMap<String, Double> getExperienceChanged() {
return experienceChanged; return experienceChanged;
} }
public void setExperienceChanged(HashMap<String, Float> experienceChanged) { public void setExperienceChanged(HashMap<String, Double> experienceChanged) {
this.experienceChanged = experienceChanged; this.experienceChanged = experienceChanged;
} }

View File

@ -6,7 +6,7 @@ import java.util.HashMap;
public class McMMOPlayerStatLossEvent extends McMMOPlayerDeathPenaltyEvent { public class McMMOPlayerStatLossEvent extends McMMOPlayerDeathPenaltyEvent {
public McMMOPlayerStatLossEvent(Player player, HashMap<String, Integer> levelChanged, HashMap<String, Float> experienceChanged) { public McMMOPlayerStatLossEvent(Player player, HashMap<String, Integer> levelChanged, HashMap<String, Double> experienceChanged) {
super(player, levelChanged, experienceChanged); super(player, levelChanged, experienceChanged);
} }
} }

View File

@ -7,7 +7,7 @@ import java.util.HashMap;
public class McMMOPlayerVampirismEvent extends McMMOPlayerDeathPenaltyEvent { public class McMMOPlayerVampirismEvent extends McMMOPlayerDeathPenaltyEvent {
private boolean isVictim; private boolean isVictim;
public McMMOPlayerVampirismEvent(Player player, boolean isVictim, HashMap<String, Integer> levelChanged, HashMap<String, Float> experienceChanged) { public McMMOPlayerVampirismEvent(Player player, boolean isVictim, HashMap<String, Integer> levelChanged, HashMap<String, Double> experienceChanged) {
super(player, levelChanged, experienceChanged); super(player, levelChanged, experienceChanged);
this.isVictim = isVictim; this.isVictim = isVictim;
} }

View File

@ -11,10 +11,10 @@ public class McMMOPartyXpGainEvent extends Event implements Cancellable {
**/ **/
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
private Party party; private Party party;
private float xpGained; private double xpGained;
private boolean cancelled; private boolean cancelled;
public McMMOPartyXpGainEvent(Party party, float xpGained) { public McMMOPartyXpGainEvent(Party party, double xpGained) {
this.party = party; this.party = party;
this.xpGained = xpGained; this.xpGained = xpGained;
this.cancelled = false; this.cancelled = false;
@ -31,14 +31,14 @@ public class McMMOPartyXpGainEvent extends Event implements Cancellable {
/** /**
* @return The amount of experience gained in this event * @return The amount of experience gained in this event
*/ */
public float getRawXpGained() { public double getRawXpGained() {
return xpGained; return xpGained;
} }
/** /**
* @param xpGained set amount of experience gained in this event * @param xpGained set amount of experience gained in this event
*/ */
public void setRawXpGained(float xpGained) { public void setRawXpGained(double xpGained) {
this.xpGained = xpGained; this.xpGained = xpGained;
} }

View File

@ -116,19 +116,19 @@ public class SelfListener implements Listener {
return; return;
} }
final float rawXp = event.getRawXpGained(); final double rawXp = event.getRawXpGained();
float guaranteedMinimum = mcMMO.getConfigManager().getConfigLeveling().getGuaranteedMinimums() * rawXp; double guaranteedMinimum = mcMMO.getConfigManager().getConfigLeveling().getGuaranteedMinimums() * rawXp;
float modifiedThreshold = (float) (threshold / primarySkillType.getXpModifier() * mcMMO.getDynamicSettingsManager().getExperienceManager().getGlobalXpMult()); double modifiedThreshold = (double) (threshold / primarySkillType.getXpModifier() * mcMMO.getDynamicSettingsManager().getExperienceManager().getGlobalXpMult());
float difference = (mcMMOPlayer.getProfile().getRegisteredXpGain(primarySkillType) - modifiedThreshold) / modifiedThreshold; double difference = (mcMMOPlayer.getProfile().getRegisteredXpGain(primarySkillType) - modifiedThreshold) / modifiedThreshold;
if (difference > 0) { if (difference > 0) {
// System.out.println("Total XP Earned: " + mcMMOPlayer.getProfile().getRegisteredXpGain(primarySkillType) + " / Threshold value: " + threshold); // System.out.println("Total XP Earned: " + mcMMOPlayer.getProfile().getRegisteredXpGain(primarySkillType) + " / Threshold value: " + threshold);
// System.out.println(difference * 100 + "% over the threshold!"); // System.out.println(difference * 100 + "% over the threshold!");
// System.out.println("Previous: " + event.getRawXpGained()); // System.out.println("Previous: " + event.getRawXpGained());
// System.out.println("Adjusted XP " + (event.getRawXpGained() - (event.getRawXpGained() * difference))); // System.out.println("Adjusted XP " + (event.getRawXpGained() - (event.getRawXpGained() * difference)));
float newValue = rawXp - (rawXp * difference); double newValue = rawXp - (rawXp * difference);
/* /*
* Make sure players get a guaranteed minimum of XP * Make sure players get a guaranteed minimum of XP

View File

@ -29,7 +29,7 @@ public final class ShareHandler {
* @param primarySkillType Skill being used * @param primarySkillType Skill being used
* @return True is the xp has been shared * @return True is the xp has been shared
*/ */
public static boolean handleXpShare(float xp, McMMOPlayer mcMMOPlayer, PrimarySkillType primarySkillType, XPGainReason xpGainReason) { public static boolean handleXpShare(double xp, McMMOPlayer mcMMOPlayer, PrimarySkillType primarySkillType, XPGainReason xpGainReason) {
Party party = mcMMOPlayer.getParty(); Party party = mcMMOPlayer.getParty();
if (party.getXpShareMode() != ShareMode.EQUAL) { if (party.getXpShareMode() != ShareMode.EQUAL) {
@ -48,7 +48,7 @@ public final class ShareHandler {
double shareBonus = Math.min(mcMMO.getPartyXPShareSettings().getPartyShareXPBonusBase() double shareBonus = Math.min(mcMMO.getPartyXPShareSettings().getPartyShareXPBonusBase()
+ (partySize * mcMMO.getPartyXPShareSettings().getPartyShareBonusIncrease()), + (partySize * mcMMO.getPartyXPShareSettings().getPartyShareBonusIncrease()),
mcMMO.getPartyXPShareSettings().getPartyShareBonusCap()); mcMMO.getPartyXPShareSettings().getPartyShareBonusCap());
float splitXp = (float) (xp / partySize * shareBonus); double splitXp = (double) (xp / partySize * shareBonus);
for (Player member : nearMembers) { for (Player member : nearMembers) {
//Profile not loaded //Profile not loaded

View File

@ -25,6 +25,18 @@ public abstract class SkillManager {
return mcMMOPlayer.getSkillLevel(skill); return mcMMOPlayer.getSkillLevel(skill);
} }
/**
* Applies XP to a player, provides SELF as an XpGainSource source
*
* @param xp amount of XP to apply
* @param xpGainReason the reason for the XP gain
* @deprecated use applyXpGain(float, XPGainReason, XPGainSource)
*/
@Deprecated
public void applyXpGain(double xp, XPGainReason xpGainReason) {
mcMMOPlayer.beginXpGain(skill, xp, xpGainReason, XPGainSource.SELF);
}
/** /**
* Applies XP to a player, provides SELF as an XpGainSource source * Applies XP to a player, provides SELF as an XpGainSource source
* *
@ -48,6 +60,17 @@ public abstract class SkillManager {
mcMMOPlayer.beginXpGain(skill, xp, xpGainReason, xpGainSource); mcMMOPlayer.beginXpGain(skill, xp, xpGainReason, xpGainSource);
} }
/**
* Applies XP to a player
*
* @param xp amount of XP to apply
* @param xpGainReason the reason for the XP gain
* @param xpGainSource the source of the XP
*/
public void applyXpGain(double xp, XPGainReason xpGainReason, XPGainSource xpGainSource) {
mcMMOPlayer.beginXpGain(skill, xp, xpGainReason, xpGainSource);
}
public XPGainReason getXPGainReason(LivingEntity target, Entity damager) { public XPGainReason getXPGainReason(LivingEntity target, Entity damager) {
return (damager instanceof Player && target instanceof Player) ? XPGainReason.PVP : XPGainReason.PVE; return (damager instanceof Player && target instanceof Player) ? XPGainReason.PVP : XPGainReason.PVE;
} }

View File

@ -20,7 +20,7 @@ public final class Fishing {
public static Fishing instance; public static Fishing instance;
private final long fishingRodCastCdMilliseconds; private final long fishingRodCastCdMilliseconds;
private final int overfishLimit; private final int overfishLimit;
private final float boundingBoxSize; private final double boundingBoxSize;
private HashMap<Material, List<Enchantment>> enchantableCache = new HashMap<>(); private HashMap<Material, List<Enchantment>> enchantableCache = new HashMap<>();
private HashMap<Material, Integer> fishingXpRewardMap; private HashMap<Material, Integer> fishingXpRewardMap;
private Set<Biome> masterAnglerBiomes = BiomeAdapter.WATER_BIOMES; private Set<Biome> masterAnglerBiomes = BiomeAdapter.WATER_BIOMES;
@ -121,7 +121,7 @@ public final class Fishing {
return overfishLimit; return overfishLimit;
} }
public float getBoundingBoxSize() { public double getBoundingBoxSize() {
return boundingBoxSize; return boundingBoxSize;
} }
} }

View File

@ -173,7 +173,7 @@ public class RepairManager extends SkillManager {
inventory.removeItem(toRemove); inventory.removeItem(toRemove);
// Give out XP like candy // Give out XP like candy
applyXpGain((float) ((getPercentageRepaired(startDurability, newDurability, repairable.getMaximumDurability()) applyXpGain(((getPercentageRepaired(startDurability, newDurability, repairable.getMaximumDurability())
* repairable.getXpMultiplier()) * repairable.getXpMultiplier())
* mcMMO.getConfigManager().getConfigExperience().getRepairXPBase()) * mcMMO.getConfigManager().getConfigExperience().getRepairXPBase())
* mcMMO.getConfigManager().getConfigExperience().getExperienceRepair().getItemMaterialXPMultiplier(repairable.getRepairItemMaterialCategory()), XPGainReason.PVE); * mcMMO.getConfigManager().getConfigExperience().getExperienceRepair().getItemMaterialXPMultiplier(repairable.getRepairItemMaterialCategory()), XPGainReason.PVE);
@ -188,7 +188,7 @@ public class RepairManager extends SkillManager {
item.setDurability(newDurability); item.setDurability(newDurability);
} }
private float getPercentageRepaired(short startDurability, short newDurability, short totalDurability) { private double getPercentageRepaired(short startDurability, short newDurability, short totalDurability) {
return ((startDurability - newDurability) / (float) totalDurability); return ((startDurability - newDurability) / (float) totalDurability);
} }

View File

@ -203,7 +203,7 @@ public class EventUtils {
} }
public static boolean handleLevelChangeEvent(Player player, PrimarySkillType skill, int levelsChanged, float xpRemoved, boolean isLevelUp, XPGainReason xpGainReason) { public static boolean handleLevelChangeEvent(Player player, PrimarySkillType skill, int levelsChanged, double xpRemoved, boolean isLevelUp, XPGainReason xpGainReason) {
McMMOPlayerLevelChangeEvent event = isLevelUp ? new McMMOPlayerLevelUpEvent(player, skill, levelsChanged, xpGainReason) : new McMMOPlayerLevelDownEvent(player, skill, levelsChanged, xpGainReason); McMMOPlayerLevelChangeEvent event = isLevelUp ? new McMMOPlayerLevelUpEvent(player, skill, levelsChanged, xpGainReason) : new McMMOPlayerLevelDownEvent(player, skill, levelsChanged, xpGainReason);
mcMMO.p.getServer().getPluginManager().callEvent(event); mcMMO.p.getServer().getPluginManager().callEvent(event);
@ -219,7 +219,7 @@ public class EventUtils {
return !isCancelled; return !isCancelled;
} }
public static void handleLevelChangeEventEdit(Player player, PrimarySkillType skill, int levelsChanged, float xpRemoved, boolean isLevelUp, XPGainReason xpGainReason, int oldLevel) { public static void handleLevelChangeEventEdit(Player player, PrimarySkillType skill, int levelsChanged, double xpRemoved, boolean isLevelUp, XPGainReason xpGainReason, int oldLevel) {
McMMOPlayerLevelChangeEvent event = isLevelUp ? new McMMOPlayerLevelUpEvent(player, skill, levelsChanged - oldLevel, xpGainReason) : new McMMOPlayerLevelDownEvent(player, skill, levelsChanged, xpGainReason); McMMOPlayerLevelChangeEvent event = isLevelUp ? new McMMOPlayerLevelUpEvent(player, skill, levelsChanged - oldLevel, xpGainReason) : new McMMOPlayerLevelDownEvent(player, skill, levelsChanged, xpGainReason);
mcMMO.p.getServer().getPluginManager().callEvent(event); mcMMO.p.getServer().getPluginManager().callEvent(event);
@ -280,7 +280,7 @@ public class EventUtils {
mcMMOPlayer.getPartyTeleportRecord().actualizeLastUse(); mcMMOPlayer.getPartyTeleportRecord().actualizeLastUse();
} }
public static boolean handlePartyXpGainEvent(Party party, float xpGained) { public static boolean handlePartyXpGainEvent(Party party, double xpGained) {
McMMOPartyXpGainEvent event = new McMMOPartyXpGainEvent(party, xpGained); McMMOPartyXpGainEvent event = new McMMOPartyXpGainEvent(party, xpGained);
mcMMO.p.getServer().getPluginManager().callEvent(event); mcMMO.p.getServer().getPluginManager().callEvent(event);
@ -293,7 +293,7 @@ public class EventUtils {
return !isCancelled; return !isCancelled;
} }
public static boolean handlePartyLevelChangeEvent(Party party, int levelsChanged, float xpRemoved) { public static boolean handlePartyLevelChangeEvent(Party party, int levelsChanged, double xpRemoved) {
McMMOPartyLevelUpEvent event = new McMMOPartyLevelUpEvent(party, levelsChanged); McMMOPartyLevelUpEvent event = new McMMOPartyLevelUpEvent(party, levelsChanged);
mcMMO.p.getServer().getPluginManager().callEvent(event); mcMMO.p.getServer().getPluginManager().callEvent(event);
@ -308,7 +308,7 @@ public class EventUtils {
return !isCancelled; return !isCancelled;
} }
public static boolean handleXpGainEvent(Player player, PrimarySkillType skill, float xpGained, XPGainReason xpGainReason) { public static boolean handleXpGainEvent(Player player, PrimarySkillType skill, double xpGained, XPGainReason xpGainReason) {
McMMOPlayerXpGainEvent event = new McMMOPlayerXpGainEvent(player, skill, xpGained, xpGainReason); McMMOPlayerXpGainEvent event = new McMMOPlayerXpGainEvent(player, skill, xpGained, xpGainReason);
mcMMO.p.getServer().getPluginManager().callEvent(event); mcMMO.p.getServer().getPluginManager().callEvent(event);
@ -322,7 +322,7 @@ public class EventUtils {
return !isCancelled; return !isCancelled;
} }
public static boolean handleStatsLossEvent(Player player, HashMap<String, Integer> levelChanged, HashMap<String, Float> experienceChanged) { public static boolean handleStatsLossEvent(Player player, HashMap<String, Integer> levelChanged, HashMap<String, Double> experienceChanged) {
if (UserManager.getPlayer(player) == null) if (UserManager.getPlayer(player) == null)
return true; return true;
@ -356,7 +356,7 @@ public class EventUtils {
return !isCancelled; return !isCancelled;
} }
public static boolean handleVampirismEvent(Player killer, Player victim, HashMap<String, Integer> levelChanged, HashMap<String, Float> experienceChanged) { public static boolean handleVampirismEvent(Player killer, Player victim, HashMap<String, Integer> levelChanged, HashMap<String, Double> experienceChanged) {
McMMOPlayerVampirismEvent eventKiller = new McMMOPlayerVampirismEvent(killer, false, levelChanged, experienceChanged); McMMOPlayerVampirismEvent eventKiller = new McMMOPlayerVampirismEvent(killer, false, levelChanged, experienceChanged);
McMMOPlayerVampirismEvent eventVictim = new McMMOPlayerVampirismEvent(victim, true, levelChanged, experienceChanged); McMMOPlayerVampirismEvent eventVictim = new McMMOPlayerVampirismEvent(victim, true, levelChanged, experienceChanged);
mcMMO.p.getServer().getPluginManager().callEvent(eventKiller); mcMMO.p.getServer().getPluginManager().callEvent(eventKiller);
@ -366,10 +366,10 @@ public class EventUtils {
if (!isCancelled) { if (!isCancelled) {
HashMap<String, Integer> levelChangedKiller = eventKiller.getLevelChanged(); HashMap<String, Integer> levelChangedKiller = eventKiller.getLevelChanged();
HashMap<String, Float> experienceChangedKiller = eventKiller.getExperienceChanged(); HashMap<String, Double> experienceChangedKiller = eventKiller.getExperienceChanged();
HashMap<String, Integer> levelChangedVictim = eventVictim.getLevelChanged(); HashMap<String, Integer> levelChangedVictim = eventVictim.getLevelChanged();
HashMap<String, Float> experienceChangedVictim = eventVictim.getExperienceChanged(); HashMap<String, Double> experienceChangedVictim = eventVictim.getExperienceChanged();
McMMOPlayer killerPlayer = UserManager.getPlayer(killer); McMMOPlayer killerPlayer = UserManager.getPlayer(killer);

View File

@ -25,12 +25,12 @@ public final class HardcoreManager {
int totalLevelsLost = 0; int totalLevelsLost = 0;
HashMap<String, Integer> levelChanged = new HashMap<>(); HashMap<String, Integer> levelChanged = new HashMap<>();
HashMap<String, Float> experienceChanged = new HashMap<>(); HashMap<String, Double> experienceChanged = new HashMap<>();
for (PrimarySkillType primarySkillType : PrimarySkillType.NON_CHILD_SKILLS) { for (PrimarySkillType primarySkillType : PrimarySkillType.NON_CHILD_SKILLS) {
if (!primarySkillType.getHardcoreStatLossEnabled()) { if (!primarySkillType.getHardcoreStatLossEnabled()) {
levelChanged.put(primarySkillType.toString(), 0); levelChanged.put(primarySkillType.toString(), 0);
experienceChanged.put(primarySkillType.toString(), 0F); experienceChanged.put(primarySkillType.toString(), 0.0);
continue; continue;
} }
@ -39,7 +39,7 @@ public final class HardcoreManager {
if (playerSkillLevel <= 0 || playerSkillLevel <= levelThreshold) { if (playerSkillLevel <= 0 || playerSkillLevel <= levelThreshold) {
levelChanged.put(primarySkillType.toString(), 0); levelChanged.put(primarySkillType.toString(), 0);
experienceChanged.put(primarySkillType.toString(), 0F); experienceChanged.put(primarySkillType.toString(), 0.0);
continue; continue;
} }
@ -47,7 +47,7 @@ public final class HardcoreManager {
int levelsLost = (int) statsLost; int levelsLost = (int) statsLost;
int xpLost = (int) Math.floor(playerSkillXpLevel * (statsLost - levelsLost)); int xpLost = (int) Math.floor(playerSkillXpLevel * (statsLost - levelsLost));
levelChanged.put(primarySkillType.toString(), levelsLost); levelChanged.put(primarySkillType.toString(), levelsLost);
experienceChanged.put(primarySkillType.toString(), (float) xpLost); experienceChanged.put(primarySkillType.toString(), (double) xpLost);
totalLevelsLost += levelsLost; totalLevelsLost += levelsLost;
} }
@ -71,12 +71,12 @@ public final class HardcoreManager {
int totalLevelsStolen = 0; int totalLevelsStolen = 0;
HashMap<String, Integer> levelChanged = new HashMap<>(); HashMap<String, Integer> levelChanged = new HashMap<>();
HashMap<String, Float> experienceChanged = new HashMap<>(); HashMap<String, Double> experienceChanged = new HashMap<>();
for (PrimarySkillType primarySkillType : PrimarySkillType.NON_CHILD_SKILLS) { for (PrimarySkillType primarySkillType : PrimarySkillType.NON_CHILD_SKILLS) {
if (!primarySkillType.getHardcoreVampirismEnabled()) { if (!primarySkillType.getHardcoreVampirismEnabled()) {
levelChanged.put(primarySkillType.toString(), 0); levelChanged.put(primarySkillType.toString(), 0);
experienceChanged.put(primarySkillType.toString(), 0F); experienceChanged.put(primarySkillType.toString(), 0.0);
continue; continue;
} }
@ -85,7 +85,7 @@ public final class HardcoreManager {
if (victimSkillLevel <= 0 || victimSkillLevel < killerSkillLevel / 2 || victimSkillLevel <= levelThreshold) { if (victimSkillLevel <= 0 || victimSkillLevel < killerSkillLevel / 2 || victimSkillLevel <= levelThreshold) {
levelChanged.put(primarySkillType.toString(), 0); levelChanged.put(primarySkillType.toString(), 0);
experienceChanged.put(primarySkillType.toString(), 0F); experienceChanged.put(primarySkillType.toString(), 0.0);
continue; continue;
} }
@ -95,7 +95,7 @@ public final class HardcoreManager {
int levelsStolen = (int) statsStolen; int levelsStolen = (int) statsStolen;
int xpStolen = (int) Math.floor(victimSkillXpLevel * (statsStolen - levelsStolen)); int xpStolen = (int) Math.floor(victimSkillXpLevel * (statsStolen - levelsStolen));
levelChanged.put(primarySkillType.toString(), levelsStolen); levelChanged.put(primarySkillType.toString(), levelsStolen);
experienceChanged.put(primarySkillType.toString(), (float) xpStolen); experienceChanged.put(primarySkillType.toString(), (double) xpStolen);
totalLevelsStolen += levelsStolen; totalLevelsStolen += levelsStolen;
} }

View File

@ -19,9 +19,9 @@ public class ExperienceManager {
private HashMap<String, Integer> woodcuttingFullyQualifiedBlockXpMap; private HashMap<String, Integer> woodcuttingFullyQualifiedBlockXpMap;
private HashMap<String, Integer> excavationFullyQualifiedBlockXpMap; private HashMap<String, Integer> excavationFullyQualifiedBlockXpMap;
private HashMap<String, Integer> furnaceFullyQualifiedItemXpMap; private HashMap<String, Integer> furnaceFullyQualifiedItemXpMap;
private HashMap<EntityType, Float> tamingExperienceMap; private HashMap<EntityType, Double> tamingExperienceMap;
private HashMap<EntityType, Float> combatXPMultiplierMap; private HashMap<EntityType, Double> combatXPMultiplierMap;
private HashMap<SpecialXPKey, Float> specialCombatXPMultiplierMap; //Applies to "groups" of things for convenience private HashMap<SpecialXPKey, Double> specialCombatXPMultiplierMap; //Applies to "groups" of things for convenience
private double globalXpMult; private double globalXpMult;
@ -57,7 +57,7 @@ public class ExperienceManager {
* *
* @param platformSafeMap the platform safe map * @param platformSafeMap the platform safe map
*/ */
public void fillCombatXPMultiplierMap(HashMap<String, Float> platformSafeMap) { public void fillCombatXPMultiplierMap(HashMap<String, Double> platformSafeMap) {
mcMMO.p.getLogger().info("Registering combat XP values..."); mcMMO.p.getLogger().info("Registering combat XP values...");
for (String entityString : platformSafeMap.keySet()) { for (String entityString : platformSafeMap.keySet()) {
//Iterate over all EntityType(s) //Iterate over all EntityType(s)
@ -83,7 +83,7 @@ public class ExperienceManager {
* *
* @param map target map * @param map target map
*/ */
public void registerSpecialCombatXPMultiplierMap(HashMap<SpecialXPKey, Float> map) { public void registerSpecialCombatXPMultiplierMap(HashMap<SpecialXPKey, Double> map) {
mcMMO.p.getLogger().info("Registering special combat XP values..."); mcMMO.p.getLogger().info("Registering special combat XP values...");
specialCombatXPMultiplierMap = map; specialCombatXPMultiplierMap = map;
} }
@ -122,7 +122,7 @@ public class ExperienceManager {
if (entityType.toString().equalsIgnoreCase(s)) { if (entityType.toString().equalsIgnoreCase(s)) {
//Match! //Match!
matchFound = true; matchFound = true;
tamingExperienceMap.put(entityType, (float) userTamingConfigMap.get(s)); tamingExperienceMap.put(entityType, (double) userTamingConfigMap.get(s));
} }
} }
if (!matchFound) { if (!matchFound) {
@ -244,7 +244,7 @@ public class ExperienceManager {
* @deprecated its faster to use direct calls to get XP, for example getMiningXP(Material material) instead of using this method * @deprecated its faster to use direct calls to get XP, for example getMiningXP(Material material) instead of using this method
*/ */
@Deprecated @Deprecated
public float getBlockBreakXpValue(PrimarySkillType primarySkillType, Material material) throws UndefinedSkillBehaviour { public double getBlockBreakXpValue(PrimarySkillType primarySkillType, Material material) throws UndefinedSkillBehaviour {
switch (primarySkillType) { switch (primarySkillType) {
case MINING: case MINING:
return getMiningXp(material); return getMiningXp(material);
@ -265,7 +265,7 @@ public class ExperienceManager {
* @param entityType target entity * @param entityType target entity
* @return value of XP for this entity * @return value of XP for this entity
*/ */
public float getTamingXp(EntityType entityType) { public double getTamingXp(EntityType entityType) {
return tamingExperienceMap.get(entityType); return tamingExperienceMap.get(entityType);
} }
@ -376,7 +376,7 @@ public class ExperienceManager {
* @param specialXPKey target special XP group * @param specialXPKey target special XP group
* @return XP multiplier for target special XP group * @return XP multiplier for target special XP group
*/ */
public float getSpecialCombatXP(SpecialXPKey specialXPKey) { public double getSpecialCombatXP(SpecialXPKey specialXPKey) {
return specialCombatXPMultiplierMap.get(specialXPKey); return specialCombatXPMultiplierMap.get(specialXPKey);
} }
@ -386,7 +386,7 @@ public class ExperienceManager {
* @param entityType target entity type * @param entityType target entity type
* @return the combat XP multiplier for this entity * @return the combat XP multiplier for this entity
*/ */
public float getCombatXPMultiplier(EntityType entityType) { public double getCombatXPMultiplier(EntityType entityType) {
return combatXPMultiplierMap.get(entityType); return combatXPMultiplierMap.get(entityType);
} }

View File

@ -92,11 +92,11 @@ public class PlayerLevelUtils {
* @param skill target skill * @param skill target skill
* @return the highest XP boost that this player qualifies for through perks or otherwise for target skill * @return the highest XP boost that this player qualifies for through perks or otherwise for target skill
*/ */
public float determineXpPerkValue(Player player, PrimarySkillType skill) { public Double determineXpPerkValue(Player player, PrimarySkillType skill) {
HashSet<CustomXPPerk> enabledCustomXPPerks = findCustomXPPerks(player); HashSet<CustomXPPerk> enabledCustomXPPerks = findCustomXPPerks(player);
//A player can have multiple overlapping perks at a time, we need to compile a list and then sort it for the highest value //A player can have multiple overlapping perks at a time, we need to compile a list and then sort it for the highest value
HashSet<Float> xpPerkValues = new HashSet<>(); HashSet<Double> xpPerkValues = new HashSet<>();
if (enabledCustomXPPerks.size() >= 1) { if (enabledCustomXPPerks.size() >= 1) {
//Player has custom XP perks //Player has custom XP perks
@ -110,17 +110,17 @@ public class PlayerLevelUtils {
//Disgusting legacy support start //Disgusting legacy support start
if (Permissions.quadrupleXp(player, skill)) { if (Permissions.quadrupleXp(player, skill)) {
xpPerkValues.add(4f); xpPerkValues.add(4.0);
} else if (Permissions.tripleXp(player, skill)) { } else if (Permissions.tripleXp(player, skill)) {
xpPerkValues.add(3f); xpPerkValues.add(3.0);
} else if (Permissions.doubleAndOneHalfXp(player, skill)) { } else if (Permissions.doubleAndOneHalfXp(player, skill)) {
xpPerkValues.add(2.5f); xpPerkValues.add(2.5);
} else if (Permissions.doubleXp(player, skill)) { } else if (Permissions.doubleXp(player, skill)) {
xpPerkValues.add(2.0f); xpPerkValues.add(2.0);
} else if (Permissions.oneAndOneHalfXp(player, skill)) { } else if (Permissions.oneAndOneHalfXp(player, skill)) {
xpPerkValues.add(1.5f); xpPerkValues.add(1.5);
} else if (Permissions.oneAndOneTenthXp(player, skill)) { } else if (Permissions.oneAndOneTenthXp(player, skill)) {
xpPerkValues.add(1.1f); xpPerkValues.add(1.1);
} }
//Disgusting legacy support end //Disgusting legacy support end
@ -128,7 +128,7 @@ public class PlayerLevelUtils {
if (xpPerkValues.size() >= 1) if (xpPerkValues.size() >= 1)
return Collections.max(xpPerkValues); return Collections.max(xpPerkValues);
else else
return 1.0F; return 1.0;
} }

View File

@ -553,7 +553,7 @@ public final class CombatUtils {
* @param primarySkillType The skill being used * @param primarySkillType The skill being used
*/ */
private static void startGainXp(McMMOPlayer mcMMOPlayer, LivingEntity target, PrimarySkillType primarySkillType, double multiplier) { private static void startGainXp(McMMOPlayer mcMMOPlayer, LivingEntity target, PrimarySkillType primarySkillType, double multiplier) {
float baseXPMultiplier = 0; double baseXPMultiplier = 0;
XPGainReason xpGainReason; XPGainReason xpGainReason;
if (target instanceof Player) { if (target instanceof Player) {