コード例 #1
0
ファイル: ChatPlayer.java プロジェクト: Bragendesh/ChatSuite
 public void setTarget(Target t) {
   target = t;
   Player p = getPlayer();
   if (p != null) {
     p.sendMessage("[ChatSuite] Your target is now: " + target.getName());
   }
 }
コード例 #2
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);
   }
 }
コード例 #3
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());
 }
コード例 #4
0
ファイル: ChatPlayer.java プロジェクト: Bragendesh/ChatSuite
 private String parseTarget(String format) {
   if (target != null) {
     if (target instanceof Channel) {
       format = TARGET.matcher(format).replaceAll(((Channel) target).getColoredName());
     } else {
       format = TARGET.matcher(format).replaceAll(target.getName());
     }
     Player p = getPlayer();
     if (p != null) {
       format = TARGET_DISPLAY.matcher(format).replaceAll(p.getDisplayName());
     }
   }
   return format;
 }
コード例 #5
0
ファイル: ChatPlayer.java プロジェクト: Bragendesh/ChatSuite
 protected String whisperParse(String format) {
   format = TARGET.matcher(format).replaceAll(reply.getName());
   format = TARGET_DISPLAY.matcher(format).replaceAll(reply.getName());
   return format;
 }
コード例 #6
0
ファイル: ChatPlayer.java プロジェクト: Bragendesh/ChatSuite
 @Override
 public void persist() {
   String t = (target instanceof Channel ? "c:" + target.getName() : "p:" + target.getName());
   manager.getConfig().set(getName() + ".target", t);
   manager.getConfig().set(getName() + ".auto_join", auto_join);
 }