mirror of
https://github.com/Zrips/Jobs.git
synced 2024-11-29 14:05:25 +01:00
Catch exception for boss bar feature to avoid failing payments
This commit is contained in:
parent
c935900eed
commit
7feced2529
@ -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);
|
||||
|
@ -108,16 +108,22 @@ 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
|
||||
|
Loading…
Reference in New Issue
Block a user