1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-12-01 23:13:48 +01:00

Finishing the exp saving in double format

This commit is contained in:
montlikadani 2020-01-28 18:15:51 +01:00
parent 0d684ea41c
commit a521ac7b5a
3 changed files with 7 additions and 5 deletions

View File

@ -457,7 +457,7 @@ public class JobsCommands implements CommandExecutor {
*/
public String jobStatsMessageArchive(JobsPlayer jPlayer, JobProgression jobProg) {
int level = jPlayer.getLevelAfterRejoin(jobProg);
int exp = jPlayer.getExpAfterRejoin(jobProg, jPlayer.getLevelAfterRejoin(jobProg));
double exp = jPlayer.getExpAfterRejoin(jobProg, jPlayer.getLevelAfterRejoin(jobProg));
String message = Jobs.getLanguage().getMessage("command.stats.output",
"%joblevel%", level,
"%jobname%", jobProg.getJob().getChatColor() + jobProg.getJob().getName(),

View File

@ -440,7 +440,7 @@ public class JobsPlayer {
// synchronized (saveLock) {
if (!isInJob(job)) {
int level = 1;
int exp = 0;
double exp = 0;
JobProgression archived = getArchivedJobProgression(job);
if (archived != null) {
@ -486,9 +486,10 @@ public class JobsPlayer {
return level;
}
public int getExpAfterRejoin(JobProgression jp, int level) {
public double getExpAfterRejoin(JobProgression jp, int level) {
if (jp == null)
return 1;
Integer max = jp.getMaxExperience(level);
Double exp = jp.getExperience();
if (exp > max)
@ -503,7 +504,8 @@ public class JobsPlayer {
} else
exp = (exp - (exp * (Jobs.getGCManager().levelLossPercentage / 100.0)));
}
return exp.intValue();
return exp.doubleValue();
}
/**

View File

@ -148,7 +148,7 @@ public abstract class JobsDAO {
public enum JobsTableFields implements JobsTableInterface {
userid("int"),
job("text"),
experience("int"),
experience("double"),
level("int"),
jobid("int");