From fc6c6ed2c411a4b2b1b648fb25d35a6b77e5d26d Mon Sep 17 00:00:00 2001 From: nossr50 Date: Tue, 4 Jun 2019 21:12:10 -0700 Subject: [PATCH] Using doubles in most places again to avoid precision loss --- .../com/gmail/nossr50/api/ExperienceAPI.java | 30 ++-- .../commands/experience/AddlevelsCommand.java | 2 +- .../commands/experience/MmoeditCommand.java | 2 +- .../experience/SkillresetCommand.java | 2 +- .../commands/skills/AcrobaticsCommand.java | 4 +- .../commands/skills/AlchemyCommand.java | 4 +- .../commands/skills/ArcheryCommand.java | 4 +- .../nossr50/commands/skills/AxesCommand.java | 4 +- .../commands/skills/ExcavationCommand.java | 4 +- .../commands/skills/FishingCommand.java | 4 +- .../commands/skills/HerbalismCommand.java | 4 +- .../commands/skills/MiningCommand.java | 4 +- .../commands/skills/RepairCommand.java | 4 +- .../commands/skills/SalvageCommand.java | 4 +- .../nossr50/commands/skills/SkillCommand.java | 12 +- .../commands/skills/SmeltingCommand.java | 4 +- .../commands/skills/SwordsCommand.java | 4 +- .../commands/skills/TamingCommand.java | 4 +- .../commands/skills/UnarmedCommand.java | 4 +- .../commands/skills/WoodcuttingCommand.java | 4 +- .../antiexploit/ConfigExploitPrevention.java | 2 +- .../ConfigSectionExploitFishing.java | 6 +- .../ConfigSectionExploitSkills.java | 2 +- .../hocon/experience/ConfigExperience.java | 18 +-- .../ConfigExperienceAcrobatics.java | 6 +- .../experience/ConfigExperienceArchery.java | 6 +- .../experience/ConfigExperienceCombat.java | 136 +++++++++--------- .../ConfigExperienceCustomBoosts.java | 16 ++- .../experience/ConfigExperienceRepair.java | 28 ++-- .../ConfigExperienceSkillMultiplier.java | 30 ++-- .../experience/ConfigExperienceSkills.java | 12 +- .../ConfigExperienceFormula.java | 40 +++--- .../ConfigExperienceFormulaExponential.java | 12 +- .../ConfigExperienceFormulaLinear.java | 6 +- .../hocon/playerleveling/ConfigLeveling.java | 2 +- .../serializers/CustomXPPerkSerializer.java | 10 +- .../serializers/DamagePropertySerializer.java | 4 +- .../database/FlatfileDatabaseManager.java | 28 ++-- .../nossr50/database/SQLDatabaseManager.java | 28 ++-- .../datatypes/experience/CustomXPPerk.java | 8 +- .../datatypes/experience/SkillXpGain.java | 6 +- .../gmail/nossr50/datatypes/party/Party.java | 16 +-- .../nossr50/datatypes/player/McMMOPlayer.java | 24 ++-- .../datatypes/player/PlayerProfile.java | 30 ++-- .../experience/McMMOPlayerXpGainEvent.java | 10 +- .../McMMOPlayerDeathPenaltyEvent.java | 8 +- .../hardcore/McMMOPlayerStatLossEvent.java | 2 +- .../hardcore/McMMOPlayerVampirismEvent.java | 2 +- .../events/party/McMMOPartyXpGainEvent.java | 8 +- .../gmail/nossr50/listeners/SelfListener.java | 10 +- .../com/gmail/nossr50/party/ShareHandler.java | 4 +- .../gmail/nossr50/skills/SkillManager.java | 23 +++ .../gmail/nossr50/skills/fishing/Fishing.java | 4 +- .../nossr50/skills/repair/RepairManager.java | 4 +- .../com/gmail/nossr50/util/EventUtils.java | 18 +-- .../gmail/nossr50/util/HardcoreManager.java | 16 +-- .../util/experience/ExperienceManager.java | 20 +-- .../nossr50/util/player/PlayerLevelUtils.java | 18 +-- .../nossr50/util/skills/CombatUtils.java | 2 +- 59 files changed, 382 insertions(+), 351 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/api/ExperienceAPI.java b/src/main/java/com/gmail/nossr50/api/ExperienceAPI.java index 69069f2bd..0ea25819a 100644 --- a/src/main/java/com/gmail/nossr50/api/ExperienceAPI.java +++ b/src/main/java/com/gmail/nossr50/api/ExperienceAPI.java @@ -42,7 +42,7 @@ public final class ExperienceAPI { * @param primarySkillType target skill * @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 return player.getPlayerSpecificXPMult(primarySkillType); } @@ -65,7 +65,7 @@ public final class ExperienceAPI { @Deprecated 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 */ @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"); } @@ -95,7 +95,7 @@ public final class ExperienceAPI { * @throws InvalidSkillException if the given skill 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); } @@ -112,7 +112,7 @@ public final class ExperienceAPI { * @throws InvalidSkillException if the given skill 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) { getPlayer(player).beginUnsharedXpGain(getSkillType(skillType), XP, getXPGainReason(xpGainReason), XPGainSource.CUSTOM); return; @@ -126,12 +126,12 @@ public final class ExperienceAPI { *
* This function is designed for API usage. * - * @deprecated We're using float for our XP values now - * replaced by {@link #addRawXPOffline(String playerName, String skillType, float XP)} + * @deprecated We're using double for our XP values now + * replaced by {@link #addRawXPOffline(String playerName, String skillType, double XP)} */ @Deprecated 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 InvalidPlayerException if the given player does not exist in the database * @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 - 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)); } @@ -163,7 +163,7 @@ public final class ExperienceAPI { * @throws InvalidSkillException if the given skill is not valid * @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)); } @@ -402,7 +402,7 @@ public final class ExperienceAPI { * @throws InvalidSkillException if the given skill is not valid * @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)); } @@ -419,7 +419,7 @@ public final class ExperienceAPI { * @throws UnsupportedOperationException if the given skill is a child skill */ @Deprecated - public static float getOfflineXPRaw(String playerName, String skillType) { + public static double getOfflineXPRaw(String playerName, String 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 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)); } @@ -538,7 +538,7 @@ public final class ExperienceAPI { * @throws InvalidPlayerException if the given player does not exist in the database * @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); PlayerProfile profile = getOfflineProfile(uuid); diff --git a/src/main/java/com/gmail/nossr50/commands/experience/AddlevelsCommand.java b/src/main/java/com/gmail/nossr50/commands/experience/AddlevelsCommand.java index 22cc3e6f3..f0350674f 100644 --- a/src/main/java/com/gmail/nossr50/commands/experience/AddlevelsCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/experience/AddlevelsCommand.java @@ -22,7 +22,7 @@ public class AddlevelsCommand extends ExperienceCommand { @Override 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); if (player == null) { diff --git a/src/main/java/com/gmail/nossr50/commands/experience/MmoeditCommand.java b/src/main/java/com/gmail/nossr50/commands/experience/MmoeditCommand.java index ded4aaa18..112a399da 100644 --- a/src/main/java/com/gmail/nossr50/commands/experience/MmoeditCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/experience/MmoeditCommand.java @@ -23,7 +23,7 @@ public class MmoeditCommand extends ExperienceCommand { @Override protected void handleCommand(Player player, PlayerProfile profile, PrimarySkillType skill, int value) { int skillLevel = profile.getSkillLevel(skill); - float xpRemoved = profile.getSkillXpLevelRaw(skill); + double xpRemoved = profile.getSkillXpLevelRaw(skill); profile.modifySkill(skill, value); diff --git a/src/main/java/com/gmail/nossr50/commands/experience/SkillresetCommand.java b/src/main/java/com/gmail/nossr50/commands/experience/SkillresetCommand.java index 915806510..9d610bc2c 100644 --- a/src/main/java/com/gmail/nossr50/commands/experience/SkillresetCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/experience/SkillresetCommand.java @@ -122,7 +122,7 @@ public class SkillresetCommand implements TabExecutor { protected void handleCommand(Player player, PlayerProfile profile, PrimarySkillType skill) { int levelsRemoved = profile.getSkillLevel(skill); - float xpRemoved = profile.getSkillXpLevelRaw(skill); + double xpRemoved = profile.getSkillXpLevelRaw(skill); profile.modifySkill(skill, 0); diff --git a/src/main/java/com/gmail/nossr50/commands/skills/AcrobaticsCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/AcrobaticsCommand.java index 22efda139..c75e01532 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/AcrobaticsCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/AcrobaticsCommand.java @@ -26,7 +26,7 @@ public class AcrobaticsCommand extends SkillCommand { } @Override - protected void dataCalculations(Player player, float skillValue) { + protected void dataCalculations(Player player, double skillValue) { // ACROBATICS_DODGE if (canDodge) { String[] dodgeStrings = getAbilityDisplayValues(player, SubSkillType.ACROBATICS_DODGE); @@ -42,7 +42,7 @@ public class AcrobaticsCommand extends SkillCommand { } @Override - protected List statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) { + protected List statsDisplay(Player player, double skillValue, boolean hasEndurance, boolean isLucky) { List messages = new ArrayList<>(); if (canDodge) { diff --git a/src/main/java/com/gmail/nossr50/commands/skills/AlchemyCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/AlchemyCommand.java index f0b51e2c0..e483392e8 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/AlchemyCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/AlchemyCommand.java @@ -42,7 +42,7 @@ //// } // // @Override -// protected void dataCalculations(Player player, float skillValue) { +// protected void dataCalculations(Player player, double skillValue) { // // ALCHEMY_CATALYSIS //// if (canCatalysis) { //// String[] catalysisStrings = calculateAbilityDisplayValues(player); @@ -66,7 +66,7 @@ // } // // @Override -// protected List statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) { +// protected List statsDisplay(Player player, double skillValue, boolean hasEndurance, boolean isLucky) { // List messages = new ArrayList<>(); // //// if (canCatalysis) { diff --git a/src/main/java/com/gmail/nossr50/commands/skills/ArcheryCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/ArcheryCommand.java index 423a56fe9..bc5bfc1f4 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/ArcheryCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/ArcheryCommand.java @@ -28,7 +28,7 @@ public class ArcheryCommand extends SkillCommand { } @Override - protected void dataCalculations(Player player, float skillValue) { + protected void dataCalculations(Player player, double skillValue) { // ARCHERY_ARROW_RETRIEVAL if (canRetrieve) { String[] retrieveStrings = getAbilityDisplayValues(player, SubSkillType.ARCHERY_ARROW_RETRIEVAL); @@ -57,7 +57,7 @@ public class ArcheryCommand extends SkillCommand { } @Override - protected List statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) { + protected List statsDisplay(Player player, double skillValue, boolean hasEndurance, boolean isLucky) { List messages = new ArrayList<>(); if (canRetrieve) { diff --git a/src/main/java/com/gmail/nossr50/commands/skills/AxesCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/AxesCommand.java index 6be6ab81e..9ecd5b273 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/AxesCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/AxesCommand.java @@ -35,7 +35,7 @@ public class AxesCommand extends SkillCommand { } @Override - protected void dataCalculations(Player player, float skillValue) { + protected void dataCalculations(Player player, double skillValue) { // ARMOR IMPACT if (canImpact) { impactDamage = UserManager.getPlayer(player).getAxesManager().getImpactDurabilityDamage(); @@ -71,7 +71,7 @@ public class AxesCommand extends SkillCommand { } @Override - protected List statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) { + protected List statsDisplay(Player player, double skillValue, boolean hasEndurance, boolean isLucky) { List messages = new ArrayList<>(); if (canImpact) { diff --git a/src/main/java/com/gmail/nossr50/commands/skills/ExcavationCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/ExcavationCommand.java index d32bb8c66..6e8d97a3c 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/ExcavationCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/ExcavationCommand.java @@ -24,7 +24,7 @@ public class ExcavationCommand extends SkillCommand { } @Override - protected void dataCalculations(Player player, float skillValue) { + protected void dataCalculations(Player player, double skillValue) { // GIGA DRILL BREAKER if (canGigaDrill) { String[] gigaDrillStrings = calculateLengthDisplayValues(player, skillValue); @@ -40,7 +40,7 @@ public class ExcavationCommand extends SkillCommand { } @Override - protected List statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) { + protected List statsDisplay(Player player, double skillValue, boolean hasEndurance, boolean isLucky) { List messages = new ArrayList<>(); if (canGigaDrill) { diff --git a/src/main/java/com/gmail/nossr50/commands/skills/FishingCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/FishingCommand.java index 730066154..26a266d13 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/FishingCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/FishingCommand.java @@ -51,7 +51,7 @@ public class FishingCommand extends SkillCommand { } @Override - protected void dataCalculations(Player player, float skillValue) { + protected void dataCalculations(Player player, double skillValue) { FishingManager fishingManager = UserManager.getPlayer(player).getFishingManager(); // TREASURE HUNTER @@ -133,7 +133,7 @@ public class FishingCommand extends SkillCommand { } @Override - protected List statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) { + protected List statsDisplay(Player player, double skillValue, boolean hasEndurance, boolean isLucky) { List messages = new ArrayList<>(); if (canFishermansDiet) { diff --git a/src/main/java/com/gmail/nossr50/commands/skills/HerbalismCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/HerbalismCommand.java index 3519c8e34..f20b27ada 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/HerbalismCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/HerbalismCommand.java @@ -40,7 +40,7 @@ public class HerbalismCommand extends SkillCommand { } @Override - protected void dataCalculations(Player player, float skillValue) { + protected void dataCalculations(Player player, double skillValue) { // DOUBLE DROPS if (canDoubleDrop) { @@ -97,7 +97,7 @@ public class HerbalismCommand extends SkillCommand { } @Override - protected List statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) { + protected List statsDisplay(Player player, double skillValue, boolean hasEndurance, boolean isLucky) { List messages = new ArrayList<>(); if (canDoubleDrop) { diff --git a/src/main/java/com/gmail/nossr50/commands/skills/MiningCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/MiningCommand.java index e671faa01..054ce8f50 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/MiningCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/MiningCommand.java @@ -38,7 +38,7 @@ public class MiningCommand extends SkillCommand { } @Override - protected void dataCalculations(Player player, float skillValue) { + protected void dataCalculations(Player player, double skillValue) { // BLAST MINING if (canBlast || canDemoExpert || canBiggerBombs) { MiningManager miningManager = UserManager.getPlayer(player).getMiningManager(); @@ -76,7 +76,7 @@ public class MiningCommand extends SkillCommand { } @Override - protected List statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) { + protected List statsDisplay(Player player, double skillValue, boolean hasEndurance, boolean isLucky) { List messages = new ArrayList<>(); if (canBiggerBombs) { diff --git a/src/main/java/com/gmail/nossr50/commands/skills/RepairCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/RepairCommand.java index cd860ec76..83dbbd015 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/RepairCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/RepairCommand.java @@ -46,7 +46,7 @@ public class RepairCommand extends SkillCommand { } @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 Repairable diamondRepairable = mcMMO.getRepairableManager().getRepairable(Material.DIAMOND_PICKAXE); Repairable goldRepairable = mcMMO.getRepairableManager().getRepairable(Material.GOLDEN_PICKAXE); @@ -88,7 +88,7 @@ public class RepairCommand extends SkillCommand { } @Override - protected List statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) { + protected List statsDisplay(Player player, double skillValue, boolean hasEndurance, boolean isLucky) { List messages = new ArrayList<>(); if (canArcaneForge) { diff --git a/src/main/java/com/gmail/nossr50/commands/skills/SalvageCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/SalvageCommand.java index 0c248a5f1..cd4ffec81 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/SalvageCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/SalvageCommand.java @@ -23,7 +23,7 @@ public class SalvageCommand extends SkillCommand { } @Override - protected void dataCalculations(Player player, float skillValue) { + protected void dataCalculations(Player player, double skillValue) { // TODO Auto-generated method stub } @@ -35,7 +35,7 @@ public class SalvageCommand extends SkillCommand { } @Override - protected List statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) { + protected List statsDisplay(Player player, double skillValue, boolean hasEndurance, boolean isLucky) { List messages = new ArrayList<>(); SalvageManager salvageManager = UserManager.getPlayer(player).getSalvageManager(); diff --git a/src/main/java/com/gmail/nossr50/commands/skills/SkillCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/SkillCommand.java index 636a48307..3c7160d36 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/SkillCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/SkillCommand.java @@ -76,7 +76,7 @@ public abstract class SkillCommand implements TabExecutor { boolean isLucky = Permissions.lucky(player, skill); 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 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 statsMessages = statsDisplay(player, skillValue, hasEndurance, isLucky); 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; } @@ -232,7 +232,7 @@ public abstract class SkillCommand implements TabExecutor { 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 abilityLengthVar = AdvancedConfig.getInstance().getAbilityLength(); 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 List effectsDisplay(); - protected abstract List statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky); + protected abstract List statsDisplay(Player player, double skillValue, boolean hasEndurance, boolean isLucky); protected abstract List getTextComponents(Player player); diff --git a/src/main/java/com/gmail/nossr50/commands/skills/SmeltingCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/SmeltingCommand.java index de9742ea2..4cafc214f 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/SmeltingCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/SmeltingCommand.java @@ -30,7 +30,7 @@ public class SmeltingCommand extends SkillCommand { } @Override - protected void dataCalculations(Player player, float skillValue) { + protected void dataCalculations(Player player, double skillValue) { // FUEL EFFICIENCY if (canFuelEfficiency) { burnTimeModifier = String.valueOf(UserManager.getPlayer(player).getSmeltingManager().getFuelEfficiencyMultiplier()); @@ -60,7 +60,7 @@ public class SmeltingCommand extends SkillCommand { } @Override - protected List statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) { + protected List statsDisplay(Player player, double skillValue, boolean hasEndurance, boolean isLucky) { List messages = new ArrayList<>(); /*if (canFluxMine) { diff --git a/src/main/java/com/gmail/nossr50/commands/skills/SwordsCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/SwordsCommand.java index 813ce4e31..eb9bc3725 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/SwordsCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/SwordsCommand.java @@ -33,7 +33,7 @@ public class SwordsCommand extends SkillCommand { } @Override - protected void dataCalculations(Player player, float skillValue) { + protected void dataCalculations(Player player, double skillValue) { // SWORDS_COUNTER_ATTACK if (canCounter) { String[] counterStrings = getAbilityDisplayValues(player, SubSkillType.SWORDS_COUNTER_ATTACK); @@ -66,7 +66,7 @@ public class SwordsCommand extends SkillCommand { } @Override - protected List statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) { + protected List statsDisplay(Player player, double skillValue, boolean hasEndurance, boolean isLucky) { List messages = new ArrayList<>(); int ruptureTicks = UserManager.getPlayer(player).getSwordsManager().getRuptureBleedTicks(); diff --git a/src/main/java/com/gmail/nossr50/commands/skills/TamingCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/TamingCommand.java index 041b85076..24a074d38 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/TamingCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/TamingCommand.java @@ -32,7 +32,7 @@ public class TamingCommand extends SkillCommand { } @Override - protected void dataCalculations(Player player, float skillValue) { + protected void dataCalculations(Player player, double skillValue) { if (canGore) { String[] goreStrings = getAbilityDisplayValues(player, SubSkillType.TAMING_GORE); goreChance = goreStrings[0]; @@ -54,7 +54,7 @@ public class TamingCommand extends SkillCommand { } @Override - protected List statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) { + protected List statsDisplay(Player player, double skillValue, boolean hasEndurance, boolean isLucky) { List messages = new ArrayList<>(); if (canEnvironmentallyAware) { diff --git a/src/main/java/com/gmail/nossr50/commands/skills/UnarmedCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/UnarmedCommand.java index 9062e6a1b..a23f7e612 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/UnarmedCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/UnarmedCommand.java @@ -36,7 +36,7 @@ public class UnarmedCommand extends SkillCommand { } @Override - protected void dataCalculations(Player player, float skillValue) { + protected void dataCalculations(Player player, double skillValue) { // UNARMED_ARROW_DEFLECT if (canDeflect) { String[] deflectStrings = getAbilityDisplayValues(player, SubSkillType.UNARMED_ARROW_DEFLECT); @@ -82,7 +82,7 @@ public class UnarmedCommand extends SkillCommand { } @Override - protected List statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) { + protected List statsDisplay(Player player, double skillValue, boolean hasEndurance, boolean isLucky) { List messages = new ArrayList<>(); if (canDeflect) { diff --git a/src/main/java/com/gmail/nossr50/commands/skills/WoodcuttingCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/WoodcuttingCommand.java index c9d9478b6..82a8a463d 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/WoodcuttingCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/WoodcuttingCommand.java @@ -30,7 +30,7 @@ public class WoodcuttingCommand extends SkillCommand { } @Override - protected void dataCalculations(Player player, float skillValue) { + protected void dataCalculations(Player player, double skillValue) { // DOUBLE DROPS if (canDoubleDrop) { setDoubleDropClassicChanceStrings(player); @@ -61,7 +61,7 @@ public class WoodcuttingCommand extends SkillCommand { } @Override - protected List statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) { + protected List statsDisplay(Player player, double skillValue, boolean hasEndurance, boolean isLucky) { List messages = new ArrayList<>(); if (canDoubleDrop) { diff --git a/src/main/java/com/gmail/nossr50/config/hocon/antiexploit/ConfigExploitPrevention.java b/src/main/java/com/gmail/nossr50/config/hocon/antiexploit/ConfigExploitPrevention.java index b9ea85a0e..7db1fad08 100644 --- a/src/main/java/com/gmail/nossr50/config/hocon/antiexploit/ConfigExploitPrevention.java +++ b/src/main/java/com/gmail/nossr50/config/hocon/antiexploit/ConfigExploitPrevention.java @@ -56,7 +56,7 @@ public class ConfigExploitPrevention { return getConfigSectionExploitFishing().getFishingRodSpamMilliseconds(); } - public float getOverFishingAreaSize() { + public double getOverFishingAreaSize() { return getConfigSectionExploitFishing().getOverFishingAreaSize(); } diff --git a/src/main/java/com/gmail/nossr50/config/hocon/antiexploit/ConfigSectionExploitFishing.java b/src/main/java/com/gmail/nossr50/config/hocon/antiexploit/ConfigSectionExploitFishing.java index dec972172..53a82a69d 100644 --- a/src/main/java/com/gmail/nossr50/config/hocon/antiexploit/ConfigSectionExploitFishing.java +++ b/src/main/java/com/gmail/nossr50/config/hocon/antiexploit/ConfigSectionExploitFishing.java @@ -8,7 +8,7 @@ public class ConfigSectionExploitFishing { public static final int OVER_FISHING_LIMIT_DEFAULT = 10; 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; private static final boolean PREVENT_FISHING_EXPLOITS_DEFAULT = true; @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," + "\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) - 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." + "\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; } - public float getOverFishingAreaSize() { + public double getOverFishingAreaSize() { return overFishingAreaSize; } diff --git a/src/main/java/com/gmail/nossr50/config/hocon/antiexploit/ConfigSectionExploitSkills.java b/src/main/java/com/gmail/nossr50/config/hocon/antiexploit/ConfigSectionExploitSkills.java index 5a575324a..0e4069f3b 100644 --- a/src/main/java/com/gmail/nossr50/config/hocon/antiexploit/ConfigSectionExploitSkills.java +++ b/src/main/java/com/gmail/nossr50/config/hocon/antiexploit/ConfigSectionExploitSkills.java @@ -34,7 +34,7 @@ public class ConfigSectionExploitSkills { return configSectionExploitFishing.getFishingRodSpamMilliseconds(); } - public float getOverFishingAreaSize() { + public double getOverFishingAreaSize() { return configSectionExploitFishing.getOverFishingAreaSize(); } diff --git a/src/main/java/com/gmail/nossr50/config/hocon/experience/ConfigExperience.java b/src/main/java/com/gmail/nossr50/config/hocon/experience/ConfigExperience.java index 9266bea7d..2c56ee093 100644 --- a/src/main/java/com/gmail/nossr50/config/hocon/experience/ConfigExperience.java +++ b/src/main/java/com/gmail/nossr50/config/hocon/experience/ConfigExperience.java @@ -12,12 +12,12 @@ import java.util.HashMap; @ConfigSerializable 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" + "\nThis value is temporarily overridden by xprate events." + "\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.") private ConfigExperienceSkillMultiplier configExperienceSkillMultiplier = new ConfigExperienceSkillMultiplier(); @@ -104,11 +104,11 @@ public class ConfigExperience { return getConfigExperienceSkills().getSmeltingExperienceMap(); } - public float getItemMaterialXPMultiplier(ItemMaterialCategory itemMaterialCategory) { + public double getItemMaterialXPMultiplier(ItemMaterialCategory itemMaterialCategory) { return getConfigExperienceSkills().getItemMaterialXPMultiplier(itemMaterialCategory); } - public Float getRepairXPBase() { + public Double getRepairXPBase() { return getConfigExperienceSkills().getRepairXPBase(); } @@ -116,7 +116,7 @@ public class ConfigExperience { return getConfigExperienceSkills().getAcrobaticsXPMap(); } - public Float getFeatherFallMultiplier() { + public Double getFeatherFallMultiplier() { return getConfigExperienceSkills().getFeatherFallMultiplier(); } @@ -160,15 +160,15 @@ public class ConfigExperience { return getConfigExperienceSkills().isPvpXPEnabled(); } - public HashMap getCombatExperienceMap() { + public HashMap getCombatExperienceMap() { return getConfigExperienceSkills().getCombatExperienceMap(); } - public HashMap getSpecialCombatExperienceMap() { + public HashMap getSpecialCombatExperienceMap() { return configExperienceSkills.getSpecialCombatExperienceMap(); } - public Float getDistanceMultiplier() { + public double getDistanceMultiplier() { return getConfigExperienceSkills().getDistanceMultiplier(); } @@ -196,7 +196,7 @@ public class ConfigExperience { return configExperienceSkills; } - public Float getGlobalXPMultiplier() { + public double getGlobalXPMultiplier() { return globalXPMultiplier; } } \ No newline at end of file diff --git a/src/main/java/com/gmail/nossr50/config/hocon/experience/ConfigExperienceAcrobatics.java b/src/main/java/com/gmail/nossr50/config/hocon/experience/ConfigExperienceAcrobatics.java index e907e710d..a3acc1c29 100644 --- a/src/main/java/com/gmail/nossr50/config/hocon/experience/ConfigExperienceAcrobatics.java +++ b/src/main/java/com/gmail/nossr50/config/hocon/experience/ConfigExperienceAcrobatics.java @@ -9,7 +9,7 @@ import java.util.HashMap; public class ConfigExperienceAcrobatics { private final static HashMap 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 { 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." + "\nThis value is multiplied against your XP to give the bonus." + "\nDefault value: " + FEATHER_FALL_MULTIPLIER_DEFAULT) - private Float featherFallMultiplier = FEATHER_FALL_MULTIPLIER_DEFAULT; + private Double featherFallMultiplier = FEATHER_FALL_MULTIPLIER_DEFAULT; public HashMap getAcrobaticsXPMap() { return acrobaticsXPMap; } - public Float getFeatherFallMultiplier() { + public Double getFeatherFallMultiplier() { return featherFallMultiplier; } diff --git a/src/main/java/com/gmail/nossr50/config/hocon/experience/ConfigExperienceArchery.java b/src/main/java/com/gmail/nossr50/config/hocon/experience/ConfigExperienceArchery.java index 74ec35767..7f36d14cd 100644 --- a/src/main/java/com/gmail/nossr50/config/hocon/experience/ConfigExperienceArchery.java +++ b/src/main/java/com/gmail/nossr50/config/hocon/experience/ConfigExperienceArchery.java @@ -6,7 +6,7 @@ import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; @ConfigSerializable 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 " + "arrow travels before hitting its target to determine final XP values awarded." + @@ -14,9 +14,9 @@ public class ConfigExperienceArchery { "\nDistance is in blocks traveled." + "\nThis value is added on to normal XP gains from damage for Archery." + "\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; } } \ No newline at end of file diff --git a/src/main/java/com/gmail/nossr50/config/hocon/experience/ConfigExperienceCombat.java b/src/main/java/com/gmail/nossr50/config/hocon/experience/ConfigExperienceCombat.java index 3de823f09..8111c1e62 100644 --- a/src/main/java/com/gmail/nossr50/config/hocon/experience/ConfigExperienceCombat.java +++ b/src/main/java/com/gmail/nossr50/config/hocon/experience/ConfigExperienceCombat.java @@ -9,82 +9,82 @@ import java.util.HashMap; @ConfigSerializable public class ConfigExperienceCombat { - private static final HashMap COMBAT_EXPERIENCE_DEFAULT; - private static final HashMap SPECIAL_COMBAT_EXPERIENCE_DEFAULT; + private static final HashMap COMBAT_EXPERIENCE_DEFAULT; + private static final HashMap SPECIAL_COMBAT_EXPERIENCE_DEFAULT; private static final boolean PVP_XP_ENABLED_DEFAULT = false; static { COMBAT_EXPERIENCE_DEFAULT = new HashMap<>(); - COMBAT_EXPERIENCE_DEFAULT.put("creeper", 4.0F); - COMBAT_EXPERIENCE_DEFAULT.put("cat", 1.0F); - COMBAT_EXPERIENCE_DEFAULT.put("fox", 1.0F); - COMBAT_EXPERIENCE_DEFAULT.put("panda", 1.0F); - COMBAT_EXPERIENCE_DEFAULT.put("pillager", 2.0F); - COMBAT_EXPERIENCE_DEFAULT.put("ravager", 4.0F); - COMBAT_EXPERIENCE_DEFAULT.put("trader_llama", 1.0F); - COMBAT_EXPERIENCE_DEFAULT.put("skeleton", 3.0F); - COMBAT_EXPERIENCE_DEFAULT.put("spider", 2.0F); - COMBAT_EXPERIENCE_DEFAULT.put("giant", 4.0F); - COMBAT_EXPERIENCE_DEFAULT.put("zombie", 2.0F); - COMBAT_EXPERIENCE_DEFAULT.put("slime", 2.0F); - COMBAT_EXPERIENCE_DEFAULT.put("ghast", 3.0F); - COMBAT_EXPERIENCE_DEFAULT.put("pig_zombie", 3.0F); - COMBAT_EXPERIENCE_DEFAULT.put("enderman", 1.0F); - COMBAT_EXPERIENCE_DEFAULT.put("cave_spider", 3.0F); - COMBAT_EXPERIENCE_DEFAULT.put("silverfish", 3.0F); - COMBAT_EXPERIENCE_DEFAULT.put("blaze", 3.0F); - COMBAT_EXPERIENCE_DEFAULT.put("magma_cube", 2.0F); - COMBAT_EXPERIENCE_DEFAULT.put("ender_dragon", 1.0F); - COMBAT_EXPERIENCE_DEFAULT.put("wither", 1.0F); - COMBAT_EXPERIENCE_DEFAULT.put("witch", 0.1F); - COMBAT_EXPERIENCE_DEFAULT.put("iron_golem", 2.0F); - COMBAT_EXPERIENCE_DEFAULT.put("wither_skeleton", 4.0F); - COMBAT_EXPERIENCE_DEFAULT.put("endermite", 2.0F); - COMBAT_EXPERIENCE_DEFAULT.put("guardian", 1.0F); - COMBAT_EXPERIENCE_DEFAULT.put("elder_guardian", 4.0F); - COMBAT_EXPERIENCE_DEFAULT.put("shulker", 2.0F); - COMBAT_EXPERIENCE_DEFAULT.put("donkey", 1.0F); - COMBAT_EXPERIENCE_DEFAULT.put("mule", 1.0F); - COMBAT_EXPERIENCE_DEFAULT.put("horse", 1.0F); - COMBAT_EXPERIENCE_DEFAULT.put("zombie_villager", 2.0F); - COMBAT_EXPERIENCE_DEFAULT.put("skeleton_horse", 1.0F); - COMBAT_EXPERIENCE_DEFAULT.put("zombie_horse", 1.2F); - COMBAT_EXPERIENCE_DEFAULT.put("husk", 3.0F); - COMBAT_EXPERIENCE_DEFAULT.put("evoker", 3.0F); - COMBAT_EXPERIENCE_DEFAULT.put("polar_bear", 2.0F); - COMBAT_EXPERIENCE_DEFAULT.put("llama", 1.0F); - COMBAT_EXPERIENCE_DEFAULT.put("vindicator", 3.0F); - COMBAT_EXPERIENCE_DEFAULT.put("stray", 2.0F); - COMBAT_EXPERIENCE_DEFAULT.put("rabbit", 1.0F); - COMBAT_EXPERIENCE_DEFAULT.put("chicken", 1.0F); - COMBAT_EXPERIENCE_DEFAULT.put("bat", 1.0F); - COMBAT_EXPERIENCE_DEFAULT.put("mushroom_cow", 1.2F); - COMBAT_EXPERIENCE_DEFAULT.put("cow", 1.0F); - COMBAT_EXPERIENCE_DEFAULT.put("turtle", 1.0F); - COMBAT_EXPERIENCE_DEFAULT.put("sheep", 1.0F); - COMBAT_EXPERIENCE_DEFAULT.put("pig", 1.0F); - COMBAT_EXPERIENCE_DEFAULT.put("squid", 1.0F); - COMBAT_EXPERIENCE_DEFAULT.put("ocelot", 1.0F); - COMBAT_EXPERIENCE_DEFAULT.put("villager", 1.0F); - COMBAT_EXPERIENCE_DEFAULT.put("snowman", 0.0F); - COMBAT_EXPERIENCE_DEFAULT.put("parrot", 1.0F); - COMBAT_EXPERIENCE_DEFAULT.put("illusioner", 1.0F); - COMBAT_EXPERIENCE_DEFAULT.put("drowned", 1.0F); - COMBAT_EXPERIENCE_DEFAULT.put("dolphin", 1.0F); - COMBAT_EXPERIENCE_DEFAULT.put("phantom", 4.0F); - COMBAT_EXPERIENCE_DEFAULT.put("wandering_trader", 1.0F); + COMBAT_EXPERIENCE_DEFAULT.put("creeper", 4.0); + COMBAT_EXPERIENCE_DEFAULT.put("cat", 1.0); + COMBAT_EXPERIENCE_DEFAULT.put("fox", 1.0); + COMBAT_EXPERIENCE_DEFAULT.put("panda", 1.0); + COMBAT_EXPERIENCE_DEFAULT.put("pillager", 2.0); + COMBAT_EXPERIENCE_DEFAULT.put("ravager", 4.0); + COMBAT_EXPERIENCE_DEFAULT.put("trader_llama", 1.0); + COMBAT_EXPERIENCE_DEFAULT.put("skeleton", 3.0); + COMBAT_EXPERIENCE_DEFAULT.put("spider", 2.0); + COMBAT_EXPERIENCE_DEFAULT.put("giant", 4.0); + COMBAT_EXPERIENCE_DEFAULT.put("zombie", 2.0); + COMBAT_EXPERIENCE_DEFAULT.put("slime", 2.0); + COMBAT_EXPERIENCE_DEFAULT.put("ghast", 3.0); + COMBAT_EXPERIENCE_DEFAULT.put("pig_zombie", 3.0); + COMBAT_EXPERIENCE_DEFAULT.put("enderman", 1.0); + COMBAT_EXPERIENCE_DEFAULT.put("cave_spider", 3.0); + COMBAT_EXPERIENCE_DEFAULT.put("silverfish", 3.0); + COMBAT_EXPERIENCE_DEFAULT.put("blaze", 3.0); + COMBAT_EXPERIENCE_DEFAULT.put("magma_cube", 2.0); + COMBAT_EXPERIENCE_DEFAULT.put("ender_dragon", 1.0); + COMBAT_EXPERIENCE_DEFAULT.put("wither", 1.0); + COMBAT_EXPERIENCE_DEFAULT.put("witch", 0.1); + COMBAT_EXPERIENCE_DEFAULT.put("iron_golem", 2.0); + COMBAT_EXPERIENCE_DEFAULT.put("wither_skeleton", 4.0); + COMBAT_EXPERIENCE_DEFAULT.put("endermite", 2.0); + COMBAT_EXPERIENCE_DEFAULT.put("guardian", 1.0); + COMBAT_EXPERIENCE_DEFAULT.put("elder_guardian", 4.0); + COMBAT_EXPERIENCE_DEFAULT.put("shulker", 2.0); + COMBAT_EXPERIENCE_DEFAULT.put("donkey", 1.0); + COMBAT_EXPERIENCE_DEFAULT.put("mule", 1.0); + COMBAT_EXPERIENCE_DEFAULT.put("horse", 1.0); + COMBAT_EXPERIENCE_DEFAULT.put("zombie_villager", 2.0); + COMBAT_EXPERIENCE_DEFAULT.put("skeleton_horse", 1.0); + COMBAT_EXPERIENCE_DEFAULT.put("zombie_horse", 1.2); + COMBAT_EXPERIENCE_DEFAULT.put("husk", 3.0); + COMBAT_EXPERIENCE_DEFAULT.put("evoker", 3.0); + COMBAT_EXPERIENCE_DEFAULT.put("polar_bear", 2.0); + COMBAT_EXPERIENCE_DEFAULT.put("llama", 1.0); + COMBAT_EXPERIENCE_DEFAULT.put("vindicator", 3.0); + COMBAT_EXPERIENCE_DEFAULT.put("stray", 2.0); + COMBAT_EXPERIENCE_DEFAULT.put("rabbit", 1.0); + COMBAT_EXPERIENCE_DEFAULT.put("chicken", 1.0); + COMBAT_EXPERIENCE_DEFAULT.put("bat", 1.0); + COMBAT_EXPERIENCE_DEFAULT.put("mushroom_cow", 1.2); + COMBAT_EXPERIENCE_DEFAULT.put("cow", 1.0); + COMBAT_EXPERIENCE_DEFAULT.put("turtle", 1.0); + COMBAT_EXPERIENCE_DEFAULT.put("sheep", 1.0); + COMBAT_EXPERIENCE_DEFAULT.put("pig", 1.0); + COMBAT_EXPERIENCE_DEFAULT.put("squid", 1.0); + COMBAT_EXPERIENCE_DEFAULT.put("ocelot", 1.0); + COMBAT_EXPERIENCE_DEFAULT.put("villager", 1.0); + COMBAT_EXPERIENCE_DEFAULT.put("snowman", 0.0); + COMBAT_EXPERIENCE_DEFAULT.put("parrot", 1.0); + COMBAT_EXPERIENCE_DEFAULT.put("illusioner", 1.0); + COMBAT_EXPERIENCE_DEFAULT.put("drowned", 1.0); + COMBAT_EXPERIENCE_DEFAULT.put("dolphin", 1.0); + COMBAT_EXPERIENCE_DEFAULT.put("phantom", 4.0); + COMBAT_EXPERIENCE_DEFAULT.put("wandering_trader", 1.0); //SPECIAL 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.SPAWNED, 0.0F); - SPECIAL_COMBAT_EXPERIENCE_DEFAULT.put(SpecialXPKey.PVP, 1.0F); - SPECIAL_COMBAT_EXPERIENCE_DEFAULT.put(SpecialXPKey.PETS, 1.0F); + 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.0); + SPECIAL_COMBAT_EXPERIENCE_DEFAULT.put(SpecialXPKey.PVP, 1.0); + SPECIAL_COMBAT_EXPERIENCE_DEFAULT.put(SpecialXPKey.PETS, 1.0); } @Setting(value = "Combat-XP-Multipliers") - private HashMap combatExperienceMap = COMBAT_EXPERIENCE_DEFAULT; + private HashMap combatExperienceMap = COMBAT_EXPERIENCE_DEFAULT; @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" + @@ -93,7 +93,7 @@ public class ConfigExperienceCombat { "\nPets - Either tamed or from breeding" + "\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") - private HashMap specialCombatExperienceMap = SPECIAL_COMBAT_EXPERIENCE_DEFAULT; + private HashMap specialCombatExperienceMap = SPECIAL_COMBAT_EXPERIENCE_DEFAULT; @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." + @@ -104,11 +104,11 @@ public class ConfigExperienceCombat { return pvpXPEnabled; } - public HashMap getCombatExperienceMap() { + public HashMap getCombatExperienceMap() { return combatExperienceMap; } - public HashMap getSpecialCombatExperienceMap() { + public HashMap getSpecialCombatExperienceMap() { return specialCombatExperienceMap; } } \ No newline at end of file diff --git a/src/main/java/com/gmail/nossr50/config/hocon/experience/ConfigExperienceCustomBoosts.java b/src/main/java/com/gmail/nossr50/config/hocon/experience/ConfigExperienceCustomBoosts.java index 6f1eab2cc..9496cdfb7 100644 --- a/src/main/java/com/gmail/nossr50/config/hocon/experience/ConfigExperienceCustomBoosts.java +++ b/src/main/java/com/gmail/nossr50/config/hocon/experience/ConfigExperienceCustomBoosts.java @@ -14,10 +14,18 @@ public class ConfigExperienceCustomBoosts { static { CUSTOM_BOOST_SET_DEFAULT = new ArrayList<>(); - CustomXPPerk customXPPerk = new CustomXPPerk("examplecustomxpperk"); - customXPPerk.setCustomXPValue(PrimarySkillType.MINING, 13.37f); - customXPPerk.setCustomXPValue(PrimarySkillType.WOODCUTTING, 4.0f); - CUSTOM_BOOST_SET_DEFAULT.add(customXPPerk); + + CustomXPPerk exampleA = new CustomXPPerk("example-beneficial-xpperk"); + exampleA.setCustomXPValue(PrimarySkillType.MINING, 13.37); + 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.' to your players" + diff --git a/src/main/java/com/gmail/nossr50/config/hocon/experience/ConfigExperienceRepair.java b/src/main/java/com/gmail/nossr50/config/hocon/experience/ConfigExperienceRepair.java index ec822f658..d240da107 100644 --- a/src/main/java/com/gmail/nossr50/config/hocon/experience/ConfigExperienceRepair.java +++ b/src/main/java/com/gmail/nossr50/config/hocon/experience/ConfigExperienceRepair.java @@ -9,26 +9,26 @@ import java.util.HashMap; @ConfigSerializable 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 ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT; + private static final HashMap ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT; static { ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT = new HashMap<>(); - ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT.put(ItemMaterialCategory.WOOD, 0.6F); - ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT.put(ItemMaterialCategory.STONE, 1.3F); - ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT.put(ItemMaterialCategory.IRON, 2.5F); - ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT.put(ItemMaterialCategory.GOLD, 0.3F); - ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT.put(ItemMaterialCategory.DIAMOND, 5.0F); - ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT.put(ItemMaterialCategory.LEATHER, 1.6F); - ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT.put(ItemMaterialCategory.STRING, 1.8F); - ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT.put(ItemMaterialCategory.OTHER, 1.5F); + ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT.put(ItemMaterialCategory.WOOD, 0.6); + ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT.put(ItemMaterialCategory.STONE, 1.3); + ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT.put(ItemMaterialCategory.IRON, 2.5); + ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT.put(ItemMaterialCategory.GOLD, 0.3); + ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT.put(ItemMaterialCategory.DIAMOND, 5.0); + ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT.put(ItemMaterialCategory.LEATHER, 1.6); + ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT.put(ItemMaterialCategory.STRING, 1.8); + 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, " + "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.") - private HashMap itemMaterialXPMultiplier = ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT; + private HashMap itemMaterialXPMultiplier = ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT; @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" + @@ -37,13 +37,13 @@ public class ConfigExperienceRepair { "\nThe Base Repair XP defined here (default 1000.0)" + "\nAnd finally, the XP multiplier of the item material category defined in this config." + "\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); } - public Float getRepairXPBase() { + public Double getRepairXPBase() { return repairXPBase; } } \ No newline at end of file diff --git a/src/main/java/com/gmail/nossr50/config/hocon/experience/ConfigExperienceSkillMultiplier.java b/src/main/java/com/gmail/nossr50/config/hocon/experience/ConfigExperienceSkillMultiplier.java index b7066e90f..904b08c02 100644 --- a/src/main/java/com/gmail/nossr50/config/hocon/experience/ConfigExperienceSkillMultiplier.java +++ b/src/main/java/com/gmail/nossr50/config/hocon/experience/ConfigExperienceSkillMultiplier.java @@ -11,27 +11,27 @@ import static com.gmail.nossr50.datatypes.skills.PrimarySkillType.*; @ConfigSerializable public class ConfigExperienceSkillMultiplier { - private static final HashMap SKILL_GLOBAL_MULT_DEFAULT; + private static final HashMap SKILL_GLOBAL_MULT_DEFAULT; static { SKILL_GLOBAL_MULT_DEFAULT = new HashMap<>(); - SKILL_GLOBAL_MULT_DEFAULT.put(ACROBATICS, 1.0f); - SKILL_GLOBAL_MULT_DEFAULT.put(ALCHEMY, 1.0f); - SKILL_GLOBAL_MULT_DEFAULT.put(ARCHERY, 1.0f); - SKILL_GLOBAL_MULT_DEFAULT.put(AXES, 1.0f); - SKILL_GLOBAL_MULT_DEFAULT.put(EXCAVATION, 1.0f); - SKILL_GLOBAL_MULT_DEFAULT.put(FISHING, 1.0f); - SKILL_GLOBAL_MULT_DEFAULT.put(HERBALISM, 1.0f); - SKILL_GLOBAL_MULT_DEFAULT.put(MINING, 1.0f); - SKILL_GLOBAL_MULT_DEFAULT.put(REPAIR, 1.0f); - SKILL_GLOBAL_MULT_DEFAULT.put(SWORDS, 1.0f); - SKILL_GLOBAL_MULT_DEFAULT.put(TAMING, 1.0f); - SKILL_GLOBAL_MULT_DEFAULT.put(UNARMED, 1.0f); - SKILL_GLOBAL_MULT_DEFAULT.put(WOODCUTTING, 1.0f); + SKILL_GLOBAL_MULT_DEFAULT.put(ACROBATICS, 1.0); + SKILL_GLOBAL_MULT_DEFAULT.put(ALCHEMY, 1.0); + SKILL_GLOBAL_MULT_DEFAULT.put(ARCHERY, 1.0); + SKILL_GLOBAL_MULT_DEFAULT.put(AXES, 1.0); + SKILL_GLOBAL_MULT_DEFAULT.put(EXCAVATION, 1.0); + SKILL_GLOBAL_MULT_DEFAULT.put(FISHING, 1.0); + SKILL_GLOBAL_MULT_DEFAULT.put(HERBALISM, 1.0); + SKILL_GLOBAL_MULT_DEFAULT.put(MINING, 1.0); + SKILL_GLOBAL_MULT_DEFAULT.put(REPAIR, 1.0); + SKILL_GLOBAL_MULT_DEFAULT.put(SWORDS, 1.0); + SKILL_GLOBAL_MULT_DEFAULT.put(TAMING, 1.0); + SKILL_GLOBAL_MULT_DEFAULT.put(UNARMED, 1.0); + SKILL_GLOBAL_MULT_DEFAULT.put(WOODCUTTING, 1.0); } @Setting(value = "Skill-XP-Multipliers") - private HashMap perSkillGlobalMultiplier = SKILL_GLOBAL_MULT_DEFAULT; + private HashMap perSkillGlobalMultiplier = SKILL_GLOBAL_MULT_DEFAULT; public double getSkillGlobalMultiplier(PrimarySkillType primarySkillType) { return perSkillGlobalMultiplier.get(primarySkillType); diff --git a/src/main/java/com/gmail/nossr50/config/hocon/experience/ConfigExperienceSkills.java b/src/main/java/com/gmail/nossr50/config/hocon/experience/ConfigExperienceSkills.java index 10b46c405..7182d9c7c 100644 --- a/src/main/java/com/gmail/nossr50/config/hocon/experience/ConfigExperienceSkills.java +++ b/src/main/java/com/gmail/nossr50/config/hocon/experience/ConfigExperienceSkills.java @@ -109,11 +109,11 @@ public class ConfigExperienceSkills { return experienceSmelting.getSmeltingExperienceMap(); } - public float getItemMaterialXPMultiplier(ItemMaterialCategory itemMaterialCategory) { + public double getItemMaterialXPMultiplier(ItemMaterialCategory itemMaterialCategory) { return experienceRepair.getItemMaterialXPMultiplier(itemMaterialCategory); } - public float getRepairXPBase() { + public double getRepairXPBase() { return experienceRepair.getRepairXPBase(); } @@ -121,7 +121,7 @@ public class ConfigExperienceSkills { return experienceAcrobatics.getAcrobaticsXPMap(); } - public float getFeatherFallMultiplier() { + public double getFeatherFallMultiplier() { return experienceAcrobatics.getFeatherFallMultiplier(); } @@ -165,15 +165,15 @@ public class ConfigExperienceSkills { return experienceCombat.isPvpXPEnabled(); } - public HashMap getCombatExperienceMap() { + public HashMap getCombatExperienceMap() { return experienceCombat.getCombatExperienceMap(); } - public HashMap getSpecialCombatExperienceMap() { + public HashMap getSpecialCombatExperienceMap() { return experienceCombat.getSpecialCombatExperienceMap(); } - public float getDistanceMultiplier() { + public double getDistanceMultiplier() { return experienceArchery.getDistanceMultiplier(); } diff --git a/src/main/java/com/gmail/nossr50/config/hocon/playerleveling/ConfigExperienceFormula.java b/src/main/java/com/gmail/nossr50/config/hocon/playerleveling/ConfigExperienceFormula.java index 4ccec1ba3..7f9555678 100644 --- a/src/main/java/com/gmail/nossr50/config/hocon/playerleveling/ConfigExperienceFormula.java +++ b/src/main/java/com/gmail/nossr50/config/hocon/playerleveling/ConfigExperienceFormula.java @@ -11,24 +11,24 @@ import java.util.HashMap; public class ConfigExperienceFormula { private static final boolean CUMULATIVE_CURVE_DEFAULT = false; - private static final HashMap SKILL_FORMULA_MODIFIER_DEFAULT; + private static final HashMap SKILL_FORMULA_MODIFIER_DEFAULT; static { SKILL_FORMULA_MODIFIER_DEFAULT = new HashMap<>(); //TODO: This code is causing compiler issues - SKILL_FORMULA_MODIFIER_DEFAULT.put(PrimarySkillType.ACROBATICS, 1.0f); - SKILL_FORMULA_MODIFIER_DEFAULT.put(PrimarySkillType.ALCHEMY, 1.0f); - SKILL_FORMULA_MODIFIER_DEFAULT.put(PrimarySkillType.AXES, 1.0f); - SKILL_FORMULA_MODIFIER_DEFAULT.put(PrimarySkillType.ARCHERY, 1.0f); - SKILL_FORMULA_MODIFIER_DEFAULT.put(PrimarySkillType.EXCAVATION, 1.0f); - SKILL_FORMULA_MODIFIER_DEFAULT.put(PrimarySkillType.FISHING, 1.0f); - SKILL_FORMULA_MODIFIER_DEFAULT.put(PrimarySkillType.HERBALISM, 1.0f); - SKILL_FORMULA_MODIFIER_DEFAULT.put(PrimarySkillType.MINING, 1.0f); - SKILL_FORMULA_MODIFIER_DEFAULT.put(PrimarySkillType.REPAIR, 1.0f); - SKILL_FORMULA_MODIFIER_DEFAULT.put(PrimarySkillType.SWORDS, 1.0f); - SKILL_FORMULA_MODIFIER_DEFAULT.put(PrimarySkillType.TAMING, 1.0f); - SKILL_FORMULA_MODIFIER_DEFAULT.put(PrimarySkillType.UNARMED, 1.0f); - SKILL_FORMULA_MODIFIER_DEFAULT.put(PrimarySkillType.WOODCUTTING, 1.0f); + SKILL_FORMULA_MODIFIER_DEFAULT.put(PrimarySkillType.ACROBATICS, 1.0); + SKILL_FORMULA_MODIFIER_DEFAULT.put(PrimarySkillType.ALCHEMY, 1.0); + SKILL_FORMULA_MODIFIER_DEFAULT.put(PrimarySkillType.AXES, 1.0); + SKILL_FORMULA_MODIFIER_DEFAULT.put(PrimarySkillType.ARCHERY, 1.0); + SKILL_FORMULA_MODIFIER_DEFAULT.put(PrimarySkillType.EXCAVATION, 1.0); + SKILL_FORMULA_MODIFIER_DEFAULT.put(PrimarySkillType.FISHING, 1.0); + SKILL_FORMULA_MODIFIER_DEFAULT.put(PrimarySkillType.HERBALISM, 1.0); + SKILL_FORMULA_MODIFIER_DEFAULT.put(PrimarySkillType.MINING, 1.0); + SKILL_FORMULA_MODIFIER_DEFAULT.put(PrimarySkillType.REPAIR, 1.0); + SKILL_FORMULA_MODIFIER_DEFAULT.put(PrimarySkillType.SWORDS, 1.0); + SKILL_FORMULA_MODIFIER_DEFAULT.put(PrimarySkillType.TAMING, 1.0); + SKILL_FORMULA_MODIFIER_DEFAULT.put(PrimarySkillType.UNARMED, 1.0); + 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" + @@ -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" + "\nHigher values will make skills take longer to level, lower values will decrease time to level instead.") - private HashMap skillXpModifier = SKILL_FORMULA_MODIFIER_DEFAULT; + private HashMap skillXpModifier = SKILL_FORMULA_MODIFIER_DEFAULT; public FormulaType getFormulaType() { return formulaType; } - public float getSkillXpFormulaModifier(PrimarySkillType primarySkillType) { + public double getSkillXpFormulaModifier(PrimarySkillType primarySkillType) { return skillXpModifier.get(primarySkillType); } @@ -72,7 +72,7 @@ public class ConfigExperienceFormula { return configExperienceFormulaExponential; } - public float getMultiplier(FormulaType formulaType) { + public double getMultiplier(FormulaType formulaType) { switch (formulaType) { case LINEAR: return getLinearMultiplier(); @@ -98,11 +98,11 @@ public class ConfigExperienceFormula { return configExperienceFormulaExponential.getExponentialBaseModifier(); } - public float getExponentialMultiplier() { + public double getExponentialMultiplier() { return configExperienceFormulaExponential.getExponentialMultiplier(); } - public float getExponentialExponent() { + public double getExponentialExponent() { return configExperienceFormulaExponential.getExponentialExponent(); } @@ -110,7 +110,7 @@ public class ConfigExperienceFormula { return configExperienceFormulaLinear.getLinearBaseModifier(); } - public float getLinearMultiplier() { + public double getLinearMultiplier() { return configExperienceFormulaLinear.getLinearMultiplier(); } } \ No newline at end of file diff --git a/src/main/java/com/gmail/nossr50/config/hocon/playerleveling/ConfigExperienceFormulaExponential.java b/src/main/java/com/gmail/nossr50/config/hocon/playerleveling/ConfigExperienceFormulaExponential.java index be721bc1d..ca256784e 100644 --- a/src/main/java/com/gmail/nossr50/config/hocon/playerleveling/ConfigExperienceFormulaExponential.java +++ b/src/main/java/com/gmail/nossr50/config/hocon/playerleveling/ConfigExperienceFormulaExponential.java @@ -7,27 +7,27 @@ import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; public class ConfigExperienceFormulaExponential { private static final int BASE_DEFAULT = 2000; - private static final float MULTIPLIER_DEFAULT = 0.1f; - private static final float EXPONENT_DEFAULT = 1.80f; + private static final double MULTIPLIER_DEFAULT = 0.1f; + private static final double EXPONENT_DEFAULT = 1.80f; @Setting(value = "Base-Amount", comment = "Default value: " + BASE_DEFAULT) private int baseModifier = BASE_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) - private float exponent = EXPONENT_DEFAULT; + private double exponent = EXPONENT_DEFAULT; public int getExponentialBaseModifier() { return baseModifier; } - public float getExponentialMultiplier() { + public double getExponentialMultiplier() { return multiplier; } - public float getExponentialExponent() { + public double getExponentialExponent() { return exponent; } } \ No newline at end of file diff --git a/src/main/java/com/gmail/nossr50/config/hocon/playerleveling/ConfigExperienceFormulaLinear.java b/src/main/java/com/gmail/nossr50/config/hocon/playerleveling/ConfigExperienceFormulaLinear.java index 944c8a59c..2bcabb9a7 100644 --- a/src/main/java/com/gmail/nossr50/config/hocon/playerleveling/ConfigExperienceFormulaLinear.java +++ b/src/main/java/com/gmail/nossr50/config/hocon/playerleveling/ConfigExperienceFormulaLinear.java @@ -7,19 +7,19 @@ import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; public class ConfigExperienceFormulaLinear { 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) private int baseModifier = BASE_DEFAULT; @Setting(value = "Multiplier", comment = "Default value: " + MULTIPLIER_DEFAULT) - private float multiplier = MULTIPLIER_DEFAULT; + private double multiplier = MULTIPLIER_DEFAULT; public int getLinearBaseModifier() { return baseModifier; } - public float getLinearMultiplier() { + public double getLinearMultiplier() { return multiplier; } diff --git a/src/main/java/com/gmail/nossr50/config/hocon/playerleveling/ConfigLeveling.java b/src/main/java/com/gmail/nossr50/config/hocon/playerleveling/ConfigLeveling.java index 18da9c78c..5534eaeb5 100644 --- a/src/main/java/com/gmail/nossr50/config/hocon/playerleveling/ConfigLeveling.java +++ b/src/main/java/com/gmail/nossr50/config/hocon/playerleveling/ConfigLeveling.java @@ -86,7 +86,7 @@ public class ConfigLeveling { return configExperienceBars; } - public float getGuaranteedMinimums() { + public double getGuaranteedMinimums() { return configLevelingDiminishedReturns.getGuaranteedMinimums(); } diff --git a/src/main/java/com/gmail/nossr50/config/hocon/serializers/CustomXPPerkSerializer.java b/src/main/java/com/gmail/nossr50/config/hocon/serializers/CustomXPPerkSerializer.java index 60dd3b473..71d195f64 100644 --- a/src/main/java/com/gmail/nossr50/config/hocon/serializers/CustomXPPerkSerializer.java +++ b/src/main/java/com/gmail/nossr50/config/hocon/serializers/CustomXPPerkSerializer.java @@ -25,8 +25,8 @@ public class CustomXPPerkSerializer implements TypeSerializer { public CustomXPPerk deserialize(@NonNull TypeToken type, @NonNull ConfigurationNode value) throws ObjectMappingException { String perkName = value.getNode(PERK_NAME).getValue(TypeToken.of(String.class)); - Map map = value.getNode(XP_BOOST_NODE_ROOT).getValue(new TypeToken>(){}); - HashMap xpBoostHashMap = new HashMap<>(map); + Map map = value.getNode(XP_BOOST_NODE_ROOT).getValue(new TypeToken>(){}); + HashMap xpBoostHashMap = new HashMap<>(map); CustomXPPerk customXPPerk = new CustomXPPerk(perkName); customXPPerk.setCustomXPMultiplierMap(xpBoostHashMap); @@ -38,15 +38,15 @@ public class CustomXPPerkSerializer implements TypeSerializer { public void serialize(@NonNull TypeToken type, @Nullable CustomXPPerk obj, @NonNull ConfigurationNode value) throws ObjectMappingException { String name = obj.getPerkName(); - HashMap xpBoostMap = new HashMap<>(); + HashMap xpBoostMap = new HashMap<>(); value.getNode(PERK_NAME).setValue(name); for (PrimarySkillType primarySkillType : PrimarySkillType.values()) { - float xpMultValue = obj.getXPMultiplierValue(primarySkillType); + Double xpMultValue = obj.getXPMultiplierValue(primarySkillType); //Ignore default values - if (xpMultValue == 1.0F) + if (xpMultValue == 1.0) continue; xpBoostMap.put(primarySkillType, obj.getXPMultiplierValue(primarySkillType)); diff --git a/src/main/java/com/gmail/nossr50/config/hocon/serializers/DamagePropertySerializer.java b/src/main/java/com/gmail/nossr50/config/hocon/serializers/DamagePropertySerializer.java index c3f837c50..de4404826 100644 --- a/src/main/java/com/gmail/nossr50/config/hocon/serializers/DamagePropertySerializer.java +++ b/src/main/java/com/gmail/nossr50/config/hocon/serializers/DamagePropertySerializer.java @@ -17,8 +17,8 @@ public class DamagePropertySerializer implements TypeSerializer @Nullable @Override public DamageProperty deserialize(@NonNull TypeToken type, @NonNull ConfigurationNode value) throws ObjectMappingException { - Float pvp = value.getNode(PVP_NODE).getValue(TypeToken.of(Float.class)); - Float pve = value.getNode(PVE_NODE).getValue(TypeToken.of(Float.class)); + Double pvp = value.getNode(PVP_NODE).getValue(TypeToken.of(Double.class)); + Double pve = value.getNode(PVE_NODE).getValue(TypeToken.of(Double.class)); DamageProperty damageProperty = new AbstractDamageProperty(pve, pvp); return damageProperty; } diff --git a/src/main/java/com/gmail/nossr50/database/FlatfileDatabaseManager.java b/src/main/java/com/gmail/nossr50/database/FlatfileDatabaseManager.java index 949a6513d..ae6c1b119 100644 --- a/src/main/java/com/gmail/nossr50/database/FlatfileDatabaseManager.java +++ b/src/main/java/com/gmail/nossr50/database/FlatfileDatabaseManager.java @@ -1118,7 +1118,7 @@ public final class FlatfileDatabaseManager implements DatabaseManager { private PlayerProfile loadFromLine(String[] character) { Map skills = getSkillMapFromLine(character); // Skill levels - Map skillsXp = new EnumMap<>(PrimarySkillType.class); // Skill & XP + Map skillsXp = new EnumMap<>(PrimarySkillType.class); // Skill & XP Map skillsDATS = new EnumMap<>(SuperAbilityType.class); // Ability & Cooldown Map uniquePlayerDataMap = new EnumMap<>(UniqueDataType.class); MobHealthbarType mobHealthbarType; @@ -1126,19 +1126,19 @@ public final class FlatfileDatabaseManager implements DatabaseManager { // TODO on updates, put new values in a try{} ? - skillsXp.put(PrimarySkillType.TAMING, (float) Integer.valueOf(character[EXP_TAMING])); - skillsXp.put(PrimarySkillType.MINING, (float) Integer.valueOf(character[EXP_MINING])); - skillsXp.put(PrimarySkillType.REPAIR, (float) Integer.valueOf(character[EXP_REPAIR])); - skillsXp.put(PrimarySkillType.WOODCUTTING, (float) Integer.valueOf(character[EXP_WOODCUTTING])); - skillsXp.put(PrimarySkillType.UNARMED, (float) Integer.valueOf(character[EXP_UNARMED])); - skillsXp.put(PrimarySkillType.HERBALISM, (float) Integer.valueOf(character[EXP_HERBALISM])); - skillsXp.put(PrimarySkillType.EXCAVATION, (float) Integer.valueOf(character[EXP_EXCAVATION])); - skillsXp.put(PrimarySkillType.ARCHERY, (float) Integer.valueOf(character[EXP_ARCHERY])); - skillsXp.put(PrimarySkillType.SWORDS, (float) Integer.valueOf(character[EXP_SWORDS])); - skillsXp.put(PrimarySkillType.AXES, (float) Integer.valueOf(character[EXP_AXES])); - skillsXp.put(PrimarySkillType.ACROBATICS, (float) Integer.valueOf(character[EXP_ACROBATICS])); - skillsXp.put(PrimarySkillType.FISHING, (float) Integer.valueOf(character[EXP_FISHING])); - skillsXp.put(PrimarySkillType.ALCHEMY, (float) Integer.valueOf(character[EXP_ALCHEMY])); + skillsXp.put(PrimarySkillType.TAMING, (double) Integer.valueOf(character[EXP_TAMING])); + skillsXp.put(PrimarySkillType.MINING, (double) Integer.valueOf(character[EXP_MINING])); + skillsXp.put(PrimarySkillType.REPAIR, (double) Integer.valueOf(character[EXP_REPAIR])); + skillsXp.put(PrimarySkillType.WOODCUTTING, (double) Integer.valueOf(character[EXP_WOODCUTTING])); + skillsXp.put(PrimarySkillType.UNARMED, (double) Integer.valueOf(character[EXP_UNARMED])); + skillsXp.put(PrimarySkillType.HERBALISM, (double) Integer.valueOf(character[EXP_HERBALISM])); + skillsXp.put(PrimarySkillType.EXCAVATION, (double) Integer.valueOf(character[EXP_EXCAVATION])); + skillsXp.put(PrimarySkillType.ARCHERY, (double) Integer.valueOf(character[EXP_ARCHERY])); + skillsXp.put(PrimarySkillType.SWORDS, (double) Integer.valueOf(character[EXP_SWORDS])); + skillsXp.put(PrimarySkillType.AXES, (double) Integer.valueOf(character[EXP_AXES])); + skillsXp.put(PrimarySkillType.ACROBATICS, (double) Integer.valueOf(character[EXP_ACROBATICS])); + skillsXp.put(PrimarySkillType.FISHING, (double) Integer.valueOf(character[EXP_FISHING])); + skillsXp.put(PrimarySkillType.ALCHEMY, (double) Integer.valueOf(character[EXP_ALCHEMY])); // Taming - Unused skillsDATS.put(SuperAbilityType.SUPER_BREAKER, Integer.valueOf(character[COOLDOWN_SUPER_BREAKER])); diff --git a/src/main/java/com/gmail/nossr50/database/SQLDatabaseManager.java b/src/main/java/com/gmail/nossr50/database/SQLDatabaseManager.java index 4e2bd7c24..972ac5f29 100644 --- a/src/main/java/com/gmail/nossr50/database/SQLDatabaseManager.java +++ b/src/main/java/com/gmail/nossr50/database/SQLDatabaseManager.java @@ -1049,7 +1049,7 @@ public final class SQLDatabaseManager implements DatabaseManager { private PlayerProfile loadFromResult(String playerName, ResultSet result) throws SQLException { Map skills = new EnumMap<>(PrimarySkillType.class); // Skill & Level - Map skillsXp = new EnumMap<>(PrimarySkillType.class); // Skill & XP + Map skillsXp = new EnumMap<>(PrimarySkillType.class); // Skill & XP Map skillsDATS = new EnumMap<>(SuperAbilityType.class); // Ability & Cooldown Map uniqueData = new EnumMap<>(UniqueDataType.class); //Chimaera wing cooldown and other misc info MobHealthbarType mobHealthbarType; @@ -1076,19 +1076,19 @@ public final class SQLDatabaseManager implements DatabaseManager { skills.put(PrimarySkillType.FISHING, result.getInt(OFFSET_SKILLS + 12)); skills.put(PrimarySkillType.ALCHEMY, result.getInt(OFFSET_SKILLS + 13)); - skillsXp.put(PrimarySkillType.TAMING, result.getFloat(OFFSET_XP + 1)); - skillsXp.put(PrimarySkillType.MINING, result.getFloat(OFFSET_XP + 2)); - skillsXp.put(PrimarySkillType.REPAIR, result.getFloat(OFFSET_XP + 3)); - skillsXp.put(PrimarySkillType.WOODCUTTING, result.getFloat(OFFSET_XP + 4)); - skillsXp.put(PrimarySkillType.UNARMED, result.getFloat(OFFSET_XP + 5)); - skillsXp.put(PrimarySkillType.HERBALISM, result.getFloat(OFFSET_XP + 6)); - skillsXp.put(PrimarySkillType.EXCAVATION, result.getFloat(OFFSET_XP + 7)); - skillsXp.put(PrimarySkillType.ARCHERY, result.getFloat(OFFSET_XP + 8)); - skillsXp.put(PrimarySkillType.SWORDS, result.getFloat(OFFSET_XP + 9)); - skillsXp.put(PrimarySkillType.AXES, result.getFloat(OFFSET_XP + 10)); - skillsXp.put(PrimarySkillType.ACROBATICS, result.getFloat(OFFSET_XP + 11)); - skillsXp.put(PrimarySkillType.FISHING, result.getFloat(OFFSET_XP + 12)); - skillsXp.put(PrimarySkillType.ALCHEMY, result.getFloat(OFFSET_XP + 13)); + skillsXp.put(PrimarySkillType.TAMING, result.getDouble(OFFSET_XP + 1)); + skillsXp.put(PrimarySkillType.MINING, result.getDouble(OFFSET_XP + 2)); + skillsXp.put(PrimarySkillType.REPAIR, result.getDouble(OFFSET_XP + 3)); + skillsXp.put(PrimarySkillType.WOODCUTTING, result.getDouble(OFFSET_XP + 4)); + skillsXp.put(PrimarySkillType.UNARMED, result.getDouble(OFFSET_XP + 5)); + skillsXp.put(PrimarySkillType.HERBALISM, result.getDouble(OFFSET_XP + 6)); + skillsXp.put(PrimarySkillType.EXCAVATION, result.getDouble(OFFSET_XP + 7)); + skillsXp.put(PrimarySkillType.ARCHERY, result.getDouble(OFFSET_XP + 8)); + skillsXp.put(PrimarySkillType.SWORDS, result.getDouble(OFFSET_XP + 9)); + skillsXp.put(PrimarySkillType.AXES, result.getDouble(OFFSET_XP + 10)); + skillsXp.put(PrimarySkillType.ACROBATICS, result.getDouble(OFFSET_XP + 11)); + skillsXp.put(PrimarySkillType.FISHING, result.getDouble(OFFSET_XP + 12)); + skillsXp.put(PrimarySkillType.ALCHEMY, result.getDouble(OFFSET_XP + 13)); // Taming - Unused - result.getInt(OFFSET_DATS + 1) skillsDATS.put(SuperAbilityType.SUPER_BREAKER, result.getInt(OFFSET_DATS + 2)); diff --git a/src/main/java/com/gmail/nossr50/datatypes/experience/CustomXPPerk.java b/src/main/java/com/gmail/nossr50/datatypes/experience/CustomXPPerk.java index f74e5d44e..284bb23bf 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/experience/CustomXPPerk.java +++ b/src/main/java/com/gmail/nossr50/datatypes/experience/CustomXPPerk.java @@ -7,7 +7,7 @@ import java.util.HashMap; public class CustomXPPerk { private String perkName; - private HashMap customXPMultiplierMap; + private HashMap customXPMultiplierMap; public CustomXPPerk(String perkName) { this.perkName = perkName; @@ -20,7 +20,7 @@ public class CustomXPPerk { * @param primarySkillType target skill * @param xpMult xp multiplier */ - public void setCustomXPValue(PrimarySkillType primarySkillType, float xpMult) { + public void setCustomXPValue(PrimarySkillType primarySkillType, Double xpMult) { customXPMultiplierMap.put(primarySkillType, xpMult); } @@ -31,7 +31,7 @@ public class CustomXPPerk { * @param primarySkillType target skill * @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) 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) * @param customXPMultiplierMap new custom xp multiplier map */ - public void setCustomXPMultiplierMap(HashMap customXPMultiplierMap) { + public void setCustomXPMultiplierMap(HashMap customXPMultiplierMap) { this.customXPMultiplierMap = customXPMultiplierMap; } diff --git a/src/main/java/com/gmail/nossr50/datatypes/experience/SkillXpGain.java b/src/main/java/com/gmail/nossr50/datatypes/experience/SkillXpGain.java index 59d85863d..d617cb441 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/experience/SkillXpGain.java +++ b/src/main/java/com/gmail/nossr50/datatypes/experience/SkillXpGain.java @@ -8,10 +8,10 @@ import java.util.concurrent.TimeUnit; public class SkillXpGain implements Delayed { private final long expiryTime; - private final float xp; + private final double xp; private final PrimarySkillType type; - public SkillXpGain(PrimarySkillType type, float xp) { + public SkillXpGain(PrimarySkillType type, double xp) { this.expiryTime = System.currentTimeMillis() + getDuration(); this.xp = xp; this.type = type; @@ -25,7 +25,7 @@ public class SkillXpGain implements Delayed { return type; } - public float getXp() { + public double getXp() { return xp; } diff --git a/src/main/java/com/gmail/nossr50/datatypes/party/Party.java b/src/main/java/com/gmail/nossr50/datatypes/party/Party.java index 249864514..856c11712 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/party/Party.java +++ b/src/main/java/com/gmail/nossr50/datatypes/party/Party.java @@ -33,7 +33,7 @@ public class Party { private boolean locked; private Party ally; private int level; - private float xp; + private double xp; private ShareMode xpShareMode = ShareMode.NONE; private ShareMode itemShareMode = ShareMode.NONE; @@ -171,20 +171,20 @@ public class Party { this.level = level; } - public float getXp() { + public double getXp() { return xp; } - public void setXp(float xp) { + public void setXp(double xp) { this.xp = xp; } - public void addXp(float xp) { + public void addXp(double xp) { setXp(getXp() + xp); } - protected float levelUp() { - float xpRemoved = getXpToLevel(); + protected double levelUp() { + double xpRemoved = getXpToLevel(); setLevel(getLevel() + 1); setXp(getXp() - xpRemoved); @@ -206,7 +206,7 @@ public class Party { * * @param xp Experience amount to add */ - public void applyXpGain(float xp) { + public void applyXpGain(double xp) { if (!EventUtils.handlePartyXpGainEvent(this, xp)) { return; } @@ -216,7 +216,7 @@ public class Party { } int levelsGained = 0; - float xpRemoved = 0; + double xpRemoved = 0; while (getXp() >= getXpToLevel()) { /*if (hasReachedLevelCap()) { diff --git a/src/main/java/com/gmail/nossr50/datatypes/player/McMMOPlayer.java b/src/main/java/com/gmail/nossr50/datatypes/player/McMMOPlayer.java index bb0d81598..a2f54eb34 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/player/McMMOPlayer.java +++ b/src/main/java/com/gmail/nossr50/datatypes/player/McMMOPlayer.java @@ -89,7 +89,7 @@ public class McMMOPlayer { //private int chimeraWingLastUse; private Location teleportCommence; private boolean isUsingUnarmed; - private HashMap personalXPModifiers; + private HashMap personalXPModifiers; public McMMOPlayer(Player player, PlayerProfile profile) { String playerName = player.getName(); @@ -155,7 +155,7 @@ public class McMMOPlayer { * @param primarySkillType target primary skill * @return this players personal XP multiplier for target PrimarySkillType */ - public float getPlayerSpecificXPMult(PrimarySkillType primarySkillType) { + public Double getPlayerSpecificXPMult(PrimarySkillType primarySkillType) { return personalXPModifiers.get(primarySkillType); } @@ -479,7 +479,7 @@ public class McMMOPlayer { * @param skill Skill being used * @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."); if (xp <= 0.0) { @@ -488,7 +488,7 @@ public class McMMOPlayer { if (skill.isChildSkill()) { Set parentSkills = FamilyTree.getParents(skill); - float splitXp = xp / parentSkills.size(); + double splitXp = xp / parentSkills.size(); for (PrimarySkillType parentSkill : parentSkills) { if (parentSkill.getPermissions(player)) { @@ -513,7 +513,7 @@ public class McMMOPlayer { * @param skill Skill being used * @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) return; @@ -534,7 +534,7 @@ public class McMMOPlayer { * @param primarySkillType Skill being used * @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)) { return; } @@ -569,7 +569,7 @@ public class McMMOPlayer { } int levelsGained = 0; - float xpRemoved = 0; + double xpRemoved = 0; while (getSkillXpLevelRaw(primarySkillType) >= getXpToLevel(primarySkillType)) { if (mcMMO.getPlayerLevelingSettings().isLevelCapEnabled(primarySkillType) @@ -769,14 +769,14 @@ public class McMMOPlayer { * @param xp Experience amount to process * @return Modified experience */ - private float modifyXpGain(PrimarySkillType primarySkillType, float xp) { + private double modifyXpGain(PrimarySkillType primarySkillType, double xp) { if (((primarySkillType.getMaxLevel() <= getSkillLevel(primarySkillType)) && mcMMO.getPlayerLevelingSettings().isLevelCapEnabled(primarySkillType)) || (mcMMO.getPlayerLevelingSettings().getConfigSectionLevelCaps().getPowerLevel().getLevelCap() <= getPowerLevel())) { 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 return xp * personalXPModifiers.get(primarySkillType); @@ -950,7 +950,7 @@ public class McMMOPlayer { return profile.getSkillLevel(skill); } - public float getSkillXpLevelRaw(PrimarySkillType skill) { + public double getSkillXpLevelRaw(PrimarySkillType skill) { return profile.getSkillXpLevelRaw(skill); } @@ -958,7 +958,7 @@ public class McMMOPlayer { return profile.getSkillXpLevel(skill); } - public void setSkillXpLevel(PrimarySkillType skill, float xpLevel) { + public void setSkillXpLevel(PrimarySkillType skill, double xpLevel) { profile.setSkillXpLevel(skill, xpLevel); } @@ -978,7 +978,7 @@ public class McMMOPlayer { profile.addLevels(skill, levels); } - public void addXp(PrimarySkillType skill, float xp) { + public void addXp(PrimarySkillType skill, double xp) { profile.addXp(skill, xp); } diff --git a/src/main/java/com/gmail/nossr50/datatypes/player/PlayerProfile.java b/src/main/java/com/gmail/nossr50/datatypes/player/PlayerProfile.java index 367895929..2790dcdfa 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/player/PlayerProfile.java +++ b/src/main/java/com/gmail/nossr50/datatypes/player/PlayerProfile.java @@ -20,7 +20,7 @@ public class PlayerProfile { private final String playerName; /* Skill Data */ private final Map skills = new HashMap<>(); // Skill & Level - private final Map skillsXp = new HashMap<>(); // Skill & XP + private final Map skillsXp = new HashMap<>(); // Skill & XP private final Map abilityDATS = new HashMap<>(); // Ability & Cooldown private final Map uniquePlayerData = new HashMap<>(); //Misc data that doesn't fit into other categories (chimaera wing, etc..) private UUID uuid; @@ -32,7 +32,7 @@ public class PlayerProfile { private int saveAttempts = 0; // Store previous XP gains for diminished returns private DelayQueue gainedSkillsXp = new DelayQueue(); - private HashMap rollingSkillsXp = new HashMap(); + private HashMap rollingSkillsXp = new HashMap(); @Deprecated public PlayerProfile(String playerName) { @@ -52,7 +52,7 @@ public class PlayerProfile { for (PrimarySkillType primarySkillType : PrimarySkillType.NON_CHILD_SKILLS) { skills.put(primarySkillType, mcMMO.getPlayerLevelingSettings().getConfigSectionLevelingGeneral().getStartingLevel()); - skillsXp.put(primarySkillType, 0F); + skillsXp.put(primarySkillType, 0.0); } //Misc Cooldowns @@ -70,7 +70,7 @@ public class PlayerProfile { this.loaded = isLoaded; } - public PlayerProfile(String playerName, UUID uuid, Map levelData, Map xpData, Map cooldownData, MobHealthbarType mobHealthbarType, int scoreboardTipsShown, Map uniqueProfileData) { + public PlayerProfile(String playerName, UUID uuid, Map levelData, Map xpData, Map cooldownData, MobHealthbarType mobHealthbarType, int scoreboardTipsShown, Map uniqueProfileData) { this.playerName = playerName; this.uuid = uuid; this.mobHealthbarType = mobHealthbarType; @@ -235,7 +235,7 @@ public class PlayerProfile { return skill.isChildSkill() ? getChildSkillLevel(skill) : skills.get(skill); } - public float getSkillXpLevelRaw(PrimarySkillType skill) { + public double getSkillXpLevelRaw(PrimarySkillType skill) { return skillsXp.get(skill); } @@ -243,7 +243,7 @@ public class PlayerProfile { return (int) Math.floor(getSkillXpLevelRaw(skill)); } - public void setSkillXpLevel(PrimarySkillType skill, float xpLevel) { + public void setSkillXpLevel(PrimarySkillType skill, double xpLevel) { if (skill.isChildSkill()) { return; } @@ -253,8 +253,8 @@ public class PlayerProfile { skillsXp.put(skill, xpLevel); } - protected float levelUp(PrimarySkillType skill) { - float xpRemoved = getXpToLevel(skill); + protected double levelUp(PrimarySkillType skill) { + double xpRemoved = getXpToLevel(skill); changed = true; @@ -280,7 +280,7 @@ public class PlayerProfile { skillsXp.put(skill, skillsXp.get(skill) - xp); } - public void removeXp(PrimarySkillType skill, float xp) { + public void removeXp(PrimarySkillType skill, double xp) { if (skill.isChildSkill()) { return; } @@ -308,7 +308,7 @@ public class PlayerProfile { level = 0; 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 xp Number of experience to add */ - public void addXp(PrimarySkillType skill, float xp) { + public void addXp(PrimarySkillType skill, double xp) { changed = true; if (skill.isChildSkill()) { Set parentSkills = FamilyTree.getParents(skill); - float dividedXP = (xp / parentSkills.size()); + double dividedXP = (xp / parentSkills.size()); for (PrimarySkillType parentSkill : parentSkills) { skillsXp.put(parentSkill, skillsXp.get(parentSkill) + dividedXP); @@ -348,8 +348,8 @@ public class PlayerProfile { * * @return xp Experience amount registered */ - public float getRegisteredXpGain(PrimarySkillType primarySkillType) { - float xp = 0F; + public double getRegisteredXpGain(PrimarySkillType primarySkillType) { + double xp = 0F; if (rollingSkillsXp.get(primarySkillType) != null) { xp = rollingSkillsXp.get(primarySkillType); @@ -365,7 +365,7 @@ public class PlayerProfile { * @param primarySkillType Skill being used * @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)); rollingSkillsXp.put(primarySkillType, getRegisteredXpGain(primarySkillType) + xp); } diff --git a/src/main/java/com/gmail/nossr50/events/experience/McMMOPlayerXpGainEvent.java b/src/main/java/com/gmail/nossr50/events/experience/McMMOPlayerXpGainEvent.java index 5969c05c1..84ac76fcf 100644 --- a/src/main/java/com/gmail/nossr50/events/experience/McMMOPlayerXpGainEvent.java +++ b/src/main/java/com/gmail/nossr50/events/experience/McMMOPlayerXpGainEvent.java @@ -10,15 +10,15 @@ import org.bukkit.event.HandlerList; */ public class McMMOPlayerXpGainEvent extends McMMOPlayerExperienceEvent { private static final HandlerList handlers = new HandlerList(); - private float xpGained; + private double xpGained; @Deprecated - public McMMOPlayerXpGainEvent(Player player, PrimarySkillType skill, float xpGained) { + public McMMOPlayerXpGainEvent(Player player, PrimarySkillType skill, double xpGained) { super(player, skill, XPGainReason.UNKNOWN); 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); this.xpGained = xpGained; } @@ -30,14 +30,14 @@ public class McMMOPlayerXpGainEvent extends McMMOPlayerExperienceEvent { /** * @return The amount of experience gained in this event */ - public float getRawXpGained() { + public double getRawXpGained() { return xpGained; } /** * @param xpGained int amount of experience gained in this event */ - public void setRawXpGained(float xpGained) { + public void setRawXpGained(double xpGained) { this.xpGained = xpGained; } diff --git a/src/main/java/com/gmail/nossr50/events/hardcore/McMMOPlayerDeathPenaltyEvent.java b/src/main/java/com/gmail/nossr50/events/hardcore/McMMOPlayerDeathPenaltyEvent.java index a6035351c..12ffbbcf6 100644 --- a/src/main/java/com/gmail/nossr50/events/hardcore/McMMOPlayerDeathPenaltyEvent.java +++ b/src/main/java/com/gmail/nossr50/events/hardcore/McMMOPlayerDeathPenaltyEvent.java @@ -13,10 +13,10 @@ public class McMMOPlayerDeathPenaltyEvent extends PlayerEvent implements Cancell **/ private static final HandlerList handlers = new HandlerList(); private HashMap levelChanged; - private HashMap experienceChanged; + private HashMap experienceChanged; private boolean cancelled; - public McMMOPlayerDeathPenaltyEvent(Player player, HashMap levelChanged, HashMap experienceChanged) { + public McMMOPlayerDeathPenaltyEvent(Player player, HashMap levelChanged, HashMap experienceChanged) { super(player); this.levelChanged = levelChanged; this.experienceChanged = experienceChanged; @@ -41,11 +41,11 @@ public class McMMOPlayerDeathPenaltyEvent extends PlayerEvent implements Cancell this.levelChanged = levelChanged; } - public HashMap getExperienceChanged() { + public HashMap getExperienceChanged() { return experienceChanged; } - public void setExperienceChanged(HashMap experienceChanged) { + public void setExperienceChanged(HashMap experienceChanged) { this.experienceChanged = experienceChanged; } diff --git a/src/main/java/com/gmail/nossr50/events/hardcore/McMMOPlayerStatLossEvent.java b/src/main/java/com/gmail/nossr50/events/hardcore/McMMOPlayerStatLossEvent.java index 414ffdac5..c444a272f 100644 --- a/src/main/java/com/gmail/nossr50/events/hardcore/McMMOPlayerStatLossEvent.java +++ b/src/main/java/com/gmail/nossr50/events/hardcore/McMMOPlayerStatLossEvent.java @@ -6,7 +6,7 @@ import java.util.HashMap; public class McMMOPlayerStatLossEvent extends McMMOPlayerDeathPenaltyEvent { - public McMMOPlayerStatLossEvent(Player player, HashMap levelChanged, HashMap experienceChanged) { + public McMMOPlayerStatLossEvent(Player player, HashMap levelChanged, HashMap experienceChanged) { super(player, levelChanged, experienceChanged); } } diff --git a/src/main/java/com/gmail/nossr50/events/hardcore/McMMOPlayerVampirismEvent.java b/src/main/java/com/gmail/nossr50/events/hardcore/McMMOPlayerVampirismEvent.java index 735094f67..23f1125aa 100644 --- a/src/main/java/com/gmail/nossr50/events/hardcore/McMMOPlayerVampirismEvent.java +++ b/src/main/java/com/gmail/nossr50/events/hardcore/McMMOPlayerVampirismEvent.java @@ -7,7 +7,7 @@ import java.util.HashMap; public class McMMOPlayerVampirismEvent extends McMMOPlayerDeathPenaltyEvent { private boolean isVictim; - public McMMOPlayerVampirismEvent(Player player, boolean isVictim, HashMap levelChanged, HashMap experienceChanged) { + public McMMOPlayerVampirismEvent(Player player, boolean isVictim, HashMap levelChanged, HashMap experienceChanged) { super(player, levelChanged, experienceChanged); this.isVictim = isVictim; } diff --git a/src/main/java/com/gmail/nossr50/events/party/McMMOPartyXpGainEvent.java b/src/main/java/com/gmail/nossr50/events/party/McMMOPartyXpGainEvent.java index a3c74d0af..5224412ef 100644 --- a/src/main/java/com/gmail/nossr50/events/party/McMMOPartyXpGainEvent.java +++ b/src/main/java/com/gmail/nossr50/events/party/McMMOPartyXpGainEvent.java @@ -11,10 +11,10 @@ public class McMMOPartyXpGainEvent extends Event implements Cancellable { **/ private static final HandlerList handlers = new HandlerList(); private Party party; - private float xpGained; + private double xpGained; private boolean cancelled; - public McMMOPartyXpGainEvent(Party party, float xpGained) { + public McMMOPartyXpGainEvent(Party party, double xpGained) { this.party = party; this.xpGained = xpGained; this.cancelled = false; @@ -31,14 +31,14 @@ public class McMMOPartyXpGainEvent extends Event implements Cancellable { /** * @return The amount of experience gained in this event */ - public float getRawXpGained() { + public double getRawXpGained() { return xpGained; } /** * @param xpGained set amount of experience gained in this event */ - public void setRawXpGained(float xpGained) { + public void setRawXpGained(double xpGained) { this.xpGained = xpGained; } diff --git a/src/main/java/com/gmail/nossr50/listeners/SelfListener.java b/src/main/java/com/gmail/nossr50/listeners/SelfListener.java index 21408d1c8..1fbae1723 100644 --- a/src/main/java/com/gmail/nossr50/listeners/SelfListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/SelfListener.java @@ -116,19 +116,19 @@ public class SelfListener implements Listener { 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()); - float difference = (mcMMOPlayer.getProfile().getRegisteredXpGain(primarySkillType) - modifiedThreshold) / modifiedThreshold; + double modifiedThreshold = (double) (threshold / primarySkillType.getXpModifier() * mcMMO.getDynamicSettingsManager().getExperienceManager().getGlobalXpMult()); + double difference = (mcMMOPlayer.getProfile().getRegisteredXpGain(primarySkillType) - modifiedThreshold) / modifiedThreshold; if (difference > 0) { // System.out.println("Total XP Earned: " + mcMMOPlayer.getProfile().getRegisteredXpGain(primarySkillType) + " / Threshold value: " + threshold); // System.out.println(difference * 100 + "% over the threshold!"); // System.out.println("Previous: " + event.getRawXpGained()); // 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 diff --git a/src/main/java/com/gmail/nossr50/party/ShareHandler.java b/src/main/java/com/gmail/nossr50/party/ShareHandler.java index 8a1063177..672ceae58 100644 --- a/src/main/java/com/gmail/nossr50/party/ShareHandler.java +++ b/src/main/java/com/gmail/nossr50/party/ShareHandler.java @@ -29,7 +29,7 @@ public final class ShareHandler { * @param primarySkillType Skill being used * @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(); if (party.getXpShareMode() != ShareMode.EQUAL) { @@ -48,7 +48,7 @@ public final class ShareHandler { double shareBonus = Math.min(mcMMO.getPartyXPShareSettings().getPartyShareXPBonusBase() + (partySize * mcMMO.getPartyXPShareSettings().getPartyShareBonusIncrease()), mcMMO.getPartyXPShareSettings().getPartyShareBonusCap()); - float splitXp = (float) (xp / partySize * shareBonus); + double splitXp = (double) (xp / partySize * shareBonus); for (Player member : nearMembers) { //Profile not loaded diff --git a/src/main/java/com/gmail/nossr50/skills/SkillManager.java b/src/main/java/com/gmail/nossr50/skills/SkillManager.java index 153d394b8..81649f4ea 100644 --- a/src/main/java/com/gmail/nossr50/skills/SkillManager.java +++ b/src/main/java/com/gmail/nossr50/skills/SkillManager.java @@ -25,6 +25,18 @@ public abstract class SkillManager { 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 * @@ -48,6 +60,17 @@ public abstract class SkillManager { 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) { return (damager instanceof Player && target instanceof Player) ? XPGainReason.PVP : XPGainReason.PVE; } diff --git a/src/main/java/com/gmail/nossr50/skills/fishing/Fishing.java b/src/main/java/com/gmail/nossr50/skills/fishing/Fishing.java index dedd01848..c72327632 100644 --- a/src/main/java/com/gmail/nossr50/skills/fishing/Fishing.java +++ b/src/main/java/com/gmail/nossr50/skills/fishing/Fishing.java @@ -20,7 +20,7 @@ public final class Fishing { public static Fishing instance; private final long fishingRodCastCdMilliseconds; private final int overfishLimit; - private final float boundingBoxSize; + private final double boundingBoxSize; private HashMap> enchantableCache = new HashMap<>(); private HashMap fishingXpRewardMap; private Set masterAnglerBiomes = BiomeAdapter.WATER_BIOMES; @@ -121,7 +121,7 @@ public final class Fishing { return overfishLimit; } - public float getBoundingBoxSize() { + public double getBoundingBoxSize() { return boundingBoxSize; } } diff --git a/src/main/java/com/gmail/nossr50/skills/repair/RepairManager.java b/src/main/java/com/gmail/nossr50/skills/repair/RepairManager.java index 0f3af0128..3e01c2aa2 100644 --- a/src/main/java/com/gmail/nossr50/skills/repair/RepairManager.java +++ b/src/main/java/com/gmail/nossr50/skills/repair/RepairManager.java @@ -173,7 +173,7 @@ public class RepairManager extends SkillManager { inventory.removeItem(toRemove); // Give out XP like candy - applyXpGain((float) ((getPercentageRepaired(startDurability, newDurability, repairable.getMaximumDurability()) + applyXpGain(((getPercentageRepaired(startDurability, newDurability, repairable.getMaximumDurability()) * repairable.getXpMultiplier()) * mcMMO.getConfigManager().getConfigExperience().getRepairXPBase()) * mcMMO.getConfigManager().getConfigExperience().getExperienceRepair().getItemMaterialXPMultiplier(repairable.getRepairItemMaterialCategory()), XPGainReason.PVE); @@ -188,7 +188,7 @@ public class RepairManager extends SkillManager { 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); } diff --git a/src/main/java/com/gmail/nossr50/util/EventUtils.java b/src/main/java/com/gmail/nossr50/util/EventUtils.java index 5ed7c4ff2..884c26b4a 100644 --- a/src/main/java/com/gmail/nossr50/util/EventUtils.java +++ b/src/main/java/com/gmail/nossr50/util/EventUtils.java @@ -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); mcMMO.p.getServer().getPluginManager().callEvent(event); @@ -219,7 +219,7 @@ public class EventUtils { 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); mcMMO.p.getServer().getPluginManager().callEvent(event); @@ -280,7 +280,7 @@ public class EventUtils { 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); mcMMO.p.getServer().getPluginManager().callEvent(event); @@ -293,7 +293,7 @@ public class EventUtils { 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); mcMMO.p.getServer().getPluginManager().callEvent(event); @@ -308,7 +308,7 @@ public class EventUtils { 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); mcMMO.p.getServer().getPluginManager().callEvent(event); @@ -322,7 +322,7 @@ public class EventUtils { return !isCancelled; } - public static boolean handleStatsLossEvent(Player player, HashMap levelChanged, HashMap experienceChanged) { + public static boolean handleStatsLossEvent(Player player, HashMap levelChanged, HashMap experienceChanged) { if (UserManager.getPlayer(player) == null) return true; @@ -356,7 +356,7 @@ public class EventUtils { return !isCancelled; } - public static boolean handleVampirismEvent(Player killer, Player victim, HashMap levelChanged, HashMap experienceChanged) { + public static boolean handleVampirismEvent(Player killer, Player victim, HashMap levelChanged, HashMap experienceChanged) { McMMOPlayerVampirismEvent eventKiller = new McMMOPlayerVampirismEvent(killer, false, levelChanged, experienceChanged); McMMOPlayerVampirismEvent eventVictim = new McMMOPlayerVampirismEvent(victim, true, levelChanged, experienceChanged); mcMMO.p.getServer().getPluginManager().callEvent(eventKiller); @@ -366,10 +366,10 @@ public class EventUtils { if (!isCancelled) { HashMap levelChangedKiller = eventKiller.getLevelChanged(); - HashMap experienceChangedKiller = eventKiller.getExperienceChanged(); + HashMap experienceChangedKiller = eventKiller.getExperienceChanged(); HashMap levelChangedVictim = eventVictim.getLevelChanged(); - HashMap experienceChangedVictim = eventVictim.getExperienceChanged(); + HashMap experienceChangedVictim = eventVictim.getExperienceChanged(); McMMOPlayer killerPlayer = UserManager.getPlayer(killer); diff --git a/src/main/java/com/gmail/nossr50/util/HardcoreManager.java b/src/main/java/com/gmail/nossr50/util/HardcoreManager.java index 90208f37e..b9578b8a1 100644 --- a/src/main/java/com/gmail/nossr50/util/HardcoreManager.java +++ b/src/main/java/com/gmail/nossr50/util/HardcoreManager.java @@ -25,12 +25,12 @@ public final class HardcoreManager { int totalLevelsLost = 0; HashMap levelChanged = new HashMap<>(); - HashMap experienceChanged = new HashMap<>(); + HashMap experienceChanged = new HashMap<>(); for (PrimarySkillType primarySkillType : PrimarySkillType.NON_CHILD_SKILLS) { if (!primarySkillType.getHardcoreStatLossEnabled()) { levelChanged.put(primarySkillType.toString(), 0); - experienceChanged.put(primarySkillType.toString(), 0F); + experienceChanged.put(primarySkillType.toString(), 0.0); continue; } @@ -39,7 +39,7 @@ public final class HardcoreManager { if (playerSkillLevel <= 0 || playerSkillLevel <= levelThreshold) { levelChanged.put(primarySkillType.toString(), 0); - experienceChanged.put(primarySkillType.toString(), 0F); + experienceChanged.put(primarySkillType.toString(), 0.0); continue; } @@ -47,7 +47,7 @@ public final class HardcoreManager { int levelsLost = (int) statsLost; int xpLost = (int) Math.floor(playerSkillXpLevel * (statsLost - levelsLost)); levelChanged.put(primarySkillType.toString(), levelsLost); - experienceChanged.put(primarySkillType.toString(), (float) xpLost); + experienceChanged.put(primarySkillType.toString(), (double) xpLost); totalLevelsLost += levelsLost; } @@ -71,12 +71,12 @@ public final class HardcoreManager { int totalLevelsStolen = 0; HashMap levelChanged = new HashMap<>(); - HashMap experienceChanged = new HashMap<>(); + HashMap experienceChanged = new HashMap<>(); for (PrimarySkillType primarySkillType : PrimarySkillType.NON_CHILD_SKILLS) { if (!primarySkillType.getHardcoreVampirismEnabled()) { levelChanged.put(primarySkillType.toString(), 0); - experienceChanged.put(primarySkillType.toString(), 0F); + experienceChanged.put(primarySkillType.toString(), 0.0); continue; } @@ -85,7 +85,7 @@ public final class HardcoreManager { if (victimSkillLevel <= 0 || victimSkillLevel < killerSkillLevel / 2 || victimSkillLevel <= levelThreshold) { levelChanged.put(primarySkillType.toString(), 0); - experienceChanged.put(primarySkillType.toString(), 0F); + experienceChanged.put(primarySkillType.toString(), 0.0); continue; } @@ -95,7 +95,7 @@ public final class HardcoreManager { int levelsStolen = (int) statsStolen; int xpStolen = (int) Math.floor(victimSkillXpLevel * (statsStolen - levelsStolen)); levelChanged.put(primarySkillType.toString(), levelsStolen); - experienceChanged.put(primarySkillType.toString(), (float) xpStolen); + experienceChanged.put(primarySkillType.toString(), (double) xpStolen); totalLevelsStolen += levelsStolen; } diff --git a/src/main/java/com/gmail/nossr50/util/experience/ExperienceManager.java b/src/main/java/com/gmail/nossr50/util/experience/ExperienceManager.java index 8e33b4f5c..213884aea 100644 --- a/src/main/java/com/gmail/nossr50/util/experience/ExperienceManager.java +++ b/src/main/java/com/gmail/nossr50/util/experience/ExperienceManager.java @@ -19,9 +19,9 @@ public class ExperienceManager { private HashMap woodcuttingFullyQualifiedBlockXpMap; private HashMap excavationFullyQualifiedBlockXpMap; private HashMap furnaceFullyQualifiedItemXpMap; - private HashMap tamingExperienceMap; - private HashMap combatXPMultiplierMap; - private HashMap specialCombatXPMultiplierMap; //Applies to "groups" of things for convenience + private HashMap tamingExperienceMap; + private HashMap combatXPMultiplierMap; + private HashMap specialCombatXPMultiplierMap; //Applies to "groups" of things for convenience private double globalXpMult; @@ -57,7 +57,7 @@ public class ExperienceManager { * * @param platformSafeMap the platform safe map */ - public void fillCombatXPMultiplierMap(HashMap platformSafeMap) { + public void fillCombatXPMultiplierMap(HashMap platformSafeMap) { mcMMO.p.getLogger().info("Registering combat XP values..."); for (String entityString : platformSafeMap.keySet()) { //Iterate over all EntityType(s) @@ -83,7 +83,7 @@ public class ExperienceManager { * * @param map target map */ - public void registerSpecialCombatXPMultiplierMap(HashMap map) { + public void registerSpecialCombatXPMultiplierMap(HashMap map) { mcMMO.p.getLogger().info("Registering special combat XP values..."); specialCombatXPMultiplierMap = map; } @@ -122,7 +122,7 @@ public class ExperienceManager { if (entityType.toString().equalsIgnoreCase(s)) { //Match! matchFound = true; - tamingExperienceMap.put(entityType, (float) userTamingConfigMap.get(s)); + tamingExperienceMap.put(entityType, (double) userTamingConfigMap.get(s)); } } 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 - public float getBlockBreakXpValue(PrimarySkillType primarySkillType, Material material) throws UndefinedSkillBehaviour { + public double getBlockBreakXpValue(PrimarySkillType primarySkillType, Material material) throws UndefinedSkillBehaviour { switch (primarySkillType) { case MINING: return getMiningXp(material); @@ -265,7 +265,7 @@ public class ExperienceManager { * @param entityType target entity * @return value of XP for this entity */ - public float getTamingXp(EntityType entityType) { + public double getTamingXp(EntityType entityType) { return tamingExperienceMap.get(entityType); } @@ -376,7 +376,7 @@ public class ExperienceManager { * @param specialXPKey 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); } @@ -386,7 +386,7 @@ public class ExperienceManager { * @param entityType target entity type * @return the combat XP multiplier for this entity */ - public float getCombatXPMultiplier(EntityType entityType) { + public double getCombatXPMultiplier(EntityType entityType) { return combatXPMultiplierMap.get(entityType); } diff --git a/src/main/java/com/gmail/nossr50/util/player/PlayerLevelUtils.java b/src/main/java/com/gmail/nossr50/util/player/PlayerLevelUtils.java index e63afcfb4..928371218 100644 --- a/src/main/java/com/gmail/nossr50/util/player/PlayerLevelUtils.java +++ b/src/main/java/com/gmail/nossr50/util/player/PlayerLevelUtils.java @@ -92,11 +92,11 @@ public class PlayerLevelUtils { * @param skill 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 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 - HashSet xpPerkValues = new HashSet<>(); + HashSet xpPerkValues = new HashSet<>(); if (enabledCustomXPPerks.size() >= 1) { //Player has custom XP perks @@ -110,17 +110,17 @@ public class PlayerLevelUtils { //Disgusting legacy support start if (Permissions.quadrupleXp(player, skill)) { - xpPerkValues.add(4f); + xpPerkValues.add(4.0); } else if (Permissions.tripleXp(player, skill)) { - xpPerkValues.add(3f); + xpPerkValues.add(3.0); } else if (Permissions.doubleAndOneHalfXp(player, skill)) { - xpPerkValues.add(2.5f); + xpPerkValues.add(2.5); } else if (Permissions.doubleXp(player, skill)) { - xpPerkValues.add(2.0f); + xpPerkValues.add(2.0); } else if (Permissions.oneAndOneHalfXp(player, skill)) { - xpPerkValues.add(1.5f); + xpPerkValues.add(1.5); } else if (Permissions.oneAndOneTenthXp(player, skill)) { - xpPerkValues.add(1.1f); + xpPerkValues.add(1.1); } //Disgusting legacy support end @@ -128,7 +128,7 @@ public class PlayerLevelUtils { if (xpPerkValues.size() >= 1) return Collections.max(xpPerkValues); else - return 1.0F; + return 1.0; } diff --git a/src/main/java/com/gmail/nossr50/util/skills/CombatUtils.java b/src/main/java/com/gmail/nossr50/util/skills/CombatUtils.java index 7bd6f8162..92ca9be1c 100644 --- a/src/main/java/com/gmail/nossr50/util/skills/CombatUtils.java +++ b/src/main/java/com/gmail/nossr50/util/skills/CombatUtils.java @@ -553,7 +553,7 @@ public final class CombatUtils { * @param primarySkillType The skill being used */ private static void startGainXp(McMMOPlayer mcMMOPlayer, LivingEntity target, PrimarySkillType primarySkillType, double multiplier) { - float baseXPMultiplier = 0; + double baseXPMultiplier = 0; XPGainReason xpGainReason; if (target instanceof Player) {