diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/join.java b/src/main/java/com/gamingmesh/jobs/commands/list/join.java index 6d22d360..744824cd 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/join.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/join.java @@ -33,55 +33,53 @@ public class join implements Cmd { } Player pSender = (Player) sender; - JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(pSender); - - String jobName = args[0]; - Job job = Jobs.getJob(jobName); + Job job = Jobs.getJob(args[0]); if (job == null) { // job does not exist - sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job")); + pSender.sendMessage(Jobs.getLanguage().getMessage("general.error.job")); return true; } if (!Jobs.getCommandManager().hasJobPermission(pSender, job)) { // you do not have permission to join the job - sender.sendMessage(Jobs.getLanguage().getMessage("general.error.permission")); + pSender.sendMessage(Jobs.getLanguage().getMessage("general.error.permission")); return true; } + JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(pSender); if (jPlayer.isInJob(job)) { // already in job message String message = Jobs.getLanguage().getMessage("command.join.error.alreadyin"); message = message.replace("%jobname%", job.getChatColor() + job.getName()); - sender.sendMessage(message); + pSender.sendMessage(message); return true; } if (job.getMaxSlots() != null && Jobs.getUsedSlots(job) >= job.getMaxSlots()) { String message = Jobs.getLanguage().getMessage("command.join.error.fullslots"); message = message.replace("%jobname%", job.getChatColor() + job.getName()); - sender.sendMessage(message); + pSender.sendMessage(message); return true; } int confMaxJobs = Jobs.getGCManager().getMaxJobs(); short PlayerMaxJobs = (short) jPlayer.getJobProgression().size(); if (confMaxJobs > 0 && PlayerMaxJobs >= confMaxJobs && !Jobs.getPlayerManager().getJobsLimit(jPlayer, PlayerMaxJobs)) { - sender.sendMessage(Jobs.getLanguage().getMessage("command.join.error.maxjobs")); + pSender.sendMessage(Jobs.getLanguage().getMessage("command.join.error.maxjobs")); return true; } if (args.length == 2 && args[1].equalsIgnoreCase("-needConfirmation")) { RawMessage rm = new RawMessage(); rm.add(Jobs.getLanguage().getMessage("command.join.confirm", "[jobname]", job.getName()), Jobs.getLanguage().getMessage("command.join.confirm", "[jobname]", job.getName()), "jobs join " + job.getName()); - rm.show(sender); + rm.show(pSender); return true; } JobProgression ajp = jPlayer.getArchivedJobProgression(job); if (ajp != null) { if (!ajp.canRejoin()) { - sender.sendMessage(Jobs.getLanguage().getMessage("command.join.error.rejoin", "[time]", ajp.getRejoinTimeMessage())); + pSender.sendMessage(Jobs.getLanguage().getMessage("command.join.error.rejoin", "[time]", ajp.getRejoinTimeMessage())); return true; } } @@ -90,7 +88,7 @@ public class join implements Cmd { String message = Jobs.getLanguage().getMessage("command.join.success"); message = message.replace("%jobname%", job.getChatColor() + job.getName()); - sender.sendMessage(message); + pSender.sendMessage(message); return true; } } diff --git a/src/main/java/com/gamingmesh/jobs/config/ConfigManager.java b/src/main/java/com/gamingmesh/jobs/config/ConfigManager.java index 0a4ed581..bddeb834 100644 --- a/src/main/java/com/gamingmesh/jobs/config/ConfigManager.java +++ b/src/main/java/com/gamingmesh/jobs/config/ConfigManager.java @@ -342,9 +342,6 @@ public class ConfigManager { meta = "1"; break; default: - type = CMIEntityType.getByName(myKey.toUpperCase()).name(); - id = CMIEntityType.getByName(myKey.toUpperCase()).getId(); - meta = "1"; break; } } @@ -400,8 +397,9 @@ public class ConfigManager { InputStreamReader s = new InputStreamReader(new FileInputStream(f), "UTF-8"); ArrayList jobs = new ArrayList<>(); - Jobs.setJobs(jobs); + Jobs.setNoneJob(null); + if (!f.exists()) { try { f.createNewFile(); @@ -1129,9 +1127,6 @@ public class ConfigManager { meta = "1"; break; default: - type = CMIEntityType.getByName(myKey.toUpperCase()).name(); - id = CMIEntityType.getByName(myKey.toUpperCase()).getId(); - meta = "1"; break; } } @@ -1211,6 +1206,8 @@ public class ConfigManager { Jobs.setNoneJob(job); else jobs.add(job); + + Jobs.setJobs(jobs); } Jobs.consoleMsg("&e[Jobs] Loaded " + Jobs.getJobs().size() + " jobs!"); diff --git a/src/main/java/com/gamingmesh/jobs/config/LanguageManager.java b/src/main/java/com/gamingmesh/jobs/config/LanguageManager.java index 0a0f5b49..31269be2 100644 --- a/src/main/java/com/gamingmesh/jobs/config/LanguageManager.java +++ b/src/main/java/com/gamingmesh/jobs/config/LanguageManager.java @@ -1,6 +1,7 @@ package com.gamingmesh.jobs.config; import java.io.File; +import java.io.IOException; import java.net.URISyntaxException; import java.net.URL; import java.net.URLClassLoader; @@ -62,7 +63,7 @@ public class LanguageManager { if (jarFile != null) try { jarFile.close(); - } catch (Throwable e) { + } catch (IOException e) { } } return listOfCommands; @@ -90,8 +91,7 @@ public class LanguageManager { //Up to here. String ls = Jobs.getGCManager().localeString; - - if (ls == null || ls.equals("")) + if (ls.equals("")) ls = "en"; languages.clear(); diff --git a/src/main/java/com/gamingmesh/jobs/config/NameTranslatorManager.java b/src/main/java/com/gamingmesh/jobs/config/NameTranslatorManager.java index f3edf549..a2a94355 100644 --- a/src/main/java/com/gamingmesh/jobs/config/NameTranslatorManager.java +++ b/src/main/java/com/gamingmesh/jobs/config/NameTranslatorManager.java @@ -174,8 +174,7 @@ public class NameTranslatorManager { synchronized void load() { String ls = Jobs.getGCManager().localeString; - - if (ls == null || ls.equals("")) + if (ls.equals("")) return; File file = new File(Jobs.getFolder(), "TranslatableWords.yml");