This commit is contained in:
vemacs 2016-10-12 12:35:25 -05:00
parent db47460a79
commit e0a578d06c

View File

@ -12,6 +12,7 @@ import java.util.Iterator;
public class EssentialsServerListener implements Listener {
private final transient IEssentials ess;
private boolean errorLogged = false;
public EssentialsServerListener(final IEssentials ess) {
this.ess = ess;
@ -19,11 +20,19 @@ public class EssentialsServerListener implements Listener {
@EventHandler(priority = EventPriority.LOWEST)
public void onServerListPing(final ServerListPingEvent event) {
Iterator<Player> iterator = event.iterator();
while (iterator.hasNext()) {
Player player = iterator.next();
if (ess.getUser(player).isVanished()) {
iterator.remove();
try {
Iterator<Player> iterator = event.iterator();
while (iterator.hasNext()) {
Player player = iterator.next();
if (ess.getUser(player).isVanished()) {
iterator.remove();
}
}
} catch (UnsupportedOperationException e) {
if (!errorLogged) {
ess.getLogger().warning("Current server implementation does not support "
+ "hiding players from server list ping. Update or contact the maintainers.");
errorLogged = true;
}
}
}