mirror of
https://github.com/Zrips/Jobs.git
synced 2024-11-26 04:25:15 +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)
|
if (amount == 0D && pointAmount == 0D && expAmount == 0D)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (expAmount != 0D)
|
try {
|
||||||
if (Jobs.getGCManager().BossBarEnabled && Jobs.getGCManager().BossBarShowOnEachAction) {
|
if (expAmount != 0D)
|
||||||
Jobs.getBBManager().ShowJobProgression(jPlayer, prog);
|
if (Jobs.getGCManager().BossBarEnabled && Jobs.getGCManager().BossBarShowOnEachAction) {
|
||||||
} else if (Jobs.getGCManager().BossBarEnabled && !Jobs.getGCManager().BossBarShowOnEachAction)
|
Jobs.getBBManager().ShowJobProgression(jPlayer, prog);
|
||||||
jPlayer.getUpdateBossBarFor().add(prog.getJob().getName());
|
} 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
|
// JobsPayment event
|
||||||
JobsExpGainEvent JobsExpGainEvent = new JobsExpGainEvent(jPlayer.getPlayer(), prog.getJob(), expAmount);
|
JobsExpGainEvent JobsExpGainEvent = new JobsExpGainEvent(jPlayer.getPlayer(), prog.getJob(), expAmount);
|
||||||
|
@ -108,16 +108,22 @@ public class BossBarManager {
|
|||||||
bar.setTitle(message);
|
bar.setTitle(message);
|
||||||
|
|
||||||
double percentage = jobProg.getExperience() / jobProg.getMaxExperience();
|
double percentage = jobProg.getExperience() / jobProg.getMaxExperience();
|
||||||
bar.setProgress(percentage);
|
try {
|
||||||
if (OldOne == null) {
|
bar.setProgress(percentage);
|
||||||
Player target = Bukkit.getPlayer(player.getPlayer().getUniqueId());
|
if (OldOne == null) {
|
||||||
if (target == null)
|
Player target = Bukkit.getPlayer(player.getPlayer().getUniqueId());
|
||||||
return;
|
if (target == null)
|
||||||
bar.addPlayer(target);
|
return;
|
||||||
OldOne = new BossBarInfo(player.getUserName(), jobProg.getJob().getName(), bar);
|
bar.addPlayer(target);
|
||||||
player.getBossBarInfo().add(OldOne);
|
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() {
|
OldOne.setId(Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user