From 1562a8f3ca2134cbf0118a68920939cab201166e Mon Sep 17 00:00:00 2001 From: flcmc Date: Sat, 12 Aug 2017 09:42:57 -0400 Subject: [PATCH] Implement tab completion for seen and whois. (#1440) --- .../com/earth2me/essentials/commands/Commandseen.java | 10 ++++++++++ .../earth2me/essentials/commands/Commandwhois.java | 11 +++++++++++ 2 files changed, 21 insertions(+) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandseen.java b/Essentials/src/com/earth2me/essentials/commands/Commandseen.java index ad0cf1df4..f9bae3311 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandseen.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandseen.java @@ -16,6 +16,7 @@ import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.UUID; +import java.util.Collections; import static com.earth2me.essentials.I18n.tl; @@ -210,4 +211,13 @@ public class Commandseen extends EssentialsCommand { }); } + + @Override + protected List getTabCompleteOptions(Server server, CommandSource sender, String commandLabel, String[] args) { + if (args.length == 1) { + return getPlayers(server, sender); + } else { + return Collections.emptyList(); + } + } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandwhois.java b/Essentials/src/com/earth2me/essentials/commands/Commandwhois.java index 4f319269d..af002af5b 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandwhois.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandwhois.java @@ -9,6 +9,8 @@ import org.bukkit.Server; import org.bukkit.Statistic; import java.util.Locale; +import java.util.Collections; +import java.util.List; import static com.earth2me.essentials.I18n.tl; @@ -57,4 +59,13 @@ public class Commandwhois extends EssentialsCommand { sender.sendMessage(tl("whoisMuted", (user.isMuted() ? user.getMuteTimeout() > 0 ? DateUtil.formatDateDiff(user.getMuteTimeout()) : tl("true") : tl("false")))); } + + @Override + protected List getTabCompleteOptions(Server server, CommandSource sender, String commandLabel, String[] args) { + if (args.length == 1) { + return getPlayers(server, sender); + } else { + return Collections.emptyList(); + } + } }