Makes only authenticated players chat recipients that will be filtered

This commit is contained in:
DNx5 2015-11-27 00:38:56 +07:00
parent 30cdf6b1e0
commit fc87ea4eef

View File

@ -57,15 +57,19 @@ public class AuthMePlayerListener implements Listener {
* @param event AsyncPlayerChatEvent * @param event AsyncPlayerChatEvent
*/ */
private void handleChat(AsyncPlayerChatEvent event) { private void handleChat(AsyncPlayerChatEvent event) {
if (Settings.isChatAllowed || Utils.checkAuth(event.getPlayer())) { if (Settings.isChatAllowed) {
return; return;
} }
final Player player = event.getPlayer(); final Player player = event.getPlayer();
for (Player p : Utils.getOnlinePlayers()) {
if (!PlayerCache.getInstance().isAuthenticated(p.getName())) { if(Utils.checkAuth(player)) {
event.getRecipients().remove(p); // TODO: it should be configurable for (Player p : Utils.getOnlinePlayers()) {
if (!PlayerCache.getInstance().isAuthenticated(p.getName())) {
event.getRecipients().remove(p); // TODO: it should be configurable
}
} }
return;
} }
event.setCancelled(true); event.setCancelled(true);