1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-12-02 07:23:29 +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) { public String jobStatsMessageArchive(JobsPlayer jPlayer, JobProgression jobProg) {
int level = jPlayer.getLevelAfterRejoin(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", String message = Jobs.getLanguage().getMessage("command.stats.output",
"%joblevel%", level, "%joblevel%", level,
"%jobname%", jobProg.getJob().getChatColor() + jobProg.getJob().getName(), "%jobname%", jobProg.getJob().getChatColor() + jobProg.getJob().getName(),

View File

@ -440,7 +440,7 @@ public class JobsPlayer {
// synchronized (saveLock) { // synchronized (saveLock) {
if (!isInJob(job)) { if (!isInJob(job)) {
int level = 1; int level = 1;
int exp = 0; double exp = 0;
JobProgression archived = getArchivedJobProgression(job); JobProgression archived = getArchivedJobProgression(job);
if (archived != null) { if (archived != null) {
@ -486,9 +486,10 @@ public class JobsPlayer {
return level; return level;
} }
public int getExpAfterRejoin(JobProgression jp, int level) { public double getExpAfterRejoin(JobProgression jp, int level) {
if (jp == null) if (jp == null)
return 1; return 1;
Integer max = jp.getMaxExperience(level); Integer max = jp.getMaxExperience(level);
Double exp = jp.getExperience(); Double exp = jp.getExperience();
if (exp > max) if (exp > max)
@ -503,7 +504,8 @@ public class JobsPlayer {
} else } else
exp = (exp - (exp * (Jobs.getGCManager().levelLossPercentage / 100.0))); 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 { public enum JobsTableFields implements JobsTableInterface {
userid("int"), userid("int"),
job("text"), job("text"),
experience("int"), experience("double"),
level("int"), level("int"),
jobid("int"); jobid("int");