mirror of
https://github.com/EssentialsX/Essentials.git
synced 2025-01-03 06:57:39 +01:00
Fix NPE while syncing offline users for discord line module (#5338)
Only would happen for users who haven't joined (or been loaded by different parts of the plugin) since the last restart. This change first of all switches to a method to fetch users which will update the User base to the UUIDPlayer dummy base. Secondly, this change will not update the base of a User to a UUIDPlayer dummy unless the base is currently null (which would be the case in the condition described above).
This commit is contained in:
parent
991bc61b0c
commit
069ebfcd5b
@ -1079,7 +1079,7 @@ public class Essentials extends JavaPlugin implements net.ess3.api.IEssentials {
|
||||
// Since we already call UserMap#getUser() above, we are already okay with adding the user to the cache,
|
||||
// so we need to manually add the user to the cache in order to avoid a memory leak and maintain behavior.
|
||||
userMap.addCachedUser(user);
|
||||
} else {
|
||||
} else if (base.getClass() != UUIDPlayer.class || user.getBase() == null) {
|
||||
user.update(base);
|
||||
}
|
||||
return user;
|
||||
|
@ -64,7 +64,7 @@ public class RoleSyncManager implements Listener {
|
||||
|
||||
if (member == null) {
|
||||
if (ess.getSettings().isUnlinkOnLeave()) {
|
||||
ess.getLinkManager().removeAccount(ess.getEss().getUser(player.getUniqueId()), DiscordLinkStatusChangeEvent.Cause.UNSYNC_LEAVE);
|
||||
ess.getLinkManager().removeAccount(ess.getEss().getUser(player), DiscordLinkStatusChangeEvent.Cause.UNSYNC_LEAVE);
|
||||
} else {
|
||||
unSync(player.getUniqueId(), discordId);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user