Skip to content

Commit

Permalink
Add display name support in ChatProfile interface
Browse files Browse the repository at this point in the history
Introduced methods for getting and setting a display name. Updated prefix and suffix methods to accept nullable values, enabling more flexible profile updates.
  • Loading branch information
NonSwag committed Aug 30, 2024
1 parent aa0e51f commit 68b1e55
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions src/main/java/net/thenextlvl/service/api/chat/ChatProfile.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package net.thenextlvl.service.api.chat;

import net.thenextlvl.service.api.node.InfoNode;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.Unmodifiable;

import java.util.Optional;
Expand All @@ -10,6 +11,14 @@
* The ChatProfile interface represents a chat profile for a user.
*/
public interface ChatProfile extends InfoNode {
/**
* Retrieves the display name associated with the chat profile.
*
* @return An Optional containing the display name of the chat profile.
* Returns an empty Optional if no display name is set.
*/
Optional<String> getDisplayName();

/**
* Retrieves the name associated with the chat profile.
*
Expand Down Expand Up @@ -50,12 +59,20 @@ public interface ChatProfile extends InfoNode {
@Unmodifiable
Set<String> getGroups();

/**
* Sets the display name associated with the chat profile.
*
* @param displayName The display name to set for the chat profile, null to clear.
* @return true if the display name was successfully set, false otherwise.
*/
boolean setDisplayName(@Nullable String displayName);

/**
* Sets the prefix associated with the chat profile.
*
* @param prefix The prefix to set for the chat profile.
*/
default boolean setPrefix(String prefix) {
default boolean setPrefix(@Nullable String prefix) {
return setPrefix(prefix, 0);
}

Expand All @@ -67,14 +84,14 @@ default boolean setPrefix(String prefix) {
* @see ChatProfile#getPrefix()
* @see ChatProfile#setPrefix(String)
*/
boolean setPrefix(String prefix, int priority);
boolean setPrefix(@Nullable String prefix, int priority);

/**
* Sets the suffix associated with the chat profile.
*
* @param suffix The suffix to set for the chat profile.
*/
default boolean setSuffix(String suffix) {
default boolean setSuffix(@Nullable String suffix) {
return setSuffix(suffix, 0);
}

Expand All @@ -86,5 +103,5 @@ default boolean setSuffix(String suffix) {
* @see ChatProfile#getSuffix()
* @see ChatProfile#setSuffix(String)
*/
boolean setSuffix(String suffix, int priority);
boolean setSuffix(@Nullable String suffix, int priority);
}

0 comments on commit 68b1e55

Please sign in to comment.