Skip to content

Commit

Permalink
Add config option to disable tab list updates (#488)
Browse files Browse the repository at this point in the history
* Add option to disable tab list updating

Currently only works for paper, but it's possible to update tab list names on velocity and fabric

* Add docs to tablist config option
  • Loading branch information
Draycia committed Jun 12, 2024
1 parent 3a7beff commit c3eeebc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ public static void upgrade(final ConfigurationNode node) {
builder.addVersion(1, insertAddition("party-chat", "party-chat", "enabled"));
builder.addVersion(2, insertAddition("nickname-settings", "filter", ".*"));
builder.addVersion(3, insertAddition("return-to-default-channel", "return-to-default-channel", false));
builder.addVersion(4, insertAddition("nickname-settings", "update-tab-list", true));

final ConfigurationTransformation.Versioned upgrader = builder.build();
final int from = upgrader.version(node);
Expand All @@ -222,6 +223,9 @@ public static final class NicknameSettings {
@Comment("Whether Carbon's nickname management should be used. Disable this if you wish to have another plugin manage nicknames.")
private boolean useCarbonNicknames = true;

@Comment("Paper only. Updates the player's display name in the tab list to match their nickname.")
private boolean updateTabList = true;

@Comment("Minimum number of characters in nickname (excluding formatting).")
private int minLength = 3;

Expand All @@ -243,6 +247,10 @@ public boolean useCarbonNicknames() {
return this.useCarbonNicknames;
}

public boolean updateTabList() {
return this.updateTabList;
}

public List<String> blackList() {
return this.blackList;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,10 @@ public void nickname(final @Nullable Component nickname) {
private Consumer<Player> applyDisplayNameToBukkit(final @Nullable Component displayName) {
return bukkit -> this.carbonPlayerCommon.schedule(() -> {
bukkit.displayName(displayName);
bukkit.playerListName(displayName);

if (this.carbonPlayerCommon.configManager().primaryConfig().nickname().updateTabList()) {
bukkit.playerListName(displayName);
}
});
}

Expand Down

0 comments on commit c3eeebc

Please sign in to comment.