1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-11-29 05:55:27 +01:00

Fix for unnecessary player data saving on server startup

This commit is contained in:
Zrips 2024-06-11 14:51:53 +03:00
parent 339ec5be3e
commit 42e3043062
5 changed files with 103 additions and 92 deletions

View File

@ -115,6 +115,7 @@ import com.gamingmesh.jobs.tasks.DatabaseSaveThread;
import net.Zrips.CMILib.ActionBar.CMIActionBar;
import net.Zrips.CMILib.Items.CMIMaterial;
import net.Zrips.CMILib.Locale.LC;
import net.Zrips.CMILib.Logs.CMIDebug;
import net.Zrips.CMILib.Messages.CMIMessages;
import net.Zrips.CMILib.RawMessages.RawMessage;
import net.Zrips.CMILib.Version.Version;
@ -1102,8 +1103,9 @@ public final class Jobs extends JavaPlugin {
if (info.getType() == ActionType.BREAK && block != null)
getBpManager().remove(block);
if (pointAmount != 0D)
if (pointAmount != 0D) {
jPlayer.setSaved(false);
}
Map<CurrencyType, Double> payments = new HashMap<>();
if (income != 0D)

View File

@ -440,11 +440,11 @@ public class PlayerManager {
}
jPlayer.progression.add(new JobProgression(job, jPlayer, jobdata.getLevel(), jobdata.getExperience()));
}
}
jPlayer.reloadMaxExperience();
jPlayer.reloadLimits();
}
}
}
if (points != null)
jPlayer.setPoints(points);

View File

@ -25,6 +25,7 @@ import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.stuff.Util;
import net.Zrips.CMILib.Container.CMINumber;
import net.Zrips.CMILib.Logs.CMIDebug;
import net.Zrips.CMILib.Time.CMITimeManager;
public class JobProgression {
@ -221,8 +222,7 @@ public class JobProgression {
if (
// Don't level down at 1
level <= 1 ||
!Jobs.getGCManager().AllowDelevel
) {
!Jobs.getGCManager().AllowDelevel) {
experience = 0;
break;
@ -233,6 +233,7 @@ public class JobProgression {
ret = true;
reloadMaxExperience();
jPlayer.reloadLimits();
}
return ret;

View File

@ -46,6 +46,7 @@ import net.Zrips.CMILib.Colors.CMIChatColor;
import net.Zrips.CMILib.Container.CMINumber;
import net.Zrips.CMILib.Equations.Parser;
import net.Zrips.CMILib.Items.CMIMaterial;
import net.Zrips.CMILib.Logs.CMIDebug;
import net.Zrips.CMILib.Time.CMITimeManager;
import net.Zrips.CMILib.Version.Schedulers.CMIScheduler;
import net.Zrips.CMILib.Version.Schedulers.CMITask;
@ -447,6 +448,7 @@ public class JobsPlayer {
}
public void reloadLimits() {
for (CurrencyType type : CurrencyType.values()) {
reload(type);
}
@ -478,6 +480,7 @@ public class JobsPlayer {
public int getJobCount() {
return getJobCount(true);
}
public int getJobCount(boolean includeIgnoredMaxJobs) {
if (includeIgnoredMaxJobs)
@ -997,6 +1000,8 @@ public class JobsPlayer {
public void setSaved(boolean isSaved) {
if (!isSaved && !isOnline())
Jobs.getPlayerManager().addPlayer(this);
if (!Jobs.fullyLoaded)
return;
this.isSaved = isSaved;
}
@ -1376,6 +1381,7 @@ public class JobsPlayer {
public void addDoneQuest(final Job job) {
doneQuests++;
setSaved(false);
if (questSignUpdateShed == null) {

View File

@ -11,6 +11,8 @@ import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.actions.EnchantActionInfo;
import com.gamingmesh.jobs.stuff.Util;
import net.Zrips.CMILib.Logs.CMIDebug;
public class QuestProgression {
private Quest quest;