mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-02 06:28:49 +00:00
Merge commands with their tab completers
This commit is contained in:
37 files changed
+470
-512
No files matched your search
@@ -0,0 +1,33 @@
|
||||
package me.william278.huskhomes2.commands;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.PluginCommand;
|
||||
import org.bukkit.command.TabCompleter;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
public abstract class CommandBase implements CommandExecutor {
|
||||
/**
|
||||
* Register base for bukkit command
|
||||
* @param command Command for registration
|
||||
*/
|
||||
public PluginCommand register(PluginCommand command) {
|
||||
Objects.requireNonNull(command);
|
||||
command.setExecutor(this);
|
||||
if (this instanceof TabCompleter) {
|
||||
command.setTabCompleter((TabCompleter) this);
|
||||
}
|
||||
return command;
|
||||
}
|
||||
|
||||
public static class EmptyTab implements TabCompleter {
|
||||
@Override
|
||||
public List<String> onTabComplete(CommandSender commandSender, Command command, String s, String[] strings) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user