1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-11-25 20:16:13 +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
*/
public static void shutdown() {
//Bukkit.getOnlinePlayers().forEach(p -> getPlayerManager().getJobsPlayer(p).clearBossMaps());
if (saveTask != null)
saveTask.shutdown();
if (paymentThread != null)
paymentThread.shutdown();
getPlayerManager().removePlayerAdditions();
getPlayerManager().saveAll();
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
*/

View File

@ -784,11 +784,8 @@ public class ConfigManager {
GUIitem = CMIMaterial.PLAYER_HEAD.newItemStack();
SkullMeta skullMeta = (SkullMeta) GUIitem.getItemMeta();
if (skullOwner.length() == 36) {
try {
OfflinePlayer offPlayer = Bukkit.getOfflinePlayer(UUID.fromString(skullOwner));
skullMeta.setOwner(offPlayer.getName());
} catch (IllegalArgumentException e) {
}
OfflinePlayer offPlayer = Bukkit.getOfflinePlayer(UUID.fromString(skullOwner));
skullMeta.setOwner(offPlayer.getName());
} else
skullMeta.setOwner(skullOwner);
GUIitem.setItemMeta(skullMeta);
@ -810,11 +807,8 @@ public class ConfigManager {
GUIitem = CMIMaterial.PLAYER_HEAD.newItemStack();
SkullMeta skullMeta = (SkullMeta) GUIitem.getItemMeta();
if (skullOwner.length() == 36) {
try {
OfflinePlayer offPlayer = Bukkit.getOfflinePlayer(UUID.fromString(skullOwner));
skullMeta.setOwner(offPlayer.getName());
} catch (IllegalArgumentException e) {
}
OfflinePlayer offPlayer = Bukkit.getOfflinePlayer(UUID.fromString(skullOwner));
skullMeta.setOwner(offPlayer.getName());
} else
skullMeta.setOwner(skullOwner);
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.price", "&ePrice: &6%price%");
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.reqJobsColor", "&4");
c.get("command.shop.info.reqJobsLevelColor", "&4");

View File

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