diff --git a/Essentials/src/main/java/com/earth2me/essentials/ISettings.java b/Essentials/src/main/java/com/earth2me/essentials/ISettings.java index eb08d7a4c..c4f409114 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/ISettings.java +++ b/Essentials/src/main/java/com/earth2me/essentials/ISettings.java @@ -172,6 +172,8 @@ public interface ISettings extends IConf { boolean changePlayerListName(); + boolean changeTabCompleteName(); + boolean isPlayerCommand(String string); boolean useBukkitPermissions(); diff --git a/Essentials/src/main/java/com/earth2me/essentials/Settings.java b/Essentials/src/main/java/com/earth2me/essentials/Settings.java index 4ff5fa447..20ad33b62 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/Settings.java +++ b/Essentials/src/main/java/com/earth2me/essentials/Settings.java @@ -1024,6 +1024,11 @@ public class Settings implements net.ess3.api.ISettings { 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); diff --git a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandmail.java b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandmail.java index d50dbf261..387ec8666 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandmail.java +++ b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandmail.java @@ -294,8 +294,6 @@ public class Commandmail extends EssentialsCommand { return getPlayers(server, sender); } else if (args.length == 3 && args[0].equalsIgnoreCase("sendtemp")) { return COMMON_DATE_DIFFS; - } else if ((args.length > 2 && args[0].equalsIgnoreCase("send")) || (args.length > 1 && args[0].equalsIgnoreCase("sendall"))) { - return null; // Use vanilla handler } else { return Collections.emptyList(); } diff --git a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandmsg.java b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandmsg.java index 1603bd6c8..d7d95794b 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandmsg.java +++ b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandmsg.java @@ -8,6 +8,7 @@ import com.earth2me.essentials.utils.DateUtil; import com.earth2me.essentials.utils.FormatUtil; import org.bukkit.Server; +import java.util.Collections; import java.util.List; import static com.earth2me.essentials.I18n.tl; @@ -60,7 +61,7 @@ public class Commandmsg extends EssentialsLoopCommand { if (args.length == 1) { return getPlayers(server, sender); } else { - return null; // It's a chat message, use the default chat handler + return Collections.emptyList(); // It's a chat message, send an empty list. } } } diff --git a/Essentials/src/main/java/com/earth2me/essentials/commands/EssentialsCommand.java b/Essentials/src/main/java/com/earth2me/essentials/commands/EssentialsCommand.java index b40dd8da6..cd849b2d3 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/commands/EssentialsCommand.java +++ b/Essentials/src/main/java/com/earth2me/essentials/commands/EssentialsCommand.java @@ -4,6 +4,7 @@ import com.earth2me.essentials.CommandSource; import com.earth2me.essentials.IEssentialsModule; import com.earth2me.essentials.Trade; import com.earth2me.essentials.User; +import com.earth2me.essentials.utils.FormatUtil; import com.google.common.collect.ImmutableList; import com.google.common.collect.Lists; import com.google.common.collect.Maps; @@ -226,7 +227,7 @@ public abstract class EssentialsCommand implements IEssentialsCommand { final List players = Lists.newArrayList(); for (final User user : ess.getOnlineUsers()) { if (canInteractWith(interactor, user)) { - players.add(user.getName()); + players.add(ess.getSettings().changeTabCompleteName() ? FormatUtil.stripFormat(user.getDisplayName()) : user.getName()); } } return players; @@ -240,7 +241,7 @@ public abstract class EssentialsCommand implements IEssentialsCommand { final List players = Lists.newArrayList(); for (final User user : ess.getOnlineUsers()) { if (canInteractWith(interactor, user)) { - players.add(user.getName()); + players.add(ess.getSettings().changeTabCompleteName() ? FormatUtil.stripFormat(user.getDisplayName()) : user.getName()); } } return players; diff --git a/Essentials/src/main/resources/config.yml b/Essentials/src/main/resources/config.yml index df506e534..58c925e20 100644 --- a/Essentials/src/main/resources/config.yml +++ b/Essentials/src/main/resources/config.yml @@ -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 show players' displaynames instead of usernames 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