コード例 #1
0
 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;
 }
コード例 #2
0
 @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;
   }
 }
コード例 #3
0
 @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;
 }
コード例 #4
0
 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);
   }
 }
コード例 #5
0
 public static void addPlayer(BSPlayer player) {
   onlinePlayers.put(player.getName(), player);
   player.updateDisplayName();
 }