Ejemplo n.º 1
0
 public void reply(String message) {
   if (reply == null) {
     return;
   }
   whisperTo(reply, message);
   ((ChatPlayer) reply).whisperFrom(this, message);
 }
Ejemplo n.º 2
0
 @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());
 }