Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-12-26 16:12:42 +01:00
Add onCommand and onTabComplete to the interface
Dieser Commit ist enthalten in:
Ursprung
b146257b1a
Commit
598863d43a
@ -1,5 +1,7 @@
|
||||
package us.myles.ViaVersion.api.command;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ViaVersionCommand {
|
||||
/**
|
||||
* Register your own subcommand inside ViaVersion
|
||||
@ -24,4 +26,22 @@ public interface ViaVersionCommand {
|
||||
* @return ViaSubCommand instance
|
||||
*/
|
||||
ViaSubCommand getSubCommand(String name);
|
||||
|
||||
/**
|
||||
* Executed when the Command sender executes the command
|
||||
*
|
||||
* @param sender Sender object
|
||||
* @param args arguments provided
|
||||
* @return was successful
|
||||
*/
|
||||
boolean onCommand(ViaCommandSender sender, String[] args);
|
||||
|
||||
/**
|
||||
* Executed when the Command sender tab-completes
|
||||
*
|
||||
* @param sender Sender object
|
||||
* @param args arguments provided
|
||||
* @return was successful
|
||||
*/
|
||||
List<String> onTabComplete(ViaCommandSender sender, String[] args);
|
||||
}
|
||||
|
@ -41,6 +41,7 @@ public abstract class ViaCommandHandler implements ViaVersionCommand {
|
||||
return commandMap.get(name.toLowerCase());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(ViaCommandSender sender, String[] args) {
|
||||
if (args.length == 0) {
|
||||
showHelp(sender);
|
||||
@ -66,6 +67,7 @@ public abstract class ViaCommandHandler implements ViaVersionCommand {
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> onTabComplete(ViaCommandSender sender, String[] args) {
|
||||
Set<ViaSubCommand> allowed = calculateAllowedCommands(sender);
|
||||
List<String> output = new ArrayList<>();
|
||||
|
@ -17,7 +17,7 @@
|
||||
<defaultGoal>clean install</defaultGoal>
|
||||
<resources>
|
||||
<resource>
|
||||
<targetPath>.</targetPath>https://github.com/MylesIsCool/ViaVersion/blob/master/ISSUE_TEMPLATE.md
|
||||
<targetPath>.</targetPath>
|
||||
<filtering>false</filtering>
|
||||
<directory>.</directory>
|
||||
<includes>
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren