會長:chenjinsheng / 此間半開一盞茶開設日:2015-05-17 23:58:58
近期編輯:chenjinsheng ...看更多 |
public class GroomCommand implements CommandExecutor, TabCompleter { @Override public boolean onCommand(CommandSender cs, Command c, String s, String[] ss) { if (cs instanceof Player) { Player p = (Player) cs; if (ss.length == 0) { p.sendRawMessage("0"); } if (ss.length == 1) { switch (ss[0]) { case "1": p.sendRawMessage("1"); break; case "2": p.sendRawMessage("2"); break; case "3": p.sendRawMessage("3"); break; case "4": p.sendRawMessage("4"); break; case "5": p.sendRawMessage("5"); break; default: break; } } } return false; } @Override public List<String> onTabComplete(CommandSender cs, Command c, String s, String[] ss) { List<String> l = new ArrayList<>(); l.add("1"); l.add("2"); l.add("3"); l.add("4"); l.add("5"); return l; } } |
getCommand("sp").setExecutor(new GroomCommand()); getCommand("sp").setTabCompleter(new GroomCommand()); |
目前沒有資料連到「Tab指令」。