Skip to content

Commit

Permalink
Add publishing of javadocs and reformat code
Browse files Browse the repository at this point in the history
  • Loading branch information
rchomczyk committed Nov 17, 2024
1 parent efc260c commit 415db7e
Show file tree
Hide file tree
Showing 28 changed files with 585 additions and 577 deletions.
1 change: 1 addition & 0 deletions buildSrc/src/main/kotlin/honey-publish.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ version = "2.0.2-SNAPSHOT"

java {
withSourcesJar()
withJavadocJar()
}

publishing {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,24 @@
import org.intellij.lang.annotations.Subst;

/**
* This class provides a mechanism to compile messages using the Adventure API MiniMessage format.
* It translates sanitized content and placeholders into formatted Adventure {@link Component}s.
*/
* This class provides a mechanism to compile messages using the Adventure API MiniMessage format.
* It translates sanitized content and placeholders into formatted Adventure {@link Component}s.
*/
final class AdventureMessageCompiler implements MessageCompiler<Component> {


private final MiniMessage miniMessage;

AdventureMessageCompiler(final MiniMessage miniMessage) {
this.miniMessage = miniMessage;
}

/**
* Compiles the sanitized content and placeholders into an Adventure {@link Component}.
*
* @param sanitizedContent The sanitized content string to be compiled.
* @param placeholders The list of sanitized placeholders to be included in the content.
* @return The compiled message as an Adventure {@link Component}.
*/
* Compiles the sanitized content and placeholders into an Adventure {@link Component}.
*
* @param sanitizedContent The sanitized content string to be compiled.
* @param placeholders The list of sanitized placeholders to be included in the content.
* @return The compiled message as an Adventure {@link Component}.
*/
@Override
public Component compile(
final String sanitizedContent, final List<SanitizedPlaceholder> placeholders) {
Expand All @@ -41,11 +40,11 @@ public Component compile(
}

/**
* Converts a list of {@link SanitizedPlaceholder} into an array of {@link TagResolver}.
*
* @param placeholders The list of placeholders to be converted.
* @return An array of {@link TagResolver}.
*/
* Converts a list of {@link SanitizedPlaceholder} into an array of {@link TagResolver}.
*
* @param placeholders The list of placeholders to be converted.
* @return An array of {@link TagResolver}.
*/
private TagResolver[] getPlaceholderTags(final List<SanitizedPlaceholder> placeholders) {
final TagResolver[] tagResolvers = new TagResolver[placeholders.size()];
for (int index = 0; index < tagResolvers.length; index++) {
Expand All @@ -56,13 +55,14 @@ private TagResolver[] getPlaceholderTags(final List<SanitizedPlaceholder> placeh
}

/**
* Creates a {@link TagResolver} based on the key and the evaluated value of the placeholder.
* The method handles different types of evaluated values by converting them into suitable tag resolutions.
*
* @param key The key associated with the placeholder.
* @param evaluatedValue The evaluated value of the placeholder.
* @return The appropriate {@link TagResolver} based on the type of evaluated value.
*/
* Creates a {@link TagResolver} based on the key and the evaluated value of the placeholder. The
* method handles different types of evaluated values by converting them into suitable tag
* resolutions.
*
* @param key The key associated with the placeholder.
* @param evaluatedValue The evaluated value of the placeholder.
* @return The appropriate {@link TagResolver} based on the type of evaluated value.
*/
private TagResolver getPlaceholderTags(
final @Subst("default") String key, final Object evaluatedValue) {
if (evaluatedValue instanceof Component component) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,28 @@
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.minimessage.MiniMessage;

/**
* Factory for creating Adventure message compilers.
*/
/** Factory for creating Adventure message compilers. */
public final class AdventureMessageCompilerFactory {

private AdventureMessageCompilerFactory() {
}
private AdventureMessageCompilerFactory() {}

/**
* Creates a message compiler using a specific MiniMessage.
*
* @param miniMessage the MiniMessage instance to use for the compiler.
* @return a new instance of {@link MessageCompiler<Component>} configured with the given MiniMessage.
*/
* Creates a message compiler using a specific MiniMessage.
*
* @param miniMessage the MiniMessage instance to use for the compiler.
* @return a new instance of {@link MessageCompiler<Component>} configured with the given
* MiniMessage.
*/
public static MessageCompiler<Component> create(final MiniMessage miniMessage) {
return new AdventureMessageCompiler(miniMessage);
}

/**
* Creates a default message compiler with default MiniMessage configuration.
*
* @return a new instance of {@link MessageCompiler<Component>} with the default MiniMessage configuration.
*/
* Creates a default message compiler with default MiniMessage configuration.
*
* @return a new instance of {@link MessageCompiler<Component>} with the default MiniMessage
* configuration.
*/
public static MessageCompiler<Component> create() {
return new AdventureMessageCompiler(miniMessage());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,39 +7,38 @@
import net.kyori.adventure.text.Component;

/**
* AdventureMessageDispatcher provides static factory methods to create various types of message dispatchers
* for use in an adventure game context. This class cannot be instantiated and provides centralized
* access to functions creating dispatchers for chat messages, action bars, and titles.
*/
* AdventureMessageDispatcher provides static factory methods to create various types of message
* dispatchers for use in an adventure game context. This class cannot be instantiated and provides
* centralized access to functions creating dispatchers for chat messages, action bars, and titles.
*/
public final class AdventureMessageDispatcher {

private AdventureMessageDispatcher() {
}
private AdventureMessageDispatcher() {}

/**
* Creates a MessageDispatcher for sending chat messages.
*
* @return A MessageDispatcher instance configured to send chat messages to an Audience.
*/
* Creates a MessageDispatcher for sending chat messages.
*
* @return A MessageDispatcher instance configured to send chat messages to an Audience.
*/
public static MessageDispatcher<Audience, Component> createChat() {
return new MessageBaseDispatcher<>(Audience.empty(), Audience::sendMessage);
}

/**
* Creates a MessageDispatcher for sending action bar messages.
*
* @return A MessageDispatcher instance configured to send action bar messages to an Audience.
*/
* Creates a MessageDispatcher for sending action bar messages.
*
* @return A MessageDispatcher instance configured to send action bar messages to an Audience.
*/
public static MessageDispatcher<Audience, Component> createActionBar() {
return new MessageBaseDispatcher<>(Audience.empty(), Audience::sendActionBar);
}

/**
* Creates a TitleMessageDispatcher for sending title messages.
*
* @return A TitleMessageDispatcher instance configured to send title messages to an Audience.
*/
* Creates a TitleMessageDispatcher for sending title messages.
*
* @return A TitleMessageDispatcher instance configured to send title messages to an Audience.
*/
public static TitleMessageDispatcher<Audience, Component> createTitle() {
return new AdventureTitleMessageDispatcher();
}
}
}
Loading

0 comments on commit 415db7e

Please sign in to comment.