HidekoBot/src/main/java/wtf/beatrice/hidekobot/Configuration.java

65 lines
1.7 KiB
Java
Raw Normal View History

2022-08-26 00:13:06 +02:00
package wtf.beatrice.hidekobot;
import wtf.beatrice.hidekobot.listeners.MessageLogger;
2022-08-26 00:13:06 +02:00
public class Configuration
{
private static boolean verbose = false;
private static MessageLogger verbosityLogger;
private static boolean paused = false;
private static String prefix = ".";
2022-08-26 00:13:06 +02:00
/**
* Checks if the bot has been started with the verbose argument.
*
* @return a boolean which is true if the bot is in verbose-mode
*/
2022-08-26 00:13:06 +02:00
public static boolean isVerbose() { return verbose; }
/**
* Set the bot's verbosity status at runtime.
* This also registers or unregisters the message-logger listener.
*
* @param v the verbosity boolean value
*/
public static void setVerbose(boolean v)
{
verbose = v;
if(v)
{
if(verbosityLogger == null)
{
verbosityLogger = new MessageLogger();
}
2022-08-26 00:13:06 +02:00
HidekoBot.getAPI().addEventListener(verbosityLogger);
} else {
if(verbosityLogger != null)
{
HidekoBot.getAPI().removeEventListener(verbosityLogger);
verbosityLogger = null;
}
}
}
/**
* Checks if the bot has paused all operation.
*
* @return a boolean which is true if the bot is currently paused
*/
public static boolean isPaused() { return paused; }
/**
* Set the bot in paused or unpaused state.
* Paused means that it will not reply to anything expect the unpause command.
*
* @param p a boolean specifying if the bot should be paused
*/
public static void setPaused(boolean p) { paused = p; }
2022-08-26 00:13:06 +02:00
}