コード例 #1
0
ファイル: ChatPlayer.java プロジェクト: Bragendesh/ChatSuite
 public void whisperTo(Target to, String message) {
   reply = to;
   String format = getFormattedWhisperTo(to);
   format = format.replaceAll("(%message|%m)", message);
   sendMessage(format);
   if (to instanceof ChatPlayer && ((ChatPlayer) to).afk) {
     sendMessage(to.getName() + " is afk: " + ((ChatPlayer) to).afk_message);
   }
 }
コード例 #2
0
ファイル: PlayerListener.java プロジェクト: mbax/ChatSuite
 @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
 void playerChatLowest(AsyncPlayerChatEvent event) {
   ChatPlayer player = plugin.getPlayerManager().getPlayer(event.getPlayer().getName());
   if (player == null) {
     return;
   } // player object was null
   if (player.isMuted()) {
     player.sendMessage(ChatColor.RED + "You are muted.");
     event.setCancelled(true);
     return;
   }
   Target target = player.getTarget();
   if (target == null) {
     return;
   } // target object was null
   if (target.isMuted()) {
     player.sendMessage(ChatColor.RED + "Target is muted.");
     event.setCancelled(true);
     return;
   }
   if (player.colorfulChat()) {
     event.setMessage(ChatColor.translateAlternateColorCodes('&', event.getMessage()));
   }
   String format = player.getFormattedMessage();
   Set<Player> players = new HashSet<Player>();
   if (target instanceof Channel) {
     if (!((Channel) target).getOccupants().contains(event.getPlayer())) {
       event.getPlayer().sendMessage(ChatColor.RED + "You aren't on that channel.");
       event.setCancelled(true);
       return;
     }
     players.addAll(((Channel) target).getOccupants());
   } else {
     player.whisperTo(target, event.getMessage());
     ((ChatPlayer) target).whisperFrom(player, event.getMessage());
     event.setCancelled(true);
     return;
   }
   event.getRecipients().clear();
   event.getRecipients().addAll(players);
   event.setFormat(format);
   event.setMessage(event.getMessage());
 }
コード例 #3
0
ファイル: ChatPlayer.java プロジェクト: Bragendesh/ChatSuite
 public void whisperFrom(Target from, String message) {
   reply = from;
   String format = getFormattedWhisperFrom(from);
   format = format.replaceAll("(%message|%m)", message);
   sendMessage(format);
 }
コード例 #4
0
ファイル: ChatPlayer.java プロジェクト: Bragendesh/ChatSuite
 public void part(Channel c) {
   if (auto_join.contains(c.getName())) {
     sendMessage(c.getColoredName() + " removed from Auto-Join list.");
   }
   auto_join.remove(c.getName());
 }
コード例 #5
0
ファイル: ChatPlayer.java プロジェクト: Bragendesh/ChatSuite
 public void join(Channel c) {
   if (!auto_join.contains(c.getName())) {
     sendMessage(c.getColoredName() + " added to Auto-Join list.");
   }
   auto_join.add(c.getName());
 }