From 78e3a0ad510bd498258e015b3fd7f6c44cea3fb5 Mon Sep 17 00:00:00 2001 From: tueem Date: Sun, 13 Oct 2024 21:15:04 +0200 Subject: [PATCH] move Command Annotations --- .../command/annotation/CommandOption.java | 11 ----------- .../command/annotation/RootCommand.java | 7 ------- .../marinara/command/annotation/SubCommand.java | 7 ------- .../command/annotation/SubCommandGroup.java | 6 ------ .../commands/annotation/CommandOption.java | 17 +++++++++++++++++ .../commands/annotation/RootCommand.java | 15 +++++++++++++++ .../commands/annotation/SubCommand.java | 14 ++++++++++++++ .../commands/annotation/SubCommandGroup.java | 13 +++++++++++++ .../commands}/option/OptionType.java | 2 +- 9 files changed, 60 insertions(+), 32 deletions(-) delete mode 100644 lib/src/main/java/net/tomatentum/marinara/command/annotation/CommandOption.java delete mode 100644 lib/src/main/java/net/tomatentum/marinara/command/annotation/RootCommand.java delete mode 100644 lib/src/main/java/net/tomatentum/marinara/command/annotation/SubCommand.java delete mode 100644 lib/src/main/java/net/tomatentum/marinara/command/annotation/SubCommandGroup.java create mode 100644 lib/src/main/java/net/tomatentum/marinara/interaction/commands/annotation/CommandOption.java create mode 100644 lib/src/main/java/net/tomatentum/marinara/interaction/commands/annotation/RootCommand.java create mode 100644 lib/src/main/java/net/tomatentum/marinara/interaction/commands/annotation/SubCommand.java create mode 100644 lib/src/main/java/net/tomatentum/marinara/interaction/commands/annotation/SubCommandGroup.java rename lib/src/main/java/net/tomatentum/marinara/{command => interaction/commands}/option/OptionType.java (75%) diff --git a/lib/src/main/java/net/tomatentum/marinara/command/annotation/CommandOption.java b/lib/src/main/java/net/tomatentum/marinara/command/annotation/CommandOption.java deleted file mode 100644 index 94dc890..0000000 --- a/lib/src/main/java/net/tomatentum/marinara/command/annotation/CommandOption.java +++ /dev/null @@ -1,11 +0,0 @@ -package net.tomatentum.marinara.command.annotation; - -import net.tomatentum.marinara.command.option.OptionType; - -public @interface CommandOption { - public String name(); - public String description() default ""; - public OptionType type() default OptionType.STRING; - public boolean required() default false; - -} diff --git a/lib/src/main/java/net/tomatentum/marinara/command/annotation/RootCommand.java b/lib/src/main/java/net/tomatentum/marinara/command/annotation/RootCommand.java deleted file mode 100644 index eb1e53c..0000000 --- a/lib/src/main/java/net/tomatentum/marinara/command/annotation/RootCommand.java +++ /dev/null @@ -1,7 +0,0 @@ -package net.tomatentum.marinara.command.annotation; - -public @interface RootCommand { - public String name(); - public String description() default ""; - public CommandOption[] options() default {}; -} diff --git a/lib/src/main/java/net/tomatentum/marinara/command/annotation/SubCommand.java b/lib/src/main/java/net/tomatentum/marinara/command/annotation/SubCommand.java deleted file mode 100644 index 198b7b5..0000000 --- a/lib/src/main/java/net/tomatentum/marinara/command/annotation/SubCommand.java +++ /dev/null @@ -1,7 +0,0 @@ -package net.tomatentum.marinara.command.annotation; - -public @interface SubCommand { - public String name(); - public String description() default ""; - public CommandOption[] options() default {}; -} diff --git a/lib/src/main/java/net/tomatentum/marinara/command/annotation/SubCommandGroup.java b/lib/src/main/java/net/tomatentum/marinara/command/annotation/SubCommandGroup.java deleted file mode 100644 index 93d9a7d..0000000 --- a/lib/src/main/java/net/tomatentum/marinara/command/annotation/SubCommandGroup.java +++ /dev/null @@ -1,6 +0,0 @@ -package net.tomatentum.marinara.command.annotation; - -public @interface SubCommandGroup { - public String name(); - public String description() default ""; -} diff --git a/lib/src/main/java/net/tomatentum/marinara/interaction/commands/annotation/CommandOption.java b/lib/src/main/java/net/tomatentum/marinara/interaction/commands/annotation/CommandOption.java new file mode 100644 index 0000000..b76a9bc --- /dev/null +++ b/lib/src/main/java/net/tomatentum/marinara/interaction/commands/annotation/CommandOption.java @@ -0,0 +1,17 @@ +package net.tomatentum.marinara.interaction.commands.annotation; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +import net.tomatentum.marinara.interaction.commands.option.OptionType; + +@Target({ElementType.ANNOTATION_TYPE}) +@Retention(RetentionPolicy.RUNTIME) +public @interface CommandOption { + public String name(); + public String description() default ""; + public OptionType type() default OptionType.STRING; + public boolean required() default false; +} diff --git a/lib/src/main/java/net/tomatentum/marinara/interaction/commands/annotation/RootCommand.java b/lib/src/main/java/net/tomatentum/marinara/interaction/commands/annotation/RootCommand.java new file mode 100644 index 0000000..4ed4e2e --- /dev/null +++ b/lib/src/main/java/net/tomatentum/marinara/interaction/commands/annotation/RootCommand.java @@ -0,0 +1,15 @@ +package net.tomatentum.marinara.interaction.commands.annotation; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Target({ElementType.METHOD, ElementType.TYPE}) +@Retention(RetentionPolicy.RUNTIME) +public @interface RootCommand { + public String name(); + public String description() default ""; + public String[] aliases() default {}; + public CommandOption[] options() default {}; +} diff --git a/lib/src/main/java/net/tomatentum/marinara/interaction/commands/annotation/SubCommand.java b/lib/src/main/java/net/tomatentum/marinara/interaction/commands/annotation/SubCommand.java new file mode 100644 index 0000000..004f5cd --- /dev/null +++ b/lib/src/main/java/net/tomatentum/marinara/interaction/commands/annotation/SubCommand.java @@ -0,0 +1,14 @@ +package net.tomatentum.marinara.interaction.commands.annotation; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Target({ElementType.METHOD, ElementType.TYPE}) +@Retention(RetentionPolicy.RUNTIME) +public @interface SubCommand { + public String name(); + public String description() default ""; + public CommandOption[] options() default {}; +} diff --git a/lib/src/main/java/net/tomatentum/marinara/interaction/commands/annotation/SubCommandGroup.java b/lib/src/main/java/net/tomatentum/marinara/interaction/commands/annotation/SubCommandGroup.java new file mode 100644 index 0000000..e96dbcb --- /dev/null +++ b/lib/src/main/java/net/tomatentum/marinara/interaction/commands/annotation/SubCommandGroup.java @@ -0,0 +1,13 @@ +package net.tomatentum.marinara.interaction.commands.annotation; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Target({ElementType.METHOD, ElementType.TYPE}) +@Retention(RetentionPolicy.RUNTIME) +public @interface SubCommandGroup { + public String name(); + public String description() default ""; +} diff --git a/lib/src/main/java/net/tomatentum/marinara/command/option/OptionType.java b/lib/src/main/java/net/tomatentum/marinara/interaction/commands/option/OptionType.java similarity index 75% rename from lib/src/main/java/net/tomatentum/marinara/command/option/OptionType.java rename to lib/src/main/java/net/tomatentum/marinara/interaction/commands/option/OptionType.java index 00140cf..64d0207 100644 --- a/lib/src/main/java/net/tomatentum/marinara/command/option/OptionType.java +++ b/lib/src/main/java/net/tomatentum/marinara/interaction/commands/option/OptionType.java @@ -1,4 +1,4 @@ -package net.tomatentum.marinara.command.option; +package net.tomatentum.marinara.interaction.commands.option; public enum OptionType { ATTACHMENT,