Clear user cache on login.

Fixes https://github.com/BentoBoxWorld/BentoBox/issues/1341

Server calls PlayerTeleportEvent if player is mounted on quit, which
inserts player back into cache. By clearing the cache on login, the
stale player object will be cleared.
This commit is contained in:
tastybento 2020-05-05 16:26:51 -07:00
parent 4a3c9ad8ae
commit 2c004ce504

View File

@ -44,13 +44,15 @@ public class JoinLeaveListener implements Listener {
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onPlayerJoin(final PlayerJoinEvent event) {
// Remove them from the cache, just in case they were not removed for some reason
User.removePlayer(event.getPlayer());
User user = User.getInstance(event.getPlayer());
if (user == null || user.getUniqueId() == null) {
return;
}
UUID playerUUID = user.getUniqueId();
// Check if player hasn't joined before
if (!players.isKnown(playerUUID)) {
firstTime(user);