Package com.github.mafelp.commands
Class GameCommand
java.lang.Object
java.lang.Thread
com.github.mafelp.commands.GameCommand
- All Implemented Interfaces:
java.lang.Runnable
public class GameCommand
extends java.lang.Thread
The class that handles the asynchronous execution of the game command.
-
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 java.util.List<java.lang.String>
games
The list of games, specified in the configuration of the server, on which the message was sent on.private static org.apache.logging.log4j.Logger
logger
The logger which is used to log statements to the console.private org.javacord.api.event.message.MessageCreateEvent
messageCreateEvent
The Event that is being passed to this class by the discord API.private static java.util.Random
random
The instance to select a random game.private static long
threadID
The number of threads of this kind that were being created.Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
-
Constructor Summary
Constructors Constructor Description GameCommand(org.javacord.api.event.message.MessageCreateEvent messageCreateEvent, java.util.List<java.lang.String> games)
The "Default" Constructor -
Method Summary
Modifier and Type Method Description void
run()
The method handles the actual execution of this command.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
-
threadID
private static long threadIDThe number of threads of this kind that were being created. -
messageCreateEvent
private final org.javacord.api.event.message.MessageCreateEvent messageCreateEventThe Event that is being passed to this class by the discord API. -
games
private final java.util.List<java.lang.String> gamesThe list of games, specified in the configuration of the server, on which the message was sent on. -
random
private static final java.util.Random randomThe instance to select a random game. -
logger
private static final org.apache.logging.log4j.Logger loggerThe logger which is used to log statements to the console.
-
-
Constructor Details
-
GameCommand
public GameCommand(org.javacord.api.event.message.MessageCreateEvent messageCreateEvent, java.util.List<java.lang.String> games)The "Default" Constructor- Parameters:
messageCreateEvent
- The Event that is being passed to this class by the discord API.games
- The list of games specified in the configuration of the server, on which the message was sent.
-
-
Method Details
-
run
public void run()The method handles the actual execution of this command.- Specified by:
run
in interfacejava.lang.Runnable
- Overrides:
run
in classjava.lang.Thread
-