got command functionality working
This commit is contained in:
@@ -160,18 +160,18 @@ public interface Eco {
|
||||
EcoPlugin getEcoPlugin();
|
||||
|
||||
@NotNull
|
||||
PluginCommandBase createPluginCommand(@NotNull EcoPlugin plugin,
|
||||
PluginCommandBase createPluginCommand(@NotNull CommandBase parentDelegate,
|
||||
@NotNull EcoPlugin plugin,
|
||||
@NotNull String name,
|
||||
@NotNull String permission,
|
||||
boolean playersOnly
|
||||
);
|
||||
boolean playersOnly);
|
||||
|
||||
@NotNull
|
||||
CommandBase createSubCommand(@NotNull EcoPlugin plugin,
|
||||
CommandBase createSubCommand(@NotNull CommandBase parentDelegate,
|
||||
@NotNull EcoPlugin plugin,
|
||||
@NotNull String name,
|
||||
@NotNull String permission,
|
||||
boolean playersOnly
|
||||
);
|
||||
boolean playersOnly);
|
||||
|
||||
/**
|
||||
* Updatable config.
|
||||
|
||||
@@ -50,6 +50,8 @@ public interface CommandBase {
|
||||
|
||||
@NotNull List<CommandBase> getSubcommands();
|
||||
|
||||
@NotNull CommandBase getWrapped();
|
||||
|
||||
/**
|
||||
* Handle command execution.
|
||||
*
|
||||
@@ -59,6 +61,7 @@ public interface CommandBase {
|
||||
default void onExecute(@NotNull CommandSender sender,
|
||||
@NotNull List<String> args) throws NotificationException {
|
||||
// Do nothing.
|
||||
Bukkit.getLogger().info("Did this happen?");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -37,7 +37,7 @@ public abstract class PluginCommand implements PluginCommandBase {
|
||||
@NotNull final String name,
|
||||
@NotNull final String permission,
|
||||
final boolean playersOnly) {
|
||||
this.delegate = Eco.get().createPluginCommand(plugin, name, permission, playersOnly);
|
||||
this.delegate = Eco.get().createPluginCommand(this, plugin, name, permission, playersOnly);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -65,6 +65,11 @@ public abstract class PluginCommand implements PluginCommandBase {
|
||||
return delegate.getSubcommands();
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull CommandBase getWrapped() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void register() {
|
||||
delegate.register();
|
||||
|
||||
@@ -26,7 +26,7 @@ public abstract class Subcommand implements CommandBase {
|
||||
@NotNull final String name,
|
||||
@NotNull final String permission,
|
||||
final boolean playersOnly) {
|
||||
this.delegate = Eco.get().createSubCommand(plugin, name, permission, playersOnly);
|
||||
this.delegate = Eco.get().createSubCommand(this, plugin, name, permission, playersOnly);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -67,6 +67,11 @@ public abstract class Subcommand implements CommandBase {
|
||||
return delegate.getSubcommands();
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull CommandBase getWrapped() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EcoPlugin getPlugin() {
|
||||
return delegate.getPlugin();
|
||||
|
||||
Reference in New Issue
Block a user