1
0
mirror of https://github.com/Zrips/Jobs.git synced 2025-01-08 17:28:15 +01:00

Fixing broken sign updates

This commit is contained in:
Zrips 2020-04-02 16:24:39 +03:00
parent 891bca964a
commit 823f89707d
5 changed files with 16 additions and 8 deletions

View File

@ -22,6 +22,7 @@ import com.gamingmesh.jobs.CMILib.ConfigReader;
import com.gamingmesh.jobs.CMILib.VersionChecker.Version; import com.gamingmesh.jobs.CMILib.VersionChecker.Version;
import com.gamingmesh.jobs.container.Job; import com.gamingmesh.jobs.container.Job;
import com.gamingmesh.jobs.container.TopList; import com.gamingmesh.jobs.container.TopList;
import com.gamingmesh.jobs.stuff.Debug;
public class SignUtil { public class SignUtil {
@ -160,6 +161,8 @@ public class SignUtil {
public void updateAllSign(Job job) { public void updateAllSign(Job job) {
for (SignTopType types : SignTopType.values()) { for (SignTopType types : SignTopType.values()) {
if (types == SignTopType.questtoplist)
continue;
SignUpdate(job, types); SignUpdate(job, types);
} }
} }
@ -320,8 +323,8 @@ public class SignUtil {
"[job]", jobname); "[job]", jobname);
} }
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public boolean UpdateHead(final Sign sign, final String Playername, int timelapse) { public boolean UpdateHead(final Sign sign, final String Playername, int timelapse) {
if (Playername == null) if (Playername == null)
return false; return false;

View File

@ -146,10 +146,14 @@ public class jobsSign {
} }
public String getIdentifier() { 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) { 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();
} }
} }

View File

@ -21,6 +21,7 @@ package com.gamingmesh.jobs.container;
import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.resources.jfep.Parser; import com.gamingmesh.jobs.resources.jfep.Parser;
import com.gamingmesh.jobs.stuff.ChatColor; import com.gamingmesh.jobs.stuff.ChatColor;
import com.gamingmesh.jobs.stuff.Debug;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
@ -232,6 +233,7 @@ public class Job {
return info; return info;
} }
} }
for (JobInfo info : getJobInfo(action.getType())) { for (JobInfo info : getJobInfo(action.getType())) {
if (info.getName().equalsIgnoreCase(action.getName())) { if (info.getName().equalsIgnoreCase(action.getName())) {
if (!info.isInLevelRange(level)) if (!info.isInLevelRange(level))

View File

@ -36,6 +36,7 @@ import com.gamingmesh.jobs.container.PlayerPoints;
import com.gamingmesh.jobs.container.TopList; import com.gamingmesh.jobs.container.TopList;
import com.gamingmesh.jobs.dao.JobsManager.DataBaseType; import com.gamingmesh.jobs.dao.JobsManager.DataBaseType;
import com.gamingmesh.jobs.economy.PaymentData; import com.gamingmesh.jobs.economy.PaymentData;
import com.gamingmesh.jobs.stuff.Debug;
import com.gamingmesh.jobs.stuff.TimeManage; import com.gamingmesh.jobs.stuff.TimeManage;
import com.gamingmesh.jobs.stuff.Util; import com.gamingmesh.jobs.stuff.Util;
@ -625,7 +626,7 @@ public abstract class JobsDAO {
} else { } else {
Job job = Jobs.getJob(jobId); Job job = Jobs.getJob(jobId);
if (job != null) 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) { } catch (SQLException e) {
@ -2549,7 +2550,6 @@ public abstract class JobsDAO {
Job job = Jobs.getJob(jobsname); Job job = Jobs.getJob(jobsname);
if (job == null) if (job == null)
return jobs; return jobs;
PreparedStatement prest = null; PreparedStatement prest = null;
ResultSet res = null; ResultSet res = null;

View File

@ -336,7 +336,7 @@ public class JobsListener implements Listener {
String jobname = ChatColor.stripColor(event.getLine(2)).toLowerCase(); String jobname = ChatColor.stripColor(event.getLine(2)).toLowerCase();
final Job job = Jobs.getJob(jobname); 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")); player.sendMessage(Jobs.getLanguage().getMessage("command.top.error.nojob"));
return; return;
} }
@ -430,7 +430,6 @@ public class JobsListener implements Listener {
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(event.getPlayer()); JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(event.getPlayer());
String honorific = jPlayer != null ? jPlayer.getDisplayHonorific() : ""; String honorific = jPlayer != null ? jPlayer.getDisplayHonorific() : "";
Debug.D(honorific);
if (honorific.equalsIgnoreCase(" ")) if (honorific.equalsIgnoreCase(" "))
honorific = ""; honorific = "";