Class Webhook
Text messages can be sent directly through the send() methods, while embed
messages can be created and added using the register() method.
To send a message, the send() methods can be used. The message can be either
provided as a parameter or set in the configuration section. If the message is not
set in the configuration section and is not provided as a parameter, an empty message
will be sent.
sendAsync() can be used to send asynchronously using CompletableFuture.
- Since:
- 1.1
- Author:
- Kihsomray (forked by CroaBeast)
-
Constructor Summary
ConstructorsConstructorDescriptionWebhook(@NotNull org.bukkit.configuration.ConfigurationSection sec) Create a Discord webhook setup using a default configuration section with no message to display.Create a Discord webhook setup using a default configuration section and a default token "{message}".Create a Discord webhook setup using a default configuration section. -
Method Summary
Modifier and TypeMethodDescriptionbooleansend()Sends the webhook.booleanSends the webhook.booleanSends the webhook.voidSends the webhook asynchronously.voidSends the webhook asynchronously.voidSends the webhook asynchronously.
-
Constructor Details
-
Webhook
public Webhook(@NotNull @NotNull org.bukkit.configuration.ConfigurationSection sec, String token, String message) Create a Discord webhook setup using a default configuration section.Make sure the section looks something like this: webhook.yml
- Parameters:
sec- a valid configuration sectiontoken- a token to replacemessage- a basic message to show
-
Webhook
Create a Discord webhook setup using a default configuration section and a default token "{message}".Make sure the section looks something like this: webhook.yml
- Parameters:
sec- a valid configuration sectionmessage- a basic message to show
-
Webhook
public Webhook(@NotNull @NotNull org.bukkit.configuration.ConfigurationSection sec) Create a Discord webhook setup using a default configuration section with no message to display.Make sure the section looks something like this: webhook.yml
- Parameters:
sec- a valid configuration section
-
-
Method Details
-
send
Sends the webhook. If the webhook is null or isn't enabled, won't send anything.If any error happens when connecting to its url, will print an error in the console.
- Parameters:
token- a tokenmessage- a message if no message was declared in the constructor- Returns:
- true if was correctly sent, false otherwise
-
send
Sends the webhook. If the webhook is null or isn't enabled, won't send anything.If any error happens when connecting to its url, will print an error in the console.
- Parameters:
message- a message if no message was declared in the constructor- Returns:
- true if was correctly sent, false otherwise
-
send
public boolean send()Sends the webhook. If the webhook is null or isn't enabled, won't send anything.If any error happens when connecting to its url, will print an error in the console.
- Returns:
- true if was correctly sent, false otherwise
-
sendAsync
Sends the webhook asynchronously. Seesend(String, String)for more info.- Parameters:
token- a tokenmessage- a message if no message was declared in the constructor
-
sendAsync
Sends the webhook asynchronously. Seesend(String)for more info.- Parameters:
message- a message if no message was declared in the constructor
-
sendAsync
public void sendAsync()Sends the webhook asynchronously. Seesend()for more info.
-