diff --git a/src/main/java/io/github/gaming32/worldhost/plugin/FriendAdder.java b/src/main/java/io/github/gaming32/worldhost/plugin/FriendAdder.java index 0eed9e0..c6c5b58 100644 --- a/src/main/java/io/github/gaming32/worldhost/plugin/FriendAdder.java +++ b/src/main/java/io/github/gaming32/worldhost/plugin/FriendAdder.java @@ -4,7 +4,13 @@ import java.util.function.Consumer; +/** + * Manages adding friends with the add friends screen. + */ public interface FriendAdder { + /** + * A descriptive label for this {@link FriendAdder}. Typically, this matches the plugin's name. + */ Component label(); /** diff --git a/src/main/java/io/github/gaming32/worldhost/plugin/FriendListFriend.java b/src/main/java/io/github/gaming32/worldhost/plugin/FriendListFriend.java index ab75040..551a994 100644 --- a/src/main/java/io/github/gaming32/worldhost/plugin/FriendListFriend.java +++ b/src/main/java/io/github/gaming32/worldhost/plugin/FriendListFriend.java @@ -5,21 +5,42 @@ import java.util.Optional; +/** + * Represents a friend to display in the friend list or on the add friend screen. + */ public interface FriendListFriend extends Profilable { /** * Handles adding a friend. This should only be overridden if you implement a {@link FriendAdder}. + * @param refresher {@link Runnable} to invoke when adding is complete. This may be called from any thread. */ default void addFriend(boolean notify, Runnable refresher) { } + /** + * Whether this friend supports the ability to toggle sending a notification when they are added. Even if this + * returns {@code true}, the notification need not be shown if the user receiving the friend request disables such + * notifications. + */ default boolean supportsNotifyAdd() { return false; } + /** + * Removes this friend from the friend list. + * @param refresher {@link Runnable} to invoke when removal is complete. This may be called from any thread. + */ void removeFriend(Runnable refresher); + /** + * Displays friend information in some capacity. This may be displaying an info screen or opening a webpage. + * @param parentScreen The screen to return to if the user closes a screen you open for this purpose. + */ void showFriendInfo(Screen parentScreen); + /** + * A "tag" to show next to the friend's name, if any. If specified, the friend's name will be displayed as + * "Username (Tag)". + */ default Optional tag() { return Optional.empty(); } diff --git a/src/main/java/io/github/gaming32/worldhost/plugin/InfoTextsCategory.java b/src/main/java/io/github/gaming32/worldhost/plugin/InfoTextsCategory.java index 941224a..e9756af 100644 --- a/src/main/java/io/github/gaming32/worldhost/plugin/InfoTextsCategory.java +++ b/src/main/java/io/github/gaming32/worldhost/plugin/InfoTextsCategory.java @@ -1,6 +1,20 @@ package io.github.gaming32.worldhost.plugin; +/** + * Represents a category on which to display info texts. + * + * @see WorldHostPlugin#getInfoTexts + */ public enum InfoTextsCategory { + /** + * Text to display on the friends list screen. The text will be displayed at the bottom of the screen, above the + * buttons. + */ FRIENDS_SCREEN, - ONLINE_FRIENDS_SCREEN + + /** + * Text to display on the online friends screen. The text will be displayed at the bottom of the screen, above the + * buttons. + */ + ONLINE_FRIENDS_SCREEN, } diff --git a/src/main/java/io/github/gaming32/worldhost/plugin/Joinability.java b/src/main/java/io/github/gaming32/worldhost/plugin/Joinability.java index e7e4498..41984c5 100644 --- a/src/main/java/io/github/gaming32/worldhost/plugin/Joinability.java +++ b/src/main/java/io/github/gaming32/worldhost/plugin/Joinability.java @@ -2,26 +2,50 @@ import net.minecraft.ChatFormatting; import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.MutableComponent; import net.minecraft.network.chat.Style; import org.jetbrains.annotations.NotNull; import java.util.Optional; import java.util.function.UnaryOperator; +/** + * Represents the joinability of a friend. + */ public sealed interface Joinability extends Comparable { + /** + * The reason, if specified. + */ Optional reason(); + /** + * The formatting for this joinability. Typically passed into + * {@link MutableComponent#withStyle(UnaryOperator) MutableComponent.withStyle}. + */ UnaryOperator