mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-06-28 02:00:10 +00:00
Implement tab completion for all commands. (#1282)
List of supported commands: ``` /afk /balance /balancetop /ban /banip /bigtree /book /broadcastworld /burn /clearinventory /condense /delhome /deljail /delwarp /eco /enchant /enderchest /essentials /exp /ext /feed /fireball /firework /gamemode /getpos /give /hat /heal /help /helpop /home /ignore /invsee /item /itemdb /jump /kick /kill /kit /lightning /list /mail /me /msg /mute /near /nick /nuke /pay /potion /powertool /ptime /pweather /recipe /remove /repair /sell /showkit /skull /speed /tempban /thunder /time /togglejail /tp /tpa /tpaall /tpahere /tpall /tphere /tpo /tpohere /tppos /tree /warp /weather /world /worth```
This commit is contained in:
parent
e572788a8c
commit
bbe0ca9302
82 changed files with 1783 additions and 118 deletions
|
@ -7,6 +7,7 @@ import com.earth2me.essentials.utils.StringUtil;
|
|||
import org.bukkit.Server;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.logging.Level;
|
||||
|
@ -99,4 +100,34 @@ public class Commandkit extends EssentialsCommand {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<String> getTabCompleteOptions(final Server server, final User user, final String commandLabel, final String[] args) {
|
||||
if (args.length == 1) {
|
||||
List<String> options = new ArrayList<>();
|
||||
// TODO: Move all of this to its own method
|
||||
for (String kitName : ess.getSettings().getKits().getKeys(false)) {
|
||||
if (!user.isAuthorized("essentials.kits." + kitName)) { // Only check perm, not time or money
|
||||
continue;
|
||||
}
|
||||
options.add(kitName);
|
||||
}
|
||||
return options;
|
||||
} else if (args.length == 2 && user.isAuthorized("essentials.kit.others")) {
|
||||
return getPlayers(server, user);
|
||||
} else {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<String> getTabCompleteOptions(final Server server, final CommandSource sender, final String commandLabel, final String[] args) {
|
||||
if (args.length == 1) {
|
||||
return new ArrayList<>(ess.getSettings().getKits().getKeys(false)); // TODO: Move this to its own method
|
||||
} else if (args.length == 2) {
|
||||
return getPlayers(server, sender);
|
||||
} else {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue