mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-02-11 20:00:46 +00:00
Fix #857
This commit is contained in:
parent
db47460a79
commit
e0a578d06c
1 changed files with 14 additions and 5 deletions
|
@ -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 a new issue