Add tab-completer for /spawnmob command (#2661)

This commit is contained in:
montlikadani 2020-03-13 10:30:50 +01:00 committed by GitHub
parent e3ec0f3b9b
commit 3bb45b80b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 0 deletions

View File

@ -5,8 +5,10 @@ import com.earth2me.essentials.Mob;
import com.earth2me.essentials.SpawnMob;
import com.earth2me.essentials.User;
import com.earth2me.essentials.utils.StringUtil;
import com.google.common.collect.Lists;
import org.bukkit.Server;
import java.util.Collections;
import java.util.List;
import static com.earth2me.essentials.I18n.tl;
@ -59,4 +61,13 @@ public class Commandspawnmob extends EssentialsCommand {
final User target = getPlayer(ess.getServer(), args, 2, true, false);
SpawnMob.spawnmob(ess, server, sender, target, mobParts, mobData, mobCount);
}
@Override
protected List<String> getTabCompleteOptions(Server server, User user, String commandLabel, String[] args) {
if (args.length == 1) {
return Lists.newArrayList(SpawnMob.mobParts(args[0]));
} else {
return Collections.emptyList();
}
}
}