Package io.manebot.user
Interface User
-
- All Superinterfaces:
EntityType
- All Known Implementing Classes:
User
public interface User extends EntityType
Users define individual manebot users.
-
-
Method Summary
Modifier and Type Method Description default void
addGroup(UserGroup group)
Adds this user to a specific user group.UserBan
ban(java.lang.String reason)
Bans the user until the specified dateUserBan
ban(java.lang.String reason, java.util.Date end)
Bans the user until the specified datejava.util.Collection<ChatMessage>
broadcastMessage(java.util.function.Function<ChatSender,java.util.Collection<ChatMessage>> sender)
Broadcasts the specified message receiver to the user.UserAssociation
createAssociation(Platform platform, java.lang.String id)
Creates a user connection for this user.default CommandSender
createSender(Conversation conversation, PlatformUser platformUser)
Creates a command sender for the specified user.java.util.Collection<UserAssociation>
getAssociations()
Get a list of connections that associate this user with platforms.default java.util.Collection<UserAssociation>
getAssociations(Platform platform)
Gets the list of connected IDs for this user.UserBan
getBan()
Gets the current ban on record for the user.java.util.Collection<UserBan>
getBans()
Gets a list of all previous bans on record for this user.java.lang.String
getDisplayName()
Gets this user's desired display name.default java.util.Collection<UserGroup>
getGroups()
Finds the groups this user is a member of.java.util.Collection<UserBan>
getIssuedBans()
Gets a list of all previous bans issued by this user.java.util.Date
getLastSeenDate()
Gets the date this user was last seen.java.util.Collection<UserGroupMembership>
getMembership()
Gets a collection of individual memberships, which is more definite than getUsers(), providing more specific information about membership.default java.lang.String
getName()
Gets this user's username on the system.UserPrompt
getPrompt()
Gets the current user prompt.java.util.Date
getRegisteredDate()
Gets the date this user was registered.UserType
getType()
Gets the user's system type.default UserAssociation
getUserAssociation(Platform platform, java.lang.String id)
Gets a user association by platform and ID.java.lang.String
getUsername()
Gets this user's username on the system.UserPrompt
prompt(java.util.function.Consumer<UserPrompt.Builder> consumer)
Constructs and assigns a user prompt for this user.boolean
removeAssociation(Platform platform, java.lang.String id)
Removes a user association from this user.default boolean
removeAssociation(UserAssociation association)
Removes a user association from this user.default void
removeGroup(UserGroup group)
Removes this user from a specific user group.void
setDisplayName(java.lang.String displayName)
Sets this user's desired display name.void
setLastSeenDate(java.util.Date date)
Sets the last date this user was seen.boolean
setType(UserType type)
Changes the user's system type.-
Methods inherited from interface io.manebot.entity.EntityType
checkPermission, checkPermission, checkPermission, checkPermission, getEntity, hasPermission, hasPermission, hasPermission, hasPermission
-
-
-
-
Method Detail
-
getUsername
java.lang.String getUsername()
Gets this user's username on the system.- Returns:
- Username.
-
getName
default java.lang.String getName()
Gets this user's username on the system. Equivalent to getUsername().- Returns:
- Username.
-
getDisplayName
java.lang.String getDisplayName()
Gets this user's desired display name.- Returns:
- Display name.
-
setDisplayName
void setDisplayName(java.lang.String displayName)
Sets this user's desired display name.- Parameters:
displayName
- Display name.
-
getRegisteredDate
java.util.Date getRegisteredDate()
Gets the date this user was registered.- Returns:
- Register date.
-
getLastSeenDate
java.util.Date getLastSeenDate()
Gets the date this user was last seen.- Returns:
- Last seen date.
-
setLastSeenDate
void setLastSeenDate(java.util.Date date)
Sets the last date this user was seen.- Parameters:
date
- last seen date.
-
addGroup
default void addGroup(UserGroup group)
Adds this user to a specific user group.- Parameters:
group
- UserGroup instance to add this user to.
-
removeGroup
default void removeGroup(UserGroup group)
Removes this user from a specific user group.- Parameters:
group
- UserGroup instance to remove this user from.
-
getGroups
default java.util.Collection<UserGroup> getGroups()
Finds the groups this user is a member of.- Returns:
- group collection.
-
getMembership
java.util.Collection<UserGroupMembership> getMembership()
Gets a collection of individual memberships, which is more definite than getUsers(), providing more specific information about membership.- Returns:
- immutable collection of user group membership records.
-
getAssociations
java.util.Collection<UserAssociation> getAssociations()
Get a list of connections that associate this user with platforms.- Returns:
- user associations.
-
getBans
java.util.Collection<UserBan> getBans()
Gets a list of all previous bans on record for this user.- Returns:
- immutable collection of user ban history.
-
getIssuedBans
java.util.Collection<UserBan> getIssuedBans()
Gets a list of all previous bans issued by this user.- Returns:
- immutable collection of user ban issuance history.
-
getBan
UserBan getBan()
Gets the current ban on record for the user.- Returns:
- ban instance.
-
ban
UserBan ban(java.lang.String reason, java.util.Date end) throws java.lang.SecurityException
Bans the user until the specified date- Parameters:
reason
- ban reason, may be null.end
- date the ban should end.- Returns:
- UserBan instance.
- Throws:
java.lang.SecurityException
- if there was a security violation creating the ban.
-
ban
UserBan ban(java.lang.String reason) throws java.lang.SecurityException
Bans the user until the specified date- Parameters:
reason
- ban reason, may be null.- Returns:
- UserBan instance.
- Throws:
java.lang.SecurityException
- if there was a security violation creating the ban.
-
getUserAssociation
default UserAssociation getUserAssociation(Platform platform, java.lang.String id)
Gets a user association by platform and ID.- Parameters:
platform
- Platform to search forid
- ID to search for.- Returns:
- UserAssociation instance if found, null otherwise.
-
getAssociations
default java.util.Collection<UserAssociation> getAssociations(Platform platform)
Gets the list of connected IDs for this user.- Parameters:
platform
- Platform association to search on.- Returns:
- IDs associated with the given platform for this user.
-
createAssociation
UserAssociation createAssociation(Platform platform, java.lang.String id)
Creates a user connection for this user.- Parameters:
platform
- Platform to create the association on.id
- Platform-specific ID to associate the connection to.- Returns:
- UserAssociation instance.
-
removeAssociation
default boolean removeAssociation(UserAssociation association)
Removes a user association from this user.- Parameters:
association
- Association to remove.- Returns:
- true if the association was removed, false otherwise.
-
removeAssociation
boolean removeAssociation(Platform platform, java.lang.String id)
Removes a user association from this user.- Parameters:
platform
- Platform to remove an association for.id
- Platform-specific id to remove an association for.- Returns:
- true if the association was removed, false otherwise.
-
createSender
default CommandSender createSender(Conversation conversation, PlatformUser platformUser) throws java.lang.SecurityException
Creates a command sender for the specified user.- Parameters:
conversation
- Conversation to create a command sender for.platformUser
- platform specific user instance to associate the new command sender with.- Returns:
- CommandSender instance.
- Throws:
java.lang.SecurityException
-
getType
UserType getType()
Gets the user's system type.- Returns:
- UserType instance.
-
setType
boolean setType(UserType type)
Changes the user's system type.- Parameters:
type
- UserType instance to change to.- Returns:
- true if the type was changed.
-
broadcastMessage
java.util.Collection<ChatMessage> broadcastMessage(java.util.function.Function<ChatSender,java.util.Collection<ChatMessage>> sender)
Broadcasts the specified message receiver to the user.- Parameters:
sender
- ChatSender to broadcast, constructing messages for each broadcast endpoint for the user.- Returns:
- collection of all broadcast messages.
-
getPrompt
UserPrompt getPrompt()
Gets the current user prompt.- Returns:
- user prompt instance if one exists, null otherwise.
-
prompt
UserPrompt prompt(java.util.function.Consumer<UserPrompt.Builder> consumer) throws java.lang.IllegalStateException
Constructs and assigns a user prompt for this user. UserPrompts are completed on the thread of the user after they have been manually confirmed by the target user.- Parameters:
consumer
- Consumer of a UserPrompt.Builder instance.- Returns:
- constructed UserPrompt instance.
- Throws:
java.lang.IllegalStateException
- if there is a state issue constructing the prompt.
-
-