mirror of
https://github.com/PaperMC/Paper.git
synced 2025-03-21 14:39:01 +01:00
PluginCommand getExecutor + javadocs
By: Dinnerbone <dinnerbone@dinnerbone.com>
This commit is contained in:
parent
9c2782bea7
commit
5256cbb8a8
1 changed files with 25 additions and 0 deletions
|
@ -2,6 +2,9 @@ package org.bukkit.command;
|
||||||
|
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents a {@link Command} belonging to a plugin
|
||||||
|
*/
|
||||||
public final class PluginCommand extends Command {
|
public final class PluginCommand extends Command {
|
||||||
private final Plugin owningPlugin;
|
private final Plugin owningPlugin;
|
||||||
private CommandExecutor executor;
|
private CommandExecutor executor;
|
||||||
|
@ -13,6 +16,14 @@ public final class PluginCommand extends Command {
|
||||||
this.usageMessage = "";
|
this.usageMessage = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Executes the command, returning its success
|
||||||
|
*
|
||||||
|
* @param sender Source object which is executing this command
|
||||||
|
* @param commandLabel The alias of the command used
|
||||||
|
* @param args All arguments passed to the command, split via ' '
|
||||||
|
* @return true if the command was successful, otherwise false
|
||||||
|
*/
|
||||||
public boolean execute(CommandSender sender, String commandLabel, String[] args) {
|
public boolean execute(CommandSender sender, String commandLabel, String[] args) {
|
||||||
boolean success = false;
|
boolean success = false;
|
||||||
|
|
||||||
|
@ -29,10 +40,24 @@ public final class PluginCommand extends Command {
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the {@link CommandExecutor} to run when parsing this command
|
||||||
|
*
|
||||||
|
* @param executor New executor to run
|
||||||
|
*/
|
||||||
public void setExecutor(CommandExecutor executor) {
|
public void setExecutor(CommandExecutor executor) {
|
||||||
this.executor = executor;
|
this.executor = executor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the {@link CommandExecutor} associated with this command
|
||||||
|
*
|
||||||
|
* @return CommandExecutor object linked to this command
|
||||||
|
*/
|
||||||
|
public CommandExecutor getExecutor() {
|
||||||
|
return executor;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the owner of this PluginCommand
|
* Gets the owner of this PluginCommand
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Reference in a new issue