mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-08-04 19:46:27 +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
|
@ -2,9 +2,13 @@ package com.earth2me.essentials.commands;
|
|||
|
||||
import com.earth2me.essentials.CommandSource;
|
||||
import com.earth2me.essentials.User;
|
||||
import com.google.common.collect.Lists;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.World;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
|
||||
|
||||
|
@ -62,4 +66,32 @@ public class Commandweather extends EssentialsCommand {
|
|||
sender.sendMessage(isStorm ? tl("weatherStorm", world.getName()) : tl("weatherSun", world.getName()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<String> getTabCompleteOptions(Server server, User user, String commandLabel, String[] args) {
|
||||
if (args.length == 1) {
|
||||
return Lists.newArrayList("storm", "sun");
|
||||
} else if (args.length == 2) {
|
||||
return COMMON_DURATIONS;
|
||||
} else {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<String> getTabCompleteOptions(Server server, CommandSource sender, String commandLabel, String[] args) {
|
||||
if (args.length == 1) {
|
||||
List<String> worlds = Lists.newArrayList();
|
||||
for (World world : server.getWorlds()) {
|
||||
worlds.add(world.getName());
|
||||
}
|
||||
return worlds;
|
||||
} else if (args.length == 2) {
|
||||
return Lists.newArrayList("storm", "sun");
|
||||
} else if (args.length == 3) {
|
||||
return COMMON_DURATIONS;
|
||||
} else {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue