Package org.javacord.api.entity.server
Class ServerUpdater
- java.lang.Object
-
- org.javacord.api.entity.server.ServerUpdater
-
public class ServerUpdater extends Object
This class can be used to update the settings of a server.
-
-
Constructor Summary
Constructors Constructor Description ServerUpdater(Server server)Creates a new server updater.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ServerUpdateraddRolesToUser(User user, Collection<Role> roles)Queues a collection of roles to be assigned to the user.ServerUpdateraddRoleToUser(User user, Role role)Queues a role to be assigned to the user.ServerUpdaterremoveAfkChannel()Queues the afk channel to be removed.ServerUpdaterremoveAllRolesFromUser(User user)Queues all roles to be removed from the user.ServerUpdaterremoveIcon()Queues the icon to be removed.ServerUpdaterremoveRoleFromUser(User user, Role role)Queues a role to be removed from the user.ServerUpdaterremoveRolesFromUser(User user, Collection<Role> roles)Queues a collection of roles to be removed from the user.ServerUpdaterremoveSplash()Queues the splash to be removed.ServerUpdaterremoveSystemChannel()Queues the system channel to be removed.ServerUpdaterreorderRoles(List<Role> roles)Sets the new order for the server's roles.ServerUpdatersetAfkChannel(ServerVoiceChannel afkChannel)Queues the afk channel to be updated.ServerUpdatersetAfkTimeoutInSeconds(int afkTimeout)Queues the afk timeout in seconds to be updated.ServerUpdatersetAuditLogReason(String reason)Sets the reason for this update.ServerUpdatersetDeafened(User user, boolean deafened)Queues a user's deafened state to be updated.ServerUpdatersetDefaultMessageNotificationLevel(DefaultMessageNotificationLevel defaultMessageNotificationLevel)Queues the default message notification level to be updated.ServerUpdatersetExplicitContentFilterLevel(ExplicitContentFilterLevel explicitContentFilterLevel)Queues the explicit content filter level to be updated.ServerUpdatersetIcon(byte[] icon)Queues the icon to be updated.ServerUpdatersetIcon(byte[] icon, String fileType)Queues the icon to be updated.ServerUpdatersetIcon(BufferedImage icon)Queues the icon to be updated.ServerUpdatersetIcon(BufferedImage icon, String fileType)Queues the icon to be updated.ServerUpdatersetIcon(File icon)Queues the icon to be updated.ServerUpdatersetIcon(InputStream icon)Queues the icon to be updated.ServerUpdatersetIcon(InputStream icon, String fileType)Queues the icon to be updated.ServerUpdatersetIcon(URL icon)Queues the icon to be updated.ServerUpdatersetIcon(Icon icon)Queues the icon to be updated.ServerUpdatersetMuted(User user, boolean muted)Queues a user's muted state to be updated.ServerUpdatersetName(String name)Queues the name to be updated.ServerUpdatersetNickname(User user, String nickname)Queues a user's nickname to be updated.ServerUpdatersetOwner(User owner)Queues the owner to be updated.ServerUpdatersetRegion(Region region)Queues the region to be updated.ServerUpdatersetSplash(byte[] splash)Queues the splash to be updated.ServerUpdatersetSplash(byte[] splash, String fileType)Queues the splash to be updated.ServerUpdatersetSplash(BufferedImage splash)Queues the splash to be updated.ServerUpdatersetSplash(BufferedImage splash, String fileType)Queues the splash to be updated.ServerUpdatersetSplash(File splash)Queues the splash to be updated.ServerUpdatersetSplash(InputStream splash)Queues the splash to be updated.ServerUpdatersetSplash(InputStream splash, String fileType)Queues the splash to be updated.ServerUpdatersetSplash(URL splash)Queues the splash to be updated.ServerUpdatersetSplash(Icon splash)Queues the splash to be updated.ServerUpdatersetSystemChannel(ServerTextChannel systemChannel)Queues the system channel to be updated.ServerUpdatersetVerificationLevel(VerificationLevel verificationLevel)Queues the verification level to be updated.ServerUpdatersetVoiceChannel(User user, ServerVoiceChannel channel)Queues a moving a user to a different voice channel.CompletableFuture<Void>update()Performs the queued updates.
-
-
-
Constructor Detail
-
ServerUpdater
public ServerUpdater(Server server)
Creates a new server updater.- Parameters:
server- The server to update.
-
-
Method Detail
-
setAuditLogReason
public ServerUpdater setAuditLogReason(String reason)
Sets the reason for this update. This reason will be visible in the audit log entry(s).- Parameters:
reason- The reason for this update.- Returns:
- The current instance in order to chain call methods.
-
setName
public ServerUpdater setName(String name)
Queues the name to be updated.- Parameters:
name- The new name of the server.- Returns:
- The current instance in order to chain call methods.
-
setRegion
public ServerUpdater setRegion(Region region)
Queues the region to be updated.- Parameters:
region- The new region of the server.- Returns:
- The current instance in order to chain call methods.
-
setExplicitContentFilterLevel
public ServerUpdater setExplicitContentFilterLevel(ExplicitContentFilterLevel explicitContentFilterLevel)
Queues the explicit content filter level to be updated.- Parameters:
explicitContentFilterLevel- The new explicit content filter level of the server.- Returns:
- The current instance in order to chain call methods.
-
setVerificationLevel
public ServerUpdater setVerificationLevel(VerificationLevel verificationLevel)
Queues the verification level to be updated.- Parameters:
verificationLevel- The new verification level of the server.- Returns:
- The current instance in order to chain call methods.
-
setDefaultMessageNotificationLevel
public ServerUpdater setDefaultMessageNotificationLevel(DefaultMessageNotificationLevel defaultMessageNotificationLevel)
Queues the default message notification level to be updated.- Parameters:
defaultMessageNotificationLevel- The new default message notification level of the server.- Returns:
- The current instance in order to chain call methods.
-
setAfkChannel
public ServerUpdater setAfkChannel(ServerVoiceChannel afkChannel)
Queues the afk channel to be updated.- Parameters:
afkChannel- The new afk channel of the server.- Returns:
- The current instance in order to chain call methods.
-
removeAfkChannel
public ServerUpdater removeAfkChannel()
Queues the afk channel to be removed.- Returns:
- The current instance in order to chain call methods.
-
setAfkTimeoutInSeconds
public ServerUpdater setAfkTimeoutInSeconds(int afkTimeout)
Queues the afk timeout in seconds to be updated.- Parameters:
afkTimeout- The new afk timeout in seconds of the server.- Returns:
- The current instance in order to chain call methods.
-
setIcon
public ServerUpdater setIcon(BufferedImage icon)
Queues the icon to be updated. This method assumes the file type is "png"!- Parameters:
icon- The new icon of the server.- Returns:
- The current instance in order to chain call methods.
-
setIcon
public ServerUpdater setIcon(BufferedImage icon, String fileType)
Queues the icon to be updated.- Parameters:
icon- The new icon of the server.fileType- The type of the icon, e.g. "png" or "jpg".- Returns:
- The current instance in order to chain call methods.
-
setIcon
public ServerUpdater setIcon(File icon)
Queues the icon to be updated.- Parameters:
icon- The new icon of the server.- Returns:
- The current instance in order to chain call methods.
-
setIcon
public ServerUpdater setIcon(Icon icon)
Queues the icon to be updated.- Parameters:
icon- The new icon of the server.- Returns:
- The current instance in order to chain call methods.
-
setIcon
public ServerUpdater setIcon(URL icon)
Queues the icon to be updated.- Parameters:
icon- The new icon of the server.- Returns:
- The current instance in order to chain call methods.
-
setIcon
public ServerUpdater setIcon(byte[] icon)
Queues the icon to be updated. This method assumes the file type is "png"!- Parameters:
icon- The new icon of the server.- Returns:
- The current instance in order to chain call methods.
-
setIcon
public ServerUpdater setIcon(byte[] icon, String fileType)
Queues the icon to be updated.- Parameters:
icon- The new icon of the server.fileType- The type of the icon, e.g. "png" or "jpg".- Returns:
- The current instance in order to chain call methods.
-
setIcon
public ServerUpdater setIcon(InputStream icon)
Queues the icon to be updated. This method assumes the file type is "png"!- Parameters:
icon- The new icon of the server.- Returns:
- The current instance in order to chain call methods.
-
setIcon
public ServerUpdater setIcon(InputStream icon, String fileType)
Queues the icon to be updated.- Parameters:
icon- The new icon of the server.fileType- The type of the icon, e.g. "png" or "jpg".- Returns:
- The current instance in order to chain call methods.
-
removeIcon
public ServerUpdater removeIcon()
Queues the icon to be removed.- Returns:
- The current instance in order to chain call methods.
-
setOwner
public ServerUpdater setOwner(User owner)
Queues the owner to be updated. You must be the owner of this server in order to transfer it!- Parameters:
owner- The new owner of the server.- Returns:
- The current instance in order to chain call methods.
-
setSplash
public ServerUpdater setSplash(BufferedImage splash)
Queues the splash to be updated. This method assumes the file type is "png"!- Parameters:
splash- The new splash of the server.- Returns:
- The current instance in order to chain call methods.
-
setSplash
public ServerUpdater setSplash(BufferedImage splash, String fileType)
Queues the splash to be updated.- Parameters:
splash- The new splash of the server.fileType- The type of the splash, e.g. "png" or "jpg".- Returns:
- The current instance in order to chain call methods.
-
setSplash
public ServerUpdater setSplash(File splash)
Queues the splash to be updated.- Parameters:
splash- The new splash of the server.- Returns:
- The current instance in order to chain call methods.
-
setSplash
public ServerUpdater setSplash(Icon splash)
Queues the splash to be updated.- Parameters:
splash- The new splash of the server.- Returns:
- The current instance in order to chain call methods.
-
setSplash
public ServerUpdater setSplash(URL splash)
Queues the splash to be updated.- Parameters:
splash- The new splash of the server.- Returns:
- The current instance in order to chain call methods.
-
setSplash
public ServerUpdater setSplash(byte[] splash)
Queues the splash to be updated. This method assumes the file type is "png"!- Parameters:
splash- The new splash of the server.- Returns:
- The current instance in order to chain call methods.
-
setSplash
public ServerUpdater setSplash(byte[] splash, String fileType)
Queues the splash to be updated.- Parameters:
splash- The new splash of the server.fileType- The type of the splash, e.g. "png" or "jpg".- Returns:
- The current instance in order to chain call methods.
-
setSplash
public ServerUpdater setSplash(InputStream splash)
Queues the splash to be updated. This method assumes the file type is "png"!- Parameters:
splash- The new splash of the server.- Returns:
- The current instance in order to chain call methods.
-
setSplash
public ServerUpdater setSplash(InputStream splash, String fileType)
Queues the splash to be updated.- Parameters:
splash- The new splash of the server.fileType- The type of the splash, e.g. "png" or "jpg".- Returns:
- The current instance in order to chain call methods.
-
removeSplash
public ServerUpdater removeSplash()
Queues the splash to be removed.- Returns:
- The current instance in order to chain call methods.
-
setSystemChannel
public ServerUpdater setSystemChannel(ServerTextChannel systemChannel)
Queues the system channel to be updated.- Parameters:
systemChannel- The new system channel of the server.- Returns:
- The current instance in order to chain call methods.
-
removeSystemChannel
public ServerUpdater removeSystemChannel()
Queues the system channel to be removed.- Returns:
- The current instance in order to chain call methods.
-
setNickname
public ServerUpdater setNickname(User user, String nickname)
Queues a user's nickname to be updated.- Parameters:
user- The user whose nickname should be updated.nickname- The new nickname of the user.- Returns:
- The current instance in order to chain call methods.
-
setMuted
public ServerUpdater setMuted(User user, boolean muted)
Queues a user's muted state to be updated.- Parameters:
user- The user whose muted state should be updated.muted- The new muted state of the user.- Returns:
- The current instance in order to chain call methods.
-
setDeafened
public ServerUpdater setDeafened(User user, boolean deafened)
Queues a user's deafened state to be updated.- Parameters:
user- The user whose deafened state should be updated.deafened- The new deafened state of the user.- Returns:
- The current instance in order to chain call methods.
-
setVoiceChannel
public ServerUpdater setVoiceChannel(User user, ServerVoiceChannel channel)
Queues a moving a user to a different voice channel.- Parameters:
user- The user who should be moved.channel- The new voice channel of the user.- Returns:
- The current instance in order to chain call methods.
-
reorderRoles
public ServerUpdater reorderRoles(List<Role> roles)
Sets the new order for the server's roles.- Parameters:
roles- An ordered list with the new role positions.- Returns:
- The current instance in order to chain call methods.
-
addRoleToUser
public ServerUpdater addRoleToUser(User user, Role role)
Queues a role to be assigned to the user.- Parameters:
user- The server member the role should be added to.role- The role which should be added to the server member.- Returns:
- The current instance in order to chain call methods.
-
addRolesToUser
public ServerUpdater addRolesToUser(User user, Collection<Role> roles)
Queues a collection of roles to be assigned to the user.- Parameters:
user- The server member the role should be added to.roles- The roles which should be added to the server member.- Returns:
- The current instance in order to chain call methods.
-
removeRoleFromUser
public ServerUpdater removeRoleFromUser(User user, Role role)
Queues a role to be removed from the user.- Parameters:
user- The server member the role should be removed from.role- The role which should be removed from the user.- Returns:
- The current instance in order to chain call methods.
-
removeRolesFromUser
public ServerUpdater removeRolesFromUser(User user, Collection<Role> roles)
Queues a collection of roles to be removed from the user.- Parameters:
user- The server member the roles should be removed from.roles- The roles which should be removed from the user.- Returns:
- The current instance in order to chain call methods.
-
removeAllRolesFromUser
public ServerUpdater removeAllRolesFromUser(User user)
Queues all roles to be removed from the user.- Parameters:
user- The server member the roles should be removed from.- Returns:
- The current instance in order to chain call methods.
-
update
public CompletableFuture<Void> update()
Performs the queued updates.- Returns:
- A future to check if the update was successful.
-
-