diff --git a/src/main/java/de/fanta/challenges/listeners/QuitJoinListener.java b/src/main/java/de/fanta/challenges/listeners/QuitJoinListener.java index 3358c8c..99afeb9 100644 --- a/src/main/java/de/fanta/challenges/listeners/QuitJoinListener.java +++ b/src/main/java/de/fanta/challenges/listeners/QuitJoinListener.java @@ -36,7 +36,8 @@ ChatUtil.sendNormalMessage(p, "Du bist im Vanish, niemand weiß, dass du in der Lobby bist."); return; } - Bukkit.broadcastMessage(Challenges.CHALLENGESPREFIX + " " + ChatUtil.BLUE + p.getName() + ChatUtil.GREEN + " hat die Lobby betreten! " + ChatColor.of("#E4E737") + "[" + (Bukkit.getServer().getOnlinePlayers().size() - plugin.getVanish().countVanishPlayers()) + "/" + Bukkit.getServer().getMaxPlayers() + "]"); + Bukkit.broadcastMessage( + Challenges.CHALLENGESPREFIX + " " + ChatUtil.BLUE + p.getName() + ChatUtil.GREEN + " hat die Lobby betreten! " + ChatColor.of("#E4E737") + "[" + (Bukkit.getServer().getOnlinePlayers().size() - plugin.getVanish().countVanishPlayers()) + "/" + Bukkit.getServer().getMaxPlayers() + "]"); e.setJoinMessage(null); if (plugin.getConfig().getBoolean("sharedmg")) { int rnd = new Random().nextInt(Bukkit.getOnlinePlayers().size()); @@ -79,35 +80,34 @@ plugin.getTimer().stopTimer(); } - if (plugin.getVanish().isVanish(player)) { - return; - } + if (!plugin.getVanish().isVanish(player)) { + e.setQuitMessage(Challenges.CHALLENGESPREFIX + " " + ChatColor.of("#3D98DC") + player.getName() + ChatColor.of("#C45B3D") + " hat die Lobby verlassen! " + ChatColor.of("#E4E737") + "[" + (Bukkit.getServer().getOnlinePlayers().size() - plugin.getVanish().countVanishPlayers() - 1) + "/" + Bukkit.getServer().getMaxPlayers() + "]"); + this.plugin.getSBManager().removeScoreboard(player); - Bukkit.broadcastMessage( - Challenges.CHALLENGESPREFIX + " " + ChatColor.of("#3D98DC") + player.getName() + ChatColor.of("#C45B3D") + " hat die Lobby verlassen! " + ChatColor.of("#E4E737") + "[" + (Bukkit.getServer().getOnlinePlayers().size() - plugin.getVanish().countVanishPlayers() - 1) + "/" + Bukkit.getServer() - .getMaxPlayers() + "]"); - e.setQuitMessage(null); + if (plugin.getCurrentEditor() != null && player.getUniqueId().equals(plugin.getCurrentEditor().getUniqueId())) { + if (Bukkit.getServer().getOnlinePlayers().size() - plugin.getVanish().countVanishPlayers() - 1 > 0) { + plugin.updateEditor(); + resetTaskId = Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, () -> { + Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "reset confirm"); + }, 10 * 60 * 20); + } else { + plugin.setCurrentEditor(null); + } + } - this.plugin.getSBManager().removeScoreboard(player); + Bukkit.getPluginManager().callEvent(new PlayerCountChangedEvent(Bukkit.getOnlinePlayers().size() - plugin.getVanish().countVanishPlayers() - 1)); - if (plugin.getCurrentEditor() != null && player.getUniqueId().equals(plugin.getCurrentEditor().getUniqueId())) { - if (Bukkit.getServer().getOnlinePlayers().size() - plugin.getVanish().countVanishPlayers() - 1 > 0) { - plugin.updateEditor(); - } else { - plugin.setCurrentEditor(null); - + if (plugin.isWaitingForShutdown() && Bukkit.getOnlinePlayers().size() == 1) { + Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, () -> { + Bukkit.getPluginManager().callEvent(new ServerStatusChangedEvent(false)); + }, 1L); + } + } else { + if (Bukkit.getServer().getOnlinePlayers().size() - 1 > 0) { resetTaskId = Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, () -> { Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "reset confirm"); }, 10 * 60 * 20); } } - - Bukkit.getPluginManager().callEvent(new PlayerCountChangedEvent(Bukkit.getOnlinePlayers().size() - plugin.getVanish().countVanishPlayers() - 1)); - - if (plugin.isWaitingForShutdown() && Bukkit.getOnlinePlayers().size() == 1) { - Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, () -> { - Bukkit.getPluginManager().callEvent(new ServerStatusChangedEvent(false)); - }, 1L); - } } }