Package com.github.mafelp.discord
Class DiscordMessageBroadcast
java.lang.Object
java.lang.Thread
com.github.mafelp.discord.DiscordMessageBroadcast
- All Implemented Interfaces:
Runnable
The Thread to handle sending of discord messages, to not hang the server on Message Sending.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
-
Field Summary
Modifier and TypeFieldDescriptionprivate BroadcastType
The type of the broadcast.private String
The command that is being executed.private String
What the player has sent.private org.bukkit.entity.Player
The person, who sent the message.Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
-
Constructor Summary
ConstructorDescriptionDiscordMessageBroadcast(String command)
Constructor to define this thread as a command-info broadcast by the server.DiscordMessageBroadcast(String command, org.bukkit.entity.Player player)
The constructor to define this thread as a command-info broadcast by a player.DiscordMessageBroadcast(org.bukkit.entity.Player messageAuthor, String message)
Constructor to define this thread as a message broadcast. -
Method Summary
Modifier and TypeMethodDescriptionprivate void
The method to send a chat message.private void
The method to send a player command embed.void
run()
The executing method to run the thread and sent all the messages.private void
sendMessages(org.javacord.api.entity.message.embed.EmbedBuilder embed)
Sends the give embed to all configured channels.private void
The method to send a server command embed.Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
-
Field Details
-
messageAuthor
private final org.bukkit.entity.Player messageAuthorThe person, who sent the message. -
command
The command that is being executed. -
message
What the player has sent. -
broadcastType
The type of the broadcast.
-
-
Constructor Details
-
DiscordMessageBroadcast
Constructor to define this thread as a message broadcast.- Parameters:
messageAuthor
- The person, who sent the message.message
- The message, the messageAuthor has sent.
-
DiscordMessageBroadcast
Constructor to define this thread as a command-info broadcast by the server.- Parameters:
command
- The command that was executed.
-
DiscordMessageBroadcast
The constructor to define this thread as a command-info broadcast by a player.- Parameters:
command
- The command the player executed.player
- The player who executed the command.
-
-
Method Details
-
run
public void run()The executing method to run the thread and sent all the messages. -
sendMessages
private void sendMessages(org.javacord.api.entity.message.embed.EmbedBuilder embed)Sends the give embed to all configured channels.- Parameters:
embed
- The embed to send to the different channels.
-
messageBroadcast
private void messageBroadcast()The method to send a chat message. -
serverCommandBroadcast
private void serverCommandBroadcast()The method to send a server command embed. -
playerCommandBroadcast
private void playerCommandBroadcast()The method to send a player command embed.
-