Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- String channel = "";
- String uuid = p.getUniqueId().toString();
- String group = chat.getPrimaryGroup(p);
- String prefix = chat.getGroupPrefix(p.getWorld(), group);
- Util.debug("Group: " + group);
- Util.debug("Prefix: " + prefix);
- if ( !perm(p,"admin") ) // Admins can use colored chat - others cannot
- {
- msg = Util.checkChat(ChatColor.stripColor( Util.colorize(msg)), p, maxCapLetters);
- msg = Util.crushPunct(msg);
- msg = Normalizer.normalize(msg, Normalizer.Form.NFD);
- msg = msg.replaceAll("[^\\x00-\\x7F]", "");
- }
- if ( msg.trim().length() == 0 )
- return;
- if ( isCalm(p) )
- return;
- if ( chatDisabled && !perm(p,"admin") )
- {
- l(p,"CHAT_IS_DISABLED");
- return;
- }
- if ( checkSwear(p,msg) )
- {
- return;
- }
- if (ess.getUser(p).isMuted()) {
- Util.msg( p, "You are muted and may not chat.");
- return;
- }
- if ( channelPlayers.containsKey(uuid))
- channel = channelPlayers.get(uuid);
- String chat = chatFormat;
- if ( channel.trim().length() == 0 )
- chat = chat.replace("{channel}", "");
- else
- chat = chat.replace("{channel}", channelFormat.replaceAll("%1", channel) );
- chat = chat.replace("{player}", p.getName() );
- chat = chat.replace("{prefix}", prefix );
- getServer().getLogger().info( ChatColor.stripColor( Util.colorize(chat.replace("{message}", msg))) );
- for ( Player rec : Bukkit.getServer().getOnlinePlayers() )
- {
- String newmsg = msg;
- String chan = "";
- if ( channelPlayers.containsKey( rec.getUniqueId().toString()) )
- chan = channelPlayers.get( rec.getUniqueId().toString() );
- Util.debug("Channel: ->" + channel + "<- Chan: ->"+chan+"<-" );
- if ( chan.equalsIgnoreCase(channel) || canListen(rec) ) // Player in the same channel or Channel admin
- {
- if ( ess.getUser(rec).isIgnoredPlayer(p.getName() ))
- continue;
- if ( isCalm(rec) )
- continue;
- if ( StringUtils.containsIgnoreCase(msg, rec.getName() ) )
- newmsg = msg.replaceAll("(?i)"+rec.getName(), Util.colorize( chatHighlight.get(rec.getUniqueId().toString()) +rec.getName()+"&r") );
- Util.msg(rec, chat.replace("{message}", newmsg) );
- if ( splitChatPlayers.containsKey( rec.getUniqueId().toString()) )
- Util.msg(rec, splitChatPlayers.get( rec.getUniqueId().toString()));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement