public static ArrayList<Player> getChatSpies(Player player, Set<Player> set) { ArrayList<Player> spies = new ArrayList<Player>(); for (BSPlayer p : onlinePlayers.values()) { if (p.isChatSpying() && !set.contains(p) && !p.getName().equals(player.getName())) { spies.add(p.getPlayer()); } } return spies; }
@Override public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { BSPlayer p = PlayerManager.getPlayer(sender); if (args.length == 0) { ChannelManager.setChannelFormat(sender, p.getChannelName()); return true; } else { return false; } }
@Override public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { if (args.length == 1) { if (sender instanceof Player) { if (!sender.hasPermission("bungeesuite.chat.command.realname")) { sender.sendMessage(command.getPermissionMessage()); return true; } else { BSPlayer p = PlayerManager.getsimilarNickPlayer(args[0]); if (p == null) PlayerManager.realnamePlayer(sender.getName(), args[0]); else sender.sendMessage( ChatColor.GRAY + p.getNickname() + ChatColor.RESET + ChatColor.GRAY + " is " + p.getName()); return true; } } else { BSPlayer p = PlayerManager.getsimilarNickPlayer(args[0]); if (p == null) sender.sendMessage( ChatColor.GRAY + args[0] + ChatColor.RESET + ChatColor.GRAY + " was not found!"); else sender.sendMessage( ChatColor.GRAY + p.getNickname() + ChatColor.RESET + ChatColor.GRAY + " is " + p.getName()); return true; } } return false; }
public static void setPlayerAFK(Player sender) { BSPlayer p = getPlayer(sender); if (p == null) { return; } ByteArrayOutputStream b = new ByteArrayOutputStream(); DataOutputStream out = new DataOutputStream(b); try { out.writeUTF("AFKPlayer"); out.writeUTF(p.getName()); out.writeBoolean(p.isAFK()); out.writeBoolean(sender.hasPermission("bungeesuite.chat.command.afk.global")); out.writeBoolean(sender.hasPermission("bungeesuite.chat.command.afk.display")); } catch (IOException s) { s.printStackTrace(); } new PluginMessageTask(b).runTaskAsynchronously(BungeeSuiteChat.instance); if (p.isAFK()) { p.setAFK(false); } else { p.setAFK(true); } }
public static void addPlayer(BSPlayer player) { onlinePlayers.put(player.getName(), player); player.updateDisplayName(); }