mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-11-10 21:11:07 +01:00
Fix #857
This commit is contained in:
parent
db47460a79
commit
e0a578d06c
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user