Add SWCommand.StaticValue #137
@ -47,10 +47,10 @@ dependencies {
|
||||
compileOnly files("${project.rootDir}/lib/WorldEdit-1.12.jar")
|
||||
implementation 'net.wesjd:anvilgui:1.4.0-SNAPSHOT'
|
||||
|
||||
compileOnly 'org.projectlombok:lombok:1.18.6'
|
||||
testCompileOnly 'org.projectlombok:lombok:1.18.6'
|
||||
annotationProcessor 'org.projectlombok:lombok:1.18.6'
|
||||
testAnnotationProcessor 'org.projectlombok:lombok:1.18.6'
|
||||
compileOnly 'org.projectlombok:lombok:1.18.22'
|
||||
testCompileOnly 'org.projectlombok:lombok:1.18.22'
|
||||
annotationProcessor 'org.projectlombok:lombok:1.18.22'
|
||||
testAnnotationProcessor 'org.projectlombok:lombok:1.18.22'
|
||||
}
|
||||
|
||||
processResources {
|
||||
|
@ -78,6 +78,7 @@ public abstract class SWCommand {
|
||||
}
|
||||
String string = args[args.length - 1].toLowerCase();
|
||||
return commandList.stream()
|
||||
.filter(s -> !s.noTabComplete)
|
||||
.map(s -> s.tabComplete(sender, args))
|
||||
.filter(Objects::nonNull)
|
||||
.flatMap(Collection::stream)
|
||||
@ -118,7 +119,7 @@ public abstract class SWCommand {
|
||||
Bukkit.getLogger().log(Level.WARNING, () -> "The method '" + method.toString() + "' is lacking the varArgs parameters of type '" + String.class.getTypeName() + "' as last Argument");
|
||||
return;
|
||||
}
|
||||
commandHelpList.add(new SubCommand(this, method, anno.value(), new HashMap<>(), localGuardChecker, true, null));
|
||||
commandHelpList.add(new SubCommand(this, method, anno.value(), new HashMap<>(), localGuardChecker, true, null, anno.noTabComplete()));
|
||||
});
|
||||
}
|
||||
for (Method method : methods) {
|
||||
@ -140,7 +141,7 @@ public abstract class SWCommand {
|
||||
return;
|
||||
}
|
||||
}
|
||||
commandList.add(new SubCommand(this, method, anno.value(), localTypeMapper, localGuardChecker, false, anno.description()));
|
||||
commandList.add(new SubCommand(this, method, anno.value(), localTypeMapper, localGuardChecker, false, anno.description(), anno.noTabComplete()));
|
||||
});
|
||||
|
||||
this.commandList.sort((o1, o2) -> {
|
||||
@ -287,6 +288,8 @@ public abstract class SWCommand {
|
||||
|
||||
String[] description() default {};
|
||||
|
||||
boolean noTabComplete() default false;
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ElementType.METHOD})
|
||||
@interface Registeres {
|
||||
|
@ -45,12 +45,14 @@ class SubCommand {
|
||||
GuardChecker guardChecker;
|
||||
Class<?> varArgType = null;
|
||||
private boolean help;
|
||||
boolean noTabComplete = false;
|
||||
|
||||
SubCommand(SWCommand swCommand, Method method, String[] subCommand, Map<String, TypeMapper<?>> localTypeMapper, Map<String, GuardChecker> localGuardChecker, boolean help, String[] description) {
|
||||
SubCommand(SWCommand swCommand, Method method, String[] subCommand, Map<String, TypeMapper<?>> localTypeMapper, Map<String, GuardChecker> localGuardChecker, boolean help, String[] description, boolean noTabComplete) {
|
||||
this.swCommand = swCommand;
|
||||
this.method = method;
|
||||
this.help = help;
|
||||
this.description = description;
|
||||
this.noTabComplete = noTabComplete;
|
||||
|
||||
Parameter[] parameters = method.getParameters();
|
||||
commandSenderPredicate = sender -> parameters[0].getType().isAssignableFrom(sender.getClass());
|
||||
|
@ -38,6 +38,7 @@ import java.util.logging.Level;
|
||||
|
||||
public class Core extends JavaPlugin{
|
||||
|
||||
|
||||
private static Core instance;
|
||||
private static final int version;
|
||||
public static Message MESSAGE;
|
||||
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,5 +1,5 @@
|
||||
#Wed May 05 10:45:33 CEST 2021
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.1-all.zip
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStorePath=wrapper/dists
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren