mirror of
https://github.com/xHyroM/lighteco.git
synced 2024-11-22 15:01:05 +01:00
feat: better command abstraction
This commit is contained in:
parent
670f2b5dbd
commit
af006a7ebf
2 changed files with 47 additions and 0 deletions
|
@ -0,0 +1,28 @@
|
||||||
|
package dev.xhyrom.lighteco.common.command.abstraction;
|
||||||
|
|
||||||
|
import dev.xhyrom.lighteco.common.command.argument.Argument;
|
||||||
|
import lombok.Getter;
|
||||||
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public abstract class Command {
|
||||||
|
@Getter
|
||||||
|
@NonNull
|
||||||
|
private final String name;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Nullable
|
||||||
|
private final String permission;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@NonNull
|
||||||
|
private final List<Argument> args;
|
||||||
|
|
||||||
|
public Command(@NonNull String name, @Nullable String permission, @NonNull Argument... args) {
|
||||||
|
this.name = name;
|
||||||
|
this.permission = permission;
|
||||||
|
this.args = List.of(args);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
package dev.xhyrom.lighteco.common.command.argument;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import net.kyori.adventure.text.Component;
|
||||||
|
|
||||||
|
public class Argument {
|
||||||
|
@Getter
|
||||||
|
private final String name;
|
||||||
|
@Getter
|
||||||
|
private final boolean required;
|
||||||
|
@Getter
|
||||||
|
private final Component description;
|
||||||
|
|
||||||
|
public Argument(String name, boolean required, Component description) {
|
||||||
|
this.name = name;
|
||||||
|
this.required = required;
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue