Using doubles in most places again to avoid precision loss

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

View File

@@ -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;
}

View File

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

View File

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

View File

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

View File

@@ -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;
}