1
0
mirror of https://github.com/Zrips/Jobs.git synced 2025-02-08 08:21:41 +01:00

better way in showing gained exp in bossbar

This commit is contained in:
Zrips 2020-05-06 18:32:59 +03:00
parent d056dc8ecf
commit 70814f998b
2 changed files with 6 additions and 10 deletions

View File

@ -39,9 +39,8 @@ public class BossBarManager {
for (String one : temp) {
for (JobProgression oneJob : player.getJobProgression()) {
if (one.equalsIgnoreCase(oneJob.getJob().getName())) {
Double lastExp = oneJob.getLastExperience();
ShowJobProgression(player, oneJob, oneJob.getExperience() - lastExp);
ShowJobProgression(player, oneJob, oneJob.getLastExperience());
oneJob.setLastExperience(0D);
}
}
}
@ -74,7 +73,7 @@ public class BossBarManager {
NumberFormat formatter = new DecimalFormat("#0.00");
String gain = "";
if (expGain > 0) {
if (expGain != 0) {
expGain = (int) (expGain * 100) / 100D;
gain = expGain > 0 ? "+" + expGain : "" + expGain;
gain = Jobs.getLanguage().getMessage("command.stats.bossBarGain", "%gain%", gain);

View File

@ -92,6 +92,7 @@ public class JobProgression {
public boolean addExperience(double experience) {
jPlayer.setSaved(false);
this.experience += experience;
this.lastExperience = getLastExperience() + experience;
return checkLevelUp();
}
@ -114,6 +115,7 @@ public class JobProgression {
public boolean takeExperience(double experience) {
jPlayer.setSaved(false);
this.experience -= experience;
this.lastExperience = getLastExperience() + experience;
return checkLevelUp();
}
@ -189,9 +191,6 @@ public class JobProgression {
if (experience > maxExperience)
experience = maxExperience;
if (lastExperience == null)
lastExperience = experience;
return ret;
}
@ -211,8 +210,6 @@ public class JobProgression {
ret = true;
reloadMaxExperience();
}
if (lastExperience == null)
lastExperience = experience;
return ret;
}
@ -254,7 +251,7 @@ public class JobProgression {
}
public Double getLastExperience() {
return lastExperience == null ? experience : lastExperience;
return lastExperience == null ? 0D : lastExperience;
}
public void setLastExperience(Double lastExperience) {