Package com.github.mafelp.discord
Class DiscordMessageBroadcast
java.lang.Object
java.lang.Thread
com.github.mafelp.discord.DiscordMessageBroadcast
- All Implemented Interfaces:
java.lang.Runnable
public class DiscordMessageBroadcast
extends java.lang.Thread
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
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
-
Field Summary
Fields Modifier and Type Field Description private BroadcastType
broadcastType
The type of the broadcast.private java.lang.String
command
The command that is being executed.private java.lang.String
message
What the player has sent.private org.bukkit.entity.Player
messageAuthor
The person, who sent the message.Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
-
Constructor Summary
Constructors Constructor Description DiscordMessageBroadcast(java.lang.String command)
Constructor to define this thread as a command-info broadcast by the server.DiscordMessageBroadcast(java.lang.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, java.lang.String message)
Constructor to define this thread as a message broadcast. -
Method Summary
Modifier and Type Method Description private void
messageBroadcast()
The method to send a chat message.private void
playerCommandBroadcast()
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
serverCommandBroadcast()
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
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Field Details
-
messageAuthor
private final org.bukkit.entity.Player messageAuthorThe person, who sent the message. -
command
private final java.lang.String commandThe command that is being executed. -
message
private final java.lang.String messageWhat the player has sent. -
broadcastType
The type of the broadcast.
-
-
Constructor Details
-
DiscordMessageBroadcast
public DiscordMessageBroadcast(org.bukkit.entity.Player messageAuthor, java.lang.String message)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
public DiscordMessageBroadcast(java.lang.String command)Constructor to define this thread as a command-info broadcast by the server.- Parameters:
command
- The command that was executed.
-
DiscordMessageBroadcast
public DiscordMessageBroadcast(java.lang.String command, org.bukkit.entity.Player player)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.- Specified by:
run
in interfacejava.lang.Runnable
- Overrides:
run
in classjava.lang.Thread
-
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.
-