From 823f89707dc6ffdc016bda490faa86f0e19afd80 Mon Sep 17 00:00:00 2001 From: Zrips Date: Thu, 2 Apr 2020 16:24:39 +0300 Subject: [PATCH] Fixing broken sign updates --- src/main/java/com/gamingmesh/jobs/Signs/SignUtil.java | 7 +++++-- src/main/java/com/gamingmesh/jobs/Signs/jobsSign.java | 8 ++++++-- src/main/java/com/gamingmesh/jobs/container/Job.java | 2 ++ src/main/java/com/gamingmesh/jobs/dao/JobsDAO.java | 4 ++-- .../java/com/gamingmesh/jobs/listeners/JobsListener.java | 3 +-- 5 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/gamingmesh/jobs/Signs/SignUtil.java b/src/main/java/com/gamingmesh/jobs/Signs/SignUtil.java index 72275be0..d102e846 100644 --- a/src/main/java/com/gamingmesh/jobs/Signs/SignUtil.java +++ b/src/main/java/com/gamingmesh/jobs/Signs/SignUtil.java @@ -22,6 +22,7 @@ import com.gamingmesh.jobs.CMILib.ConfigReader; import com.gamingmesh.jobs.CMILib.VersionChecker.Version; import com.gamingmesh.jobs.container.Job; import com.gamingmesh.jobs.container.TopList; +import com.gamingmesh.jobs.stuff.Debug; public class SignUtil { @@ -160,6 +161,8 @@ public class SignUtil { public void updateAllSign(Job job) { for (SignTopType types : SignTopType.values()) { + if (types == SignTopType.questtoplist) + continue; SignUpdate(job, types); } } @@ -320,8 +323,8 @@ public class SignUtil { "[job]", jobname); } - @SuppressWarnings("deprecation") - public boolean UpdateHead(final Sign sign, final String Playername, int timelapse) { + @SuppressWarnings("deprecation") + public boolean UpdateHead(final Sign sign, final String Playername, int timelapse) { if (Playername == null) return false; diff --git a/src/main/java/com/gamingmesh/jobs/Signs/jobsSign.java b/src/main/java/com/gamingmesh/jobs/Signs/jobsSign.java index 61f17972..e084e2ca 100644 --- a/src/main/java/com/gamingmesh/jobs/Signs/jobsSign.java +++ b/src/main/java/com/gamingmesh/jobs/Signs/jobsSign.java @@ -146,10 +146,14 @@ public class jobsSign { } public String getIdentifier() { - return this.jobName != null ? this.jobName : this.getType().toString(); + if (this.getType() != SignTopType.toplist) + return this.getType().toString(); + return this.jobName != null ? this.jobName + ":" + this.getType().toString() : this.getType().toString(); } public static String getIdentifier(Job job, SignTopType type) { - return job != null ? job.getName() : (type == null ? SignTopType.toplist : type).toString(); + if (type != SignTopType.toplist) + return type.toString(); + return job != null ? job.getName() + ":" + type.toString() : type.toString(); } } diff --git a/src/main/java/com/gamingmesh/jobs/container/Job.java b/src/main/java/com/gamingmesh/jobs/container/Job.java index e837eb1e..4322cffd 100644 --- a/src/main/java/com/gamingmesh/jobs/container/Job.java +++ b/src/main/java/com/gamingmesh/jobs/container/Job.java @@ -21,6 +21,7 @@ package com.gamingmesh.jobs.container; import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.resources.jfep.Parser; import com.gamingmesh.jobs.stuff.ChatColor; +import com.gamingmesh.jobs.stuff.Debug; import org.bukkit.block.Block; import org.bukkit.command.CommandSender; @@ -232,6 +233,7 @@ public class Job { return info; } } + for (JobInfo info : getJobInfo(action.getType())) { if (info.getName().equalsIgnoreCase(action.getName())) { if (!info.isInLevelRange(level)) diff --git a/src/main/java/com/gamingmesh/jobs/dao/JobsDAO.java b/src/main/java/com/gamingmesh/jobs/dao/JobsDAO.java index ee448b3d..18db6475 100644 --- a/src/main/java/com/gamingmesh/jobs/dao/JobsDAO.java +++ b/src/main/java/com/gamingmesh/jobs/dao/JobsDAO.java @@ -36,6 +36,7 @@ import com.gamingmesh.jobs.container.PlayerPoints; import com.gamingmesh.jobs.container.TopList; import com.gamingmesh.jobs.dao.JobsManager.DataBaseType; import com.gamingmesh.jobs.economy.PaymentData; +import com.gamingmesh.jobs.stuff.Debug; import com.gamingmesh.jobs.stuff.TimeManage; import com.gamingmesh.jobs.stuff.Util; @@ -625,7 +626,7 @@ public abstract class JobsDAO { } else { Job job = Jobs.getJob(jobId); if (job != null) - jobs.add(new JobsDAOData(job.getName(), res.getInt(JobsTableFields.level.getCollumn()), res.getDouble(JobsTableFields.experience.getCollumn()))); + jobs.add(new JobsDAOData(job.getName(), res.getInt(JobsTableFields.level.getCollumn()), res.getDouble(JobsTableFields.experience.getCollumn()))); } } } catch (SQLException e) { @@ -2549,7 +2550,6 @@ public abstract class JobsDAO { Job job = Jobs.getJob(jobsname); if (job == null) return jobs; - PreparedStatement prest = null; ResultSet res = null; diff --git a/src/main/java/com/gamingmesh/jobs/listeners/JobsListener.java b/src/main/java/com/gamingmesh/jobs/listeners/JobsListener.java index 816a5cbd..b02630fa 100644 --- a/src/main/java/com/gamingmesh/jobs/listeners/JobsListener.java +++ b/src/main/java/com/gamingmesh/jobs/listeners/JobsListener.java @@ -336,7 +336,7 @@ public class JobsListener implements Listener { String jobname = ChatColor.stripColor(event.getLine(2)).toLowerCase(); final Job job = Jobs.getJob(jobname); - if ((type == SignTopType.toplist || type == SignTopType.questtoplist) && job == null) { + if (type == SignTopType.toplist && job == null) { player.sendMessage(Jobs.getLanguage().getMessage("command.top.error.nojob")); return; } @@ -430,7 +430,6 @@ public class JobsListener implements Listener { JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(event.getPlayer()); String honorific = jPlayer != null ? jPlayer.getDisplayHonorific() : ""; - Debug.D(honorific); if (honorific.equalsIgnoreCase(" ")) honorific = "";