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 option for tab complete to use displaynames #4432

Merged
merged 8 commits into from
Aug 19, 2021
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,8 @@ public interface ISettings extends IConf {

boolean changePlayerListName();

boolean changeTabCompleteName();

boolean isPlayerCommand(String string);

boolean useBukkitPermissions();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1013,6 +1013,11 @@ public boolean changePlayerListName() {
return changePlayerListName;
}

@Override
public boolean changeTabCompleteName() {
return config.getBoolean("change-tab-complete-name", false);
}

@Override
public boolean useBukkitPermissions() {
return config.getBoolean("use-bukkit-permissions", false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ protected List<String> getPlayers(final Server server, final CommandSource inter
final List<String> players = Lists.newArrayList();
for (final User user : ess.getOnlineUsers()) {
if (canInteractWith(interactor, user)) {
players.add(user.getName());
players.add(ess.getSettings().changeTabCompleteName() ? ChatColor.stripColor(user.getDisplayName()) : user.getName());
}
}
return players;
Expand All @@ -240,7 +240,7 @@ protected List<String> getPlayers(final Server server, final User interactor) {
final List<String> players = Lists.newArrayList();
for (final User user : ess.getOnlineUsers()) {
if (canInteractWith(interactor, user)) {
players.add(user.getName());
players.add(ess.getSettings().changeTabCompleteName() ? ChatColor.stripColor(user.getDisplayName()) : user.getName());
}
}
return players;
Expand Down
3 changes: 3 additions & 0 deletions Essentials/src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ hide-displayname-in-vanish: true
# Disable this if you have any other plugin, that modifies the displayname of a user.
change-displayname: true

# This option will cause Essentials to display a player's displayname instead of username when tab completing Essentials commands.
change-tab-complete-name: false

# When this option is enabled, the (tab) player list will be updated with the displayname.
# The value of change-displayname (above) has to be true.
#change-playerlist: true
Expand Down