Iterate over all chat recipients

This commit is contained in:
ljacqu 2016-05-22 10:52:34 +02:00
parent dd5fb49065
commit 11350ec43a

View File

@ -129,7 +129,6 @@ public class AuthMePlayerListener implements Listener {
sendLoginOrRegisterMessage(event.getPlayer()); sendLoginOrRegisterMessage(event.getPlayer());
} }
@SuppressWarnings("deprecation")
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOW) @EventHandler(ignoreCancelled = true, priority = EventPriority.LOW)
public void onPlayerChat(PlayerChatEvent event) { public void onPlayerChat(PlayerChatEvent event) {
if (settings.getProperty(RestrictionSettings.ALLOW_CHAT)) { if (settings.getProperty(RestrictionSettings.ALLOW_CHAT)) {
@ -148,9 +147,9 @@ public class AuthMePlayerListener implements Listener {
} else if (settings.getProperty(RestrictionSettings.HIDE_CHAT)) { } else if (settings.getProperty(RestrictionSettings.HIDE_CHAT)) {
Set<Player> recipients = event.getRecipients(); Set<Player> recipients = event.getRecipients();
Iterator<Player> iter = recipients.iterator(); Iterator<Player> iter = recipients.iterator();
if(iter.hasNext()) { while (iter.hasNext()) {
Player p = iter.next(); Player p = iter.next();
if(PlayerCache.getInstance().isAuthenticated(p.getName())) { if (PlayerCache.getInstance().isAuthenticated(p.getName())) {
iter.remove(); iter.remove();
} }
} }