Skip to content

Commit

Permalink
Enhance profile and group prefix/suffix handling
Browse files Browse the repository at this point in the history
Refactor prefix and suffix handling to support prioritized settings for profiles and groups. This update allows for more granular control over multiple prefixes and suffixes, improving the flexibility of the conversion process.
  • Loading branch information
NonSwag committed Sep 2, 2024
1 parent e1c7833 commit c85a76c
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 c85a76c

Please sign in to comment.