1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-11-26 04:25:15 +01:00

Remove bossbar on server shutdown

This commit is contained in:
montlikadani 2020-01-26 13:41:34 +01:00
parent e6a128d876
commit 066c0dd2b6
5 changed files with 15 additions and 19 deletions

View File

@ -692,14 +692,13 @@ public class Jobs extends JavaPlugin {
* Executes clean shutdown * Executes clean shutdown
*/ */
public static void shutdown() { public static void shutdown() {
//Bukkit.getOnlinePlayers().forEach(p -> getPlayerManager().getJobsPlayer(p).clearBossMaps());
if (saveTask != null) if (saveTask != null)
saveTask.shutdown(); saveTask.shutdown();
if (paymentThread != null) if (paymentThread != null)
paymentThread.shutdown(); paymentThread.shutdown();
getPlayerManager().removePlayerAdditions();
getPlayerManager().saveAll(); getPlayerManager().saveAll();
if (dao != null) { if (dao != null) {

View File

@ -222,6 +222,13 @@ public class PlayerManager {
} }
} }
public void removePlayerAdditions() {
for (JobsPlayer jPlayer : players.values()) {
jPlayer.clearBossMaps();
jPlayer.clearUpdateBossBarFor();
}
}
/** /**
* Save all the information of all of the players in the game * Save all the information of all of the players in the game
*/ */

View File

@ -784,11 +784,8 @@ public class ConfigManager {
GUIitem = CMIMaterial.PLAYER_HEAD.newItemStack(); GUIitem = CMIMaterial.PLAYER_HEAD.newItemStack();
SkullMeta skullMeta = (SkullMeta) GUIitem.getItemMeta(); SkullMeta skullMeta = (SkullMeta) GUIitem.getItemMeta();
if (skullOwner.length() == 36) { if (skullOwner.length() == 36) {
try { OfflinePlayer offPlayer = Bukkit.getOfflinePlayer(UUID.fromString(skullOwner));
OfflinePlayer offPlayer = Bukkit.getOfflinePlayer(UUID.fromString(skullOwner)); skullMeta.setOwner(offPlayer.getName());
skullMeta.setOwner(offPlayer.getName());
} catch (IllegalArgumentException e) {
}
} else } else
skullMeta.setOwner(skullOwner); skullMeta.setOwner(skullOwner);
GUIitem.setItemMeta(skullMeta); GUIitem.setItemMeta(skullMeta);
@ -810,11 +807,8 @@ public class ConfigManager {
GUIitem = CMIMaterial.PLAYER_HEAD.newItemStack(); GUIitem = CMIMaterial.PLAYER_HEAD.newItemStack();
SkullMeta skullMeta = (SkullMeta) GUIitem.getItemMeta(); SkullMeta skullMeta = (SkullMeta) GUIitem.getItemMeta();
if (skullOwner.length() == 36) { if (skullOwner.length() == 36) {
try { OfflinePlayer offPlayer = Bukkit.getOfflinePlayer(UUID.fromString(skullOwner));
OfflinePlayer offPlayer = Bukkit.getOfflinePlayer(UUID.fromString(skullOwner)); skullMeta.setOwner(offPlayer.getName());
skullMeta.setOwner(offPlayer.getName());
} catch (IllegalArgumentException e) {
}
} else } else
skullMeta.setOwner(skullOwner); skullMeta.setOwner(skullOwner);
GUIitem.setItemMeta(skullMeta); GUIitem.setItemMeta(skullMeta);

View File

@ -299,7 +299,7 @@ public class LanguageManager {
c.get("command.shop.info.currentPoints", "&eYou have: &6%currentpoints%"); c.get("command.shop.info.currentPoints", "&eYou have: &6%currentpoints%");
c.get("command.shop.info.price", "&ePrice: &6%price%"); c.get("command.shop.info.price", "&ePrice: &6%price%");
c.get("command.shop.info.reqJobs", "&eRequired jobs:"); c.get("command.shop.info.reqJobs", "&eRequired jobs:");
c.get("command.shop.info.reqJobsList", " &e%jobsname%&e: &e%level% lvl"); c.get("command.shop.info.reqJobsList", " &6%jobsname%&e: &e%level% lvl");
c.get("command.shop.info.reqTotalLevel", "&6Required total level: &e%totalLevel%"); c.get("command.shop.info.reqTotalLevel", "&6Required total level: &e%totalLevel%");
c.get("command.shop.info.reqJobsColor", "&4"); c.get("command.shop.info.reqJobsColor", "&4");
c.get("command.shop.info.reqJobsLevelColor", "&4"); c.get("command.shop.info.reqJobsLevelColor", "&4");

View File

@ -199,12 +199,8 @@ public class ShopManager {
if (item.isHeadOwner()) if (item.isHeadOwner())
skullMeta.setOwner(Jobs.getPlayerManager().getJobsPlayer(player).getName()); skullMeta.setOwner(Jobs.getPlayerManager().getJobsPlayer(player).getName());
else { else {
try { OfflinePlayer offPlayer = Bukkit.getOfflinePlayer(item.getCustomHead());
OfflinePlayer offPlayer = Bukkit.getOfflinePlayer(item.getCustomHead()); skullMeta.setOwner(offPlayer.getName());
skullMeta.setOwner(offPlayer.getName());
} catch (Exception e) {
e.printStackTrace();
}
} }
GUIitem.setItemMeta(skullMeta); GUIitem.setItemMeta(skullMeta);
} else } else