Initial
This commit is contained in:
parent
4599fd9e5a
commit
4c74e8fb12
1 changed files with 28 additions and 0 deletions
|
|
@ -0,0 +1,28 @@
|
|||
package org.zhdev.varioutil.bukkit.command;
|
||||
|
||||
import org.bukkit.command.*;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public final class PreparedPluginCommand extends AbstractPluginCommand {
|
||||
private final CommandExecutor executor;
|
||||
private final TabCompleter completer;
|
||||
|
||||
public PreparedPluginCommand(@NotNull String name, Plugin plugin, CommandExecutor executor, TabCompleter completer) {
|
||||
super(name, plugin);
|
||||
this.executor = executor;
|
||||
this.completer = completer;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean onExecute(@NotNull CommandSender sender, @NotNull String label, @NotNull String[] args) {
|
||||
return executor.onCommand(sender, this, label, args);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<String> onTabComplete(@NotNull CommandSender sender, @NotNull String label, @NotNull String[] args) {
|
||||
return completer == null ? null : completer.onTabComplete(sender, this, label, args);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue