1
0
Fork 0
mirror of https://github.com/xHyroM/lighteco.git synced 2024-12-22 20:41:05 +01:00

feat: better command abstraction

This commit is contained in:
Jozef Steinhübl 2023-09-02 22:37:39 +02:00
parent 670f2b5dbd
commit af006a7ebf
2 changed files with 47 additions and 0 deletions

View file

@ -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);
}
}

View file

@ -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;
}
}