Skip to content

Commit

Permalink
Handle unlinking before removing the player (fixes remrole handling)
Browse files Browse the repository at this point in the history
  • Loading branch information
UserNugget committed Sep 14, 2024
1 parent f1fbbd6 commit e74b649
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/java/net/elytrium/limboauth/socialaddon/Addon.java
Original file line number Diff line number Diff line change
Expand Up @@ -531,13 +531,12 @@ private void load() {
return;
}

SocialPlayer.DatabaseField.valueOf(dbField).setIdFor(player, null);
boolean allUnlinked = Arrays.stream(SocialPlayer.DatabaseField.values())
.noneMatch(v -> v.getIdFor(player) != null);

if (Settings.IMP.MAIN.UNLINK_BTN_ALL || allUnlinked) {
this.dao.delete(player);
this.socialManager.unregisterHook(player);
this.dao.delete(player);

Settings.IMP.MAIN.AFTER_UNLINKAGE_COMMANDS.forEach(command ->
this.server.getCommandManager().executeAsync(p -> Tristate.TRUE, command.replace("{NICKNAME}", player.getLowercaseNickname())));
Expand All @@ -549,6 +548,7 @@ private void load() {

this.socialManager.unregisterHook(dbField, player);
}
SocialPlayer.DatabaseField.valueOf(dbField).setIdFor(player, null);

this.socialManager.broadcastMessage(dbField, id, Settings.IMP.MAIN.STRINGS.UNLINK_SUCCESS);
this.server.getPlayer(player.getLowercaseNickname()).ifPresent(p ->
Expand Down

0 comments on commit e74b649

Please sign in to comment.