From 1fd4f0e1a78fabd26aa5dbd13d80251705c2056b Mon Sep 17 00:00:00 2001 From: DNx Date: Sun, 8 Jul 2018 02:24:58 +0700 Subject: [PATCH] Improve previous commit --- .../java/fr/xephi/authme/listener/PlayerListener.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/fr/xephi/authme/listener/PlayerListener.java b/src/main/java/fr/xephi/authme/listener/PlayerListener.java index b8c388e89..9a4ea0d03 100644 --- a/src/main/java/fr/xephi/authme/listener/PlayerListener.java +++ b/src/main/java/fr/xephi/authme/listener/PlayerListener.java @@ -54,8 +54,8 @@ import org.bukkit.event.player.PlayerRespawnEvent; import org.bukkit.event.player.PlayerShearEntityEvent; import javax.inject.Inject; -import java.util.ArrayList; -import java.util.List; +import java.util.HashSet; +import java.util.Set; import static fr.xephi.authme.settings.properties.RestrictionSettings.ALLOWED_MOVEMENT_RADIUS; import static fr.xephi.authme.settings.properties.RestrictionSettings.ALLOW_UNAUTHED_MOVEMENT; @@ -97,7 +97,7 @@ public class PlayerListener implements Listener { private BungeeSender bungeeSender; private boolean isAsyncPlayerPreLoginEventCalled = false; - private List unresolvedPlayerHostname = new ArrayList<>(); + private Set unresolvedPlayerHostname = new HashSet<>(); @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST) public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) { @@ -266,6 +266,8 @@ public class PlayerListener implements Listener { return; } + // getAddress() sometimes returning null if not yet resolved + // skip it and let PlayerLoginEvent to handle it if (event.getAddress() == null) { unresolvedPlayerHostname.add(event.getName()); return;