# This is an /advanced/ feature of DiscordSRV that allows you to send messages to Discord when a game event happens # or when a command is run. You will need a working knowledge of how Bukkit events work and their properties. # If you aren't sure about what you're doing here, maybe ask a developer or join our support server @ discordsrv.com/discord # Made something you'd like to share? You can do so in our Discord server's #alerts forum (invite above) # # Refer to the Bukkit API javadoc to find events & properties to use: # https://hub.spigotmc.org/javadocs/bukkit # Helpful resources for learning how to use SpEL: # https://docs.spring.io/spring/docs/4.2.x/spring-framework-reference/html/expressions.html # https://dzone.com/articles/learn-spring-expression-language-with-examples # # You can use the following placeholders: # {tps} - server TPS # {time} - formatted time # {date} - formatted date # {name} - if alert is for a player event, the name of the player # {ping} - if alert is for a player event, the ping of the player # {username} - if alert is for a player event, the username of the player # {displayname} - if alert is for a player event, the display name of the player # {usernamenoescapes} - if alert is for a player event, the username of the player without escaping discord format (for use in inline code & code block markdown) # {displaynamenoescapes} - if alert is for a player event, the display name of the player without escaping discord format (for use in inline code & code block markdown) # {world} - if alert is for a player event, the world the player is in # {embedavatarurl} - if alert is for a player event, the avatar url for the player's head, otherwise, the bot's avatar url # {botavatarurl} - the bot's avatar url # {botname} - the bot's name # %placeholder% - any PlaceholderAPI placeholders, can only use player ones when alert is for a player event # # You can also use SpEL expressions with ${expression...}, such as... # - Getting a player's IP: ${#player.address.address.hostAddress} # - Getting a player's game mode: ${#player.gameMode.name()} # - Getting a player's linked Discord account ID: ${#discordsrv.accountLinkManager.getDiscordId(#player.uniqueId)} # - Getting the online player count: ${#server.onlinePlayers.size()} # - Getting the status of DiscordSRV's connection to Discord: ${#jda.status.name()} # - Checking if a player is in a specific world: ${#player.world.name == 'world_the_end'} # - Checking if it's day in the world that the player is in: ${#player.world.time > 0 && #player.world.time < 13000} # You can use the following expression placeholders, as seen above: # #plugins. - the specified plugin instance, null if doesn't exist # #event - the event that's triggering the alert if this alert is an event alert # #server - the Bukkit API server instance, equivalent to Bukkit#getServer # #discordsrv - the DiscordSRV plugin instance # #player - the player that the event is for, if this is a player event or command # #sender - the command sender, if this is a command alert # #command - the full command, with no leading slash, if this is a command alert # #args - the command arguments, if this is a command alert # #allArgs - the command arguments as one string, if this is a command alert # #channel - the destination channel for this alert # #jda - DiscordSRV's JDA instance that it uses to communicate with Discord # # Syntax/defaults: # - Trigger: # Async: true # optional, defaults to true, you should almost never have to change this # Conditions: # - property == < > <= >= value etc # Channel: # IgnoreCancelled: true # only for event alerts # Content: "" # Webhook: # Enabled: false # AvatarUrl: "{botavatarurl}" # Name: "{botname}" # Embed: # Enabled: true # Color: "#00ff00" # accepts a hex color code (eg. "#ffffff") or a rgb integer (eg. 0) # Author: # ImageUrl: "{embedavatarurl}" # Name: "{username} did... something." # Url: "" # ThumbnailUrl: "" # Title: # Text: "" # Url: "" # Description: "" # Fields: [] # format is "title;value;inline" (eg. "Who joined?;%displayname%;true") or "blank" to add a blank field # ImageUrl: "" # Footer: # Text: "" # IconUrl: "" # Timestamp: false # set to true to use the time the message was sent or use a epoch timestamp for a specific time (https://www.epochconverter.com/) # Alerts: # Example config to send messages to the "fish" DiscordSRV channel when a player successfully catches a fish #- Trigger: PlayerFishEvent # Channel: fish # Conditions: # - state.name() == 'CAUGHT_FISH' # Embed: # Color: "#00ff00" # Author: # ImageUrl: "{embedavatarurl}" # Name: "{name} caught a ${caught.itemStack.type.name()}!" # Example config to send Matrix anti-cheat messages #- Trigger: PlayerViolationEvent # Channel: matrix # Conditions: # - violations >= 5 # don't send events for players with < 5 violations # Embed: # Color: "#ff0000" # Author: # ImageUrl: "{embedavatarurl}" # Name: "{username} failed ${hackType.name().toLowerCase()} check | ${component} | vl:${violations} ping:${player.handle.ping} tps:{tps}" # Example config to send /gamemode messages #- Trigger: /gamemode # Channel: gamemode # Conditions: # - '#player.hasPermission("minecraft.command.gamemode") == true' # Embed: # Color: "#ff0000" # Author: # ImageUrl: "{embedavatarurl}" # Name: "{username} changed gamemode to ${#args.get(0)}" # Example config to send /me commands #- Trigger: /me # Channel: me # Conditions: # - '#player.hasPermission("minecraft.command.me") == true || #player.hasPermission("essentials.me") == true' # Embed: # Color: "#00ff00" # Author: # ImageUrl: "{embedavatarurl}" # Name: "* {username} ${#allArgs}"