diff --git a/com/gamingmesh/jobs/Jobs.java b/com/gamingmesh/jobs/Jobs.java index 2b5d29dd..9a1a676a 100644 --- a/com/gamingmesh/jobs/Jobs.java +++ b/com/gamingmesh/jobs/Jobs.java @@ -922,11 +922,15 @@ public class Jobs { if (amount == 0D && pointAmount == 0D && expAmount == 0D) continue; - if (expAmount != 0D) - if (Jobs.getGCManager().BossBarEnabled && Jobs.getGCManager().BossBarShowOnEachAction) { - Jobs.getBBManager().ShowJobProgression(jPlayer, prog); - } else if (Jobs.getGCManager().BossBarEnabled && !Jobs.getGCManager().BossBarShowOnEachAction) - jPlayer.getUpdateBossBarFor().add(prog.getJob().getName()); + try { + if (expAmount != 0D) + if (Jobs.getGCManager().BossBarEnabled && Jobs.getGCManager().BossBarShowOnEachAction) { + Jobs.getBBManager().ShowJobProgression(jPlayer, prog); + } else if (Jobs.getGCManager().BossBarEnabled && !Jobs.getGCManager().BossBarShowOnEachAction) + jPlayer.getUpdateBossBarFor().add(prog.getJob().getName()); + } catch (Exception e) { + Bukkit.getConsoleSender().sendMessage("[Jobs] Some issues with boss bar feature accured, try disabling it to avoid it."); + } // JobsPayment event JobsExpGainEvent JobsExpGainEvent = new JobsExpGainEvent(jPlayer.getPlayer(), prog.getJob(), expAmount); diff --git a/com/gamingmesh/jobs/config/BossBarManager.java b/com/gamingmesh/jobs/config/BossBarManager.java index 8c707801..c8bf8114 100644 --- a/com/gamingmesh/jobs/config/BossBarManager.java +++ b/com/gamingmesh/jobs/config/BossBarManager.java @@ -108,17 +108,23 @@ public class BossBarManager { bar.setTitle(message); double percentage = jobProg.getExperience() / jobProg.getMaxExperience(); - bar.setProgress(percentage); - if (OldOne == null) { - Player target = Bukkit.getPlayer(player.getPlayer().getUniqueId()); - if (target == null) - return; - bar.addPlayer(target); - OldOne = new BossBarInfo(player.getUserName(), jobProg.getJob().getName(), bar); - player.getBossBarInfo().add(OldOne); + try { + bar.setProgress(percentage); + if (OldOne == null) { + Player target = Bukkit.getPlayer(player.getPlayer().getUniqueId()); + if (target == null) + return; + bar.addPlayer(target); + OldOne = new BossBarInfo(player.getUserName(), jobProg.getJob().getName(), bar); + player.getBossBarInfo().add(OldOne); + } + bar.setVisible(true); + } catch (NoSuchMethodError e) { } - bar.setVisible(true); + if (OldOne == null) + return; + OldOne.setId(Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { @Override public void run() {