Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add config option to disable tab list updates #488

Merged
merged 2 commits into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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