Class DiscordMessageEvent
java.lang.Object
org.bukkit.event.Event
net.essentialsx.api.v2.events.discord.DiscordMessageEvent
- All Implemented Interfaces:
Cancellable
Fired before a message is about to be sent to a Discord channel.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.bukkit.event.Event
Event.Result
-
Constructor Summary
ConstructorDescriptionDiscordMessageEvent
(MessageType type, String message, boolean allowGroupMentions) DiscordMessageEvent
(MessageType type, String message, boolean allowGroupMentions, String avatarUrl, String name, UUID uuid) -
Method Summary
Modifier and TypeMethodDescriptionGets the avatar URL to use for this message, or null if none is specified.static HandlerList
@NotNull HandlerList
Gets the raw message content that is about to be sent to Discord.getName()
Gets the name to use for this message, or null if none is specified.getType()
Gets the type of this message.getUUID()
Gets the UUID of the player which caused this event, or null if it wasn't a player triggered event.boolean
Checks if this message allows pinging of roles/@here/@everyone.boolean
void
setAllowGroupMentions
(boolean allowGroupMentions) Sets if this message is allowed to ping roles/@here/@everyone.void
setAvatarUrl
(String avatarUrl) Sets the avatar URL for this message, or null to use the bot's avatar.void
setCancelled
(boolean cancelled) void
setMessage
(String message) Sets the raw message content to be sent to Discord.void
Sets the name for this message, or null to use the bot's name.void
setType
(MessageType type) Sets the message type and therefore its destination.Methods inherited from class org.bukkit.event.Event
getEventName, isAsynchronous
-
Constructor Details
-
DiscordMessageEvent
- Parameters:
type
- The message type/destination of this event.message
- The raw message content of this event.allowGroupMentions
- Whether the message should allow the pinging of roles, @here, or @everyone.
-
DiscordMessageEvent
public DiscordMessageEvent(MessageType type, String message, boolean allowGroupMentions, String avatarUrl, String name, UUID uuid) - Parameters:
type
- The message type/destination of this event.message
- The raw message content of this event.allowGroupMentions
- Whether the message should allow the pinging of roles, @here, or @everyone.avatarUrl
- The avatar URL to use for this message (if supported) or null to use the default bot avatar.name
- The name to use for this message (if supported) or null to use the default bot name.uuid
- The UUID of the player which caused this event or null if this wasn't a player triggered event.
-
-
Method Details
-
getType
Gets the type of this message. This also defines its destination.- Returns:
- The message type.
-
setType
Sets the message type and therefore its destination.- Parameters:
type
- The new message type.
-
getMessage
Gets the raw message content that is about to be sent to Discord.- Returns:
- The raw message.
-
setMessage
Sets the raw message content to be sent to Discord.- Parameters:
message
- The new message content.
-
isAllowGroupMentions
public boolean isAllowGroupMentions()Checks if this message allows pinging of roles/@here/@everyone.- Returns:
- true if this message is allowed to ping of roles/@here/@everyone.
-
setAllowGroupMentions
public void setAllowGroupMentions(boolean allowGroupMentions) Sets if this message is allowed to ping roles/@here/@everyone.- Parameters:
allowGroupMentions
- If pinging of roles/@here/@everyone should be allowed.
-
getAvatarUrl
Gets the avatar URL to use for this message, or null if none is specified.- Returns:
- The avatar URL or null.
-
setAvatarUrl
Sets the avatar URL for this message, or null to use the bot's avatar.- Parameters:
avatarUrl
- The avatar URL or null.
-
getName
Gets the name to use for this message, or null if none is specified.- Returns:
- The name or null.
-
setName
Sets the name for this message, or null to use the bot's name.- Parameters:
name
- The name or null.
-
getUUID
Gets the UUID of the player which caused this event, or null if it wasn't a player triggered event.- Returns:
- The UUID or null.
-
isCancelled
public boolean isCancelled()- Specified by:
isCancelled
in interfaceCancellable
-
setCancelled
public void setCancelled(boolean cancelled) - Specified by:
setCancelled
in interfaceCancellable
-
getHandlers
- Specified by:
getHandlers
in classEvent
-
getHandlerList
-