diff --git a/src/main/java/com/gamingmesh/jobs/listeners/JobsListener.java b/src/main/java/com/gamingmesh/jobs/listeners/JobsListener.java index 7b7da0bd..f3c890b0 100644 --- a/src/main/java/com/gamingmesh/jobs/listeners/JobsListener.java +++ b/src/main/java/com/gamingmesh/jobs/listeners/JobsListener.java @@ -111,10 +111,10 @@ public class JobsListener implements Listener { return; Bukkit.getServer().getScheduler().runTask(plugin, new Runnable() { - @Override - public void run() { - player.performCommand(msg + event.getMessage()); - } + @Override + public void run() { + player.performCommand(msg + event.getMessage()); + } }); event.setCancelled(true); } @@ -575,11 +575,12 @@ public class JobsListener implements Listener { String format = event.getFormat(); // check if the player is in the job - for (Job job : Jobs.getJobs()) { + if (jPlayer != null) + for (Job job : Jobs.getJobs()) { if (!jPlayer.isInJob(job)) - format = format.replace("%1$s", ""); + format = format.replace("%1$s", ""); return; - } + } format = format.replace("%1$s", honorific + "%1$s"); event.setFormat(format); @@ -598,11 +599,12 @@ public class JobsListener implements Listener { honorific = ""; String format = event.getFormat(); // check if the player is in the job - for (Job job : Jobs.getJobs()) { + if (jPlayer != null) + for (Job job : Jobs.getJobs()) { if (!jPlayer.isInJob(job)) - format = format.replace("{jobs}", ""); + format = format.replace("{jobs}", ""); return; - } + } if (!format.contains("{jobs}")) return; format = format.replace("{jobs}", honorific); @@ -622,11 +624,12 @@ public class JobsListener implements Listener { honorific = ""; String format = event.getFormat(); // check if the player is in the job - for (Job job : Jobs.getJobs()) { + if (jPlayer != null) + for (Job job : Jobs.getJobs()) { if (!jPlayer.isInJob(job)) - format = format.replace("{jobs}", ""); + format = format.replace("{jobs}", ""); return; - } + } if (!format.contains("{jobs}")) return; format = format.replace("{jobs}", honorific);