From 7d9e14eb251666d719a553b50860beca3a3e67b8 Mon Sep 17 00:00:00 2001 From: tueem Date: Wed, 6 Nov 2024 14:43:49 +0100 Subject: [PATCH] add retention and target and change the annotation parameter to "value" for easier usage --- .../marinara/interaction/annotation/Button.java | 9 ++++++++- .../interaction/methods/ButtonInteractionMethod.java | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/src/main/java/net/tomatentum/marinara/interaction/annotation/Button.java b/lib/src/main/java/net/tomatentum/marinara/interaction/annotation/Button.java index 0032484..6c23a2a 100644 --- a/lib/src/main/java/net/tomatentum/marinara/interaction/annotation/Button.java +++ b/lib/src/main/java/net/tomatentum/marinara/interaction/annotation/Button.java @@ -1,5 +1,12 @@ package net.tomatentum.marinara.interaction.annotation; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Target({ElementType.METHOD}) +@Retention(RetentionPolicy.RUNTIME) public @interface Button { - public String customId(); + public String value(); //aka customId } diff --git a/lib/src/main/java/net/tomatentum/marinara/interaction/methods/ButtonInteractionMethod.java b/lib/src/main/java/net/tomatentum/marinara/interaction/methods/ButtonInteractionMethod.java index 7e1014a..165dfa0 100644 --- a/lib/src/main/java/net/tomatentum/marinara/interaction/methods/ButtonInteractionMethod.java +++ b/lib/src/main/java/net/tomatentum/marinara/interaction/methods/ButtonInteractionMethod.java @@ -34,7 +34,7 @@ public class ButtonInteractionMethod extends InteractionMethod { private void parseMethod() { Button button = getMethod().getAnnotation(Button.class); - this.customId = button.customId(); + this.customId = button.value(); } }