1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-11-29 22:13:25 +01:00

Revert some things to prevent data losing

This commit is contained in:
montlikadani 2020-04-16 18:55:32 +02:00
parent 2113e3441c
commit 3fc2487bfd
2 changed files with 6 additions and 4 deletions

View File

@ -749,7 +749,7 @@ public class Jobs extends JavaPlugin {
ToggleBarHandling.load(); ToggleBarHandling.load();
usedSlots.clear(); usedSlots.clear();
for (Job job : jobs) { for (Job job : jobs) {
usedSlots.put(job, getDBManager().getDB().getSlotsTaken(job)); usedSlots.put(job, dao.getSlotsTaken(job));
} }
getPlayerManager().reload(); getPlayerManager().reload();
getPermissionHandler().registerPermissions(); getPermissionHandler().registerPermissions();
@ -764,7 +764,7 @@ public class Jobs extends JavaPlugin {
paymentThread = new BufferedPaymentThread(getGCManager().getEconomyBatchDelay()); paymentThread = new BufferedPaymentThread(getGCManager().getEconomyBatchDelay());
paymentThread.start(); paymentThread.start();
getDBManager().getDB().loadPlayerData(); dao.loadPlayerData();
// Schedule // Schedule
if (getGCManager().enableSchedule) { if (getGCManager().enableSchedule) {

View File

@ -650,7 +650,9 @@ public abstract class JobsDAO {
while (res.next()) { while (res.next()) {
int id = res.getInt(JobsTableFields.userid.getCollumn()); int id = res.getInt(JobsTableFields.userid.getCollumn());
String jobName = res.getString(JobsTableFields.job.getCollumn()); String jobName = res.getString(JobsTableFields.job.getCollumn());
List<JobsDAOData> ls = new ArrayList<>(); List<JobsDAOData> ls = map.get(id);
if (ls == null)
ls = new ArrayList<>();
int jobId = res.getInt(JobsTableFields.jobid.getCollumn()); int jobId = res.getInt(JobsTableFields.jobid.getCollumn());
if (jobId == 0) { if (jobId == 0) {
@ -662,7 +664,7 @@ public abstract class JobsDAO {
if (jobName == null || jobName.isEmpty()) if (jobName == null || jobName.isEmpty())
converted = false; converted = false;
Job job = Jobs.getJob(jobName); Job job = Jobs.getJob(jobId);
if (job != null) if (job != null)
ls.add(new JobsDAOData(job.getName(), res.getInt(JobsTableFields.level.getCollumn()), res.getDouble(JobsTableFields.experience.getCollumn()))); ls.add(new JobsDAOData(job.getName(), res.getInt(JobsTableFields.level.getCollumn()), res.getDouble(JobsTableFields.experience.getCollumn())));
} }