private void handleQuit(PlayerEvent e) { SpleefPlayer player = HeavySpleef.getInstance().getSpleefPlayer(e.getPlayer()); if (player == null) return; if (!QueuesManager.hasQueue(player)) return; // Remove the player from the queue if he quits QueuesManager.removeFromQueue(player); }
private void handleQuit(PlayerEvent e) { SpleefPlayer player = HeavySpleef.getInstance().getSpleefPlayer(e.getPlayer()); QueuesManager.removeFromQueue(player); if (!player.isActive()) { return; } Game game = player.getGame(); game.leave(player, LoseCause.QUIT); }
@EventHandler public void onCommand(PlayerCommandPreprocessEvent e) { SpleefPlayer player = HeavySpleef.getInstance().getSpleefPlayer(e.getPlayer()); if (player == null) return; if (!QueuesManager.hasQueue(player)) return; if (HeavySpleef.getSystemConfig().getQueuesSection().isAllowCommands()) return; if (e.getMessage().equalsIgnoreCase("/spleef leave") || e.getMessage().equalsIgnoreCase("/spl leave")) return; e.setCancelled(true); player.sendMessage(I18N._("noCommandsInQueue")); }