Skip to content

Commit

Permalink
Merge pull request #14 from TheNextLvl-net/confersion-fix
Browse files Browse the repository at this point in the history
Enhance profile and group prefix/suffix handling
  • Loading branch information
NonSwag authored Sep 2, 2024
2 parents e1c7833 + c85a76c commit 2b074ad
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,11 @@ public void convert(OfflinePlayer player, BankController source, BankController
private final class ChatConverter extends PlayerConverter<ChatController> {
@Override
public void convert(OfflinePlayer player, ChatController source, ChatController target) {
source.tryGetProfile(player).thenAccept(sourceProfile -> target.tryGetProfile(player)
source.tryGetProfile(player).thenAccept(profile -> target.tryGetProfile(player)
.thenAccept(targetProfile -> {
sourceProfile.getPrefix().ifPresent(targetProfile::setPrefix);
sourceProfile.getSuffix().ifPresent(targetProfile::setSuffix);
sourceProfile.getDisplayName().ifPresent(targetProfile::setDisplayName);
profile.getPrefixes().forEach((priority, prefix) -> targetProfile.setPrefix(prefix, priority));
profile.getSuffixes().forEach((priority, suffix) -> targetProfile.setSuffix(suffix, priority));
profile.getDisplayName().ifPresent(targetProfile::setDisplayName);
}));
}
}
Expand Down Expand Up @@ -153,8 +153,8 @@ public void convert(GroupController source, GroupController target) {
.thenAccept(targetGroup -> {
group.getDisplayName().ifPresent(targetGroup::setDisplayName);
group.getPermissions().forEach(targetGroup::setPermission);
group.getPrefix().ifPresent(targetGroup::setPrefix);
group.getSuffix().ifPresent(targetGroup::setSuffix);
group.getPrefixes().forEach((priority, prefix) -> targetGroup.setPrefix(prefix, priority));
group.getSuffixes().forEach((priority, suffix) -> targetGroup.setSuffix(suffix, priority));
group.getWeight().ifPresent(targetGroup::setWeight);
})));
super.convert(source, target);
Expand Down

0 comments on commit 2b074ad

Please sign in to comment.