From d528f11082ffdcb34b6e99368d6f53771a14bcfe Mon Sep 17 00:00:00 2001 From: Bill Tarbell Date: Wed, 1 Aug 2012 19:32:25 -0400 Subject: [PATCH] Allow global multiplier to be a double --- .../com/gmail/nossr50/commands/general/XprateCommand.java | 2 +- src/main/java/com/gmail/nossr50/config/Config.java | 4 ++-- src/main/java/com/gmail/nossr50/datatypes/McMMOPlayer.java | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/commands/general/XprateCommand.java b/src/main/java/com/gmail/nossr50/commands/general/XprateCommand.java index d77106a22..ff0f4ff3a 100644 --- a/src/main/java/com/gmail/nossr50/commands/general/XprateCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/general/XprateCommand.java @@ -13,7 +13,7 @@ import com.gmail.nossr50.util.Misc; public class XprateCommand implements CommandExecutor { private final mcMMO plugin; - private static int oldRate = Config.getInstance().xpGainMultiplier; + private static double oldRate = Config.getInstance().xpGainMultiplier; private static boolean xpEvent = false; public XprateCommand (mcMMO plugin) { diff --git a/src/main/java/com/gmail/nossr50/config/Config.java b/src/main/java/com/gmail/nossr50/config/Config.java index dd26c1b66..fbd540c80 100644 --- a/src/main/java/com/gmail/nossr50/config/Config.java +++ b/src/main/java/com/gmail/nossr50/config/Config.java @@ -7,7 +7,7 @@ import org.bukkit.configuration.ConfigurationSection; public class Config extends ConfigLoader { private static Config instance; - public int xpGainMultiplier = 1; + public double xpGainMultiplier = 1; private Config() { super("config.yml"); @@ -343,7 +343,7 @@ public class Config extends ConfigLoader { /* General Settings */ public boolean getExperienceGainsMobspawnersEnabled() { return config.getBoolean("Experience.Gains.Mobspawners.Enabled", false); } public boolean getExperienceGainsPlayerVersusPlayerEnabled() { return config.getBoolean("Experience.PVP.Rewards", true); } - public int getExperienceGainsGlobalMultiplier() { return config.getInt("Experience.Gains.Multiplier.Global", 1); } + public double getExperienceGainsGlobalMultiplier() { return config.getDouble("Experience.Gains.Multiplier.Global", 1.0); } /* Combat XP Multipliers */ public double getPlayerVersusPlayerXP() { return config.getDouble("Experience.Gains.Multiplier.PVP", 1.0); } diff --git a/src/main/java/com/gmail/nossr50/datatypes/McMMOPlayer.java b/src/main/java/com/gmail/nossr50/datatypes/McMMOPlayer.java index 7cf3d5051..9fa35c3c6 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/McMMOPlayer.java +++ b/src/main/java/com/gmail/nossr50/datatypes/McMMOPlayer.java @@ -108,7 +108,7 @@ public class McMMOPlayer { * @param newValue The amount of XP to add */ public void addXPOverrideBonus(SkillType skillType, int xp) { - int modifiedXp = xp * Config.getInstance().xpGainMultiplier; + int modifiedXp = (int)Math.floor(xp * Config.getInstance().xpGainMultiplier); addXPOverride(skillType, modifiedXp); } @@ -129,7 +129,7 @@ public class McMMOPlayer { bonusModifier = calculatePartyXPModifier(skillType); } - int xp = (int) (newValue / skillType.getXpModifier()) * Config.getInstance().xpGainMultiplier; + int xp = (int)Math.floor((newValue / skillType.getXpModifier()) * Config.getInstance().xpGainMultiplier); if (bonusModifier > 0) { if (bonusModifier >= 2) {