Class DiscordMessageEvent

java.lang.Object
org.bukkit.event.Event
net.essentialsx.api.v2.events.discord.DiscordMessageEvent
All Implemented Interfaces:
Cancellable

public class DiscordMessageEvent extends Event implements Cancellable
Fired before a message is about to be sent to a Discord channel.
  • Constructor Details

    • DiscordMessageEvent

      public DiscordMessageEvent(MessageType type, String message, boolean allowGroupMentions)
      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

      public MessageType getType()
      Gets the type of this message. This also defines its destination.
      Returns:
      The message type.
    • setType

      public void setType(MessageType type)
      Sets the message type and therefore its destination.
      Parameters:
      type - The new message type.
    • getMessage

      public String getMessage()
      Gets the raw message content that is about to be sent to Discord.
      Returns:
      The raw message.
    • setMessage

      public void setMessage(String message)
      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

      public String getAvatarUrl()
      Gets the avatar URL to use for this message, or null if none is specified.
      Returns:
      The avatar URL or null.
    • setAvatarUrl

      public void setAvatarUrl(String avatarUrl)
      Sets the avatar URL for this message, or null to use the bot's avatar.
      Parameters:
      avatarUrl - The avatar URL or null.
    • getName

      public String getName()
      Gets the name to use for this message, or null if none is specified.
      Returns:
      The name or null.
    • setName

      public void setName(String name)
      Sets the name for this message, or null to use the bot's name.
      Parameters:
      name - The name or null.
    • getUUID

      public UUID 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 interface Cancellable
    • setCancelled

      public void setCancelled(boolean cancelled)
      Specified by:
      setCancelled in interface Cancellable
    • getHandlers

      @NotNull public @NotNull HandlerList getHandlers()
      Specified by:
      getHandlers in class Event
    • getHandlerList

      public static HandlerList getHandlerList()