From 6ab874bbdecca455a6e2ac2a7db5cda20ea17d40 Mon Sep 17 00:00:00 2001 From: UeberallGebannt Date: Tue, 5 Sep 2023 20:47:38 +0200 Subject: [PATCH] docs: Begin adding javadocs --- .../github/almightysatan/slams/Context.java | 3 +++ .../slams/minimessage/MMStringArrayEntry.java | 18 ++++++++++++++++++ .../slams/minimessage/MMStringEntry.java | 19 +++++++++++++++++++ 3 files changed, 40 insertions(+) diff --git a/core/src/main/java/io/github/almightysatan/slams/Context.java b/core/src/main/java/io/github/almightysatan/slams/Context.java index 86b8255..6527de3 100644 --- a/core/src/main/java/io/github/almightysatan/slams/Context.java +++ b/core/src/main/java/io/github/almightysatan/slams/Context.java @@ -22,6 +22,9 @@ import org.jetbrains.annotations.Nullable; +/** + * Provides additional context for language entries. + */ public interface Context { @Nullable Language language(); diff --git a/minimessage/src/main/java/io/github/almightysatan/slams/minimessage/MMStringArrayEntry.java b/minimessage/src/main/java/io/github/almightysatan/slams/minimessage/MMStringArrayEntry.java index 5b6222e..63d9dcd 100644 --- a/minimessage/src/main/java/io/github/almightysatan/slams/minimessage/MMStringArrayEntry.java +++ b/minimessage/src/main/java/io/github/almightysatan/slams/minimessage/MMStringArrayEntry.java @@ -32,8 +32,20 @@ import java.util.Arrays; import java.util.List; +/** + * {@link MMStringArrayEntry}s represent a {@link String} array in a language file parsed in MiniMessage format. + * They can be used to get a {@link Component} array. + */ public interface MMStringArrayEntry extends MMLanguageEntry { + /** + * Creates a new {@link MMStringArrayEntry} with the given path, {@link LanguageManager} and {@link ContextTagResolver}. + * + * @param path the path of the entry + * @param languageManager the language manager + * @param tagResolver the tag resolver + * @return the created entry + */ static @NotNull MMStringArrayEntry of(@NotNull String path, @NotNull LanguageManager languageManager, @Nullable ContextTagResolver tagResolver) { class MMStringArrayEntryImpl extends AbstractMMLanguageEntry implements MMStringArrayEntry { @@ -55,6 +67,12 @@ protected String[] checkType(@Nullable Object value) throws InvalidTypeException throw new InvalidTypeException(); } + /** + * Returns the value of this entry as a {@link Component} array. + * @param context the context + * @param tagResolver the tag resolver + * @return the value of this entry as a {@link Component} array + */ @Override public @NotNull Component @NotNull [] value(@Nullable Context context, @NotNull ContextTagResolver tagResolver) { Object value = this.rawValue(context); diff --git a/minimessage/src/main/java/io/github/almightysatan/slams/minimessage/MMStringEntry.java b/minimessage/src/main/java/io/github/almightysatan/slams/minimessage/MMStringEntry.java index 5fba45d..74c4cbc 100644 --- a/minimessage/src/main/java/io/github/almightysatan/slams/minimessage/MMStringEntry.java +++ b/minimessage/src/main/java/io/github/almightysatan/slams/minimessage/MMStringEntry.java @@ -29,8 +29,21 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +/** + * {@link MMStringEntry}s represent a {@link String} in a language file parsed in MiniMessage format. + * They can be used to get a {@link Component}. + */ public interface MMStringEntry extends MMLanguageEntry { + /** + * Creates a new {@link MMStringEntry} with the given path, {@link LanguageManager} and {@link ContextTagResolver}. + * If + * + * @param path the path of the entry + * @param languageManager the language manager + * @param tagResolver the tag resolver + * @return the created entry + */ static @NotNull MMStringEntry of(@NotNull String path, @NotNull LanguageManager languageManager, @Nullable ContextTagResolver tagResolver) { class MMStringEntryImpl extends AbstractMMLanguageEntry implements MMStringEntry { @@ -45,6 +58,12 @@ protected String checkType(@Nullable Object value) throws InvalidTypeException { return (String) value; } + /** + * Returns the value of this entry as a {@link Component}. + * @param context the context + * @param tagResolver the tag resolver + * @return the value of this entry as a {@link Component} + */ @Override public @NotNull Component value(@Nullable Context context, @NotNull ContextTagResolver tagResolver) { String value = this.rawValue(context);