Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-12-27 00:22:51 +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;
|
package us.myles.ViaVersion.api.command;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public interface ViaVersionCommand {
|
public interface ViaVersionCommand {
|
||||||
/**
|
/**
|
||||||
* Register your own subcommand inside ViaVersion
|
* Register your own subcommand inside ViaVersion
|
||||||
@ -24,4 +26,22 @@ public interface ViaVersionCommand {
|
|||||||
* @return ViaSubCommand instance
|
* @return ViaSubCommand instance
|
||||||
*/
|
*/
|
||||||
ViaSubCommand getSubCommand(String name);
|
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());
|
return commandMap.get(name.toLowerCase());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean onCommand(ViaCommandSender sender, String[] args) {
|
public boolean onCommand(ViaCommandSender sender, String[] args) {
|
||||||
if (args.length == 0) {
|
if (args.length == 0) {
|
||||||
showHelp(sender);
|
showHelp(sender);
|
||||||
@ -66,6 +67,7 @@ public abstract class ViaCommandHandler implements ViaVersionCommand {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public List<String> onTabComplete(ViaCommandSender sender, String[] args) {
|
public List<String> onTabComplete(ViaCommandSender sender, String[] args) {
|
||||||
Set<ViaSubCommand> allowed = calculateAllowedCommands(sender);
|
Set<ViaSubCommand> allowed = calculateAllowedCommands(sender);
|
||||||
List<String> output = new ArrayList<>();
|
List<String> output = new ArrayList<>();
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
<defaultGoal>clean install</defaultGoal>
|
<defaultGoal>clean install</defaultGoal>
|
||||||
<resources>
|
<resources>
|
||||||
<resource>
|
<resource>
|
||||||
<targetPath>.</targetPath>https://github.com/MylesIsCool/ViaVersion/blob/master/ISSUE_TEMPLATE.md
|
<targetPath>.</targetPath>
|
||||||
<filtering>false</filtering>
|
<filtering>false</filtering>
|
||||||
<directory>.</directory>
|
<directory>.</directory>
|
||||||
<includes>
|
<includes>
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren