public interface JTS3ServerMod_Interface
Modifier and Type | Field and Description |
---|---|
static byte |
ERROR_LEVEL_CRITICAL
Use this log level if a critical error occurred, which have to stop the bot in most cases.
|
static byte |
ERROR_LEVEL_DEBUG
Use this log level for debugging purposes only.
|
static byte |
ERROR_LEVEL_ERROR
Use this log level if an error occurred or the configuration is wrong.
|
static byte |
ERROR_LEVEL_INFO
Use this log level for info messages (something was done successful or stuff like that).
|
static byte |
ERROR_LEVEL_WARNING
Use this log level to warn the user about a possible problem, but everything could work like expected.
|
static int |
LIST_AWAY
Use this constant at the setListModes() method.
|
static int |
LIST_COUNTRY
Use this constant at the setListModes() method.
|
static int |
LIST_GROUPS
Use this constant at the setListModes() method.
|
static int |
LIST_INFO
Use this constant at the setListModes() method.
|
static int |
LIST_IP
Use this constant at the setListModes() method.
|
static int |
LIST_TIMES
Use this constant at the setListModes() method.
|
static int |
LIST_UID
Use this constant at the setListModes() method.
|
static int |
LIST_VOICE
Use this constant at the setListModes() method.
|
static String |
VERSION
Human readable version string, which will be used everywhere to show JTS3ServerMod version to users.
|
static long |
VERSION_BUILD
Internal version number for comparing version for version check or plugins.
|
Modifier and Type | Method and Description |
---|---|
void |
addBotTimer(TimerTask task,
long firstStart,
long interval)
Add your TimerTask to the bot timer.
|
void |
addLogEntry(String functionName,
byte type,
String msg,
boolean outputToSystemOut)
Add a log entry to the bot log.
|
void |
addLogEntry(String functionName,
Throwable e,
boolean outputToSystemOut)
Add a throwable stack trace to the bot log.
|
void |
addTS3ChannelEvent(Object obj)
Register function for Teamspeak 3 channel events.
|
void |
addTS3ServerEvent(Object obj)
Register function for Teamspeak 3 server events.
|
Vector<HashMap<String,String>> |
getChannelGroupCache()
Returns the channel group list cache.
|
String |
getChannelGroupName(int groupID)
Returns the channel group name of the channel group id.
|
int |
getChannelGroupType(int groupID)
Returns the channel group type of the channel group id.
|
Vector<HashMap<String,String>> |
getChannelList()
Returns the last loaded channel list from the currently connected Teamspeak 3 server.
|
String |
getChannelName(int channelID)
Returns the channel name of the channel id.
|
int |
getCheckInterval()
Returns the current check interval of the JTS3ServerMod.
|
ClientDatabaseCache_Interface |
getClientCache()
Returns the used instance of the ClientDatabaseCache, which contains the client database cache, like unique id, ip address, names and last connected time of all clients, of the currently connected server.
|
int |
getClientDBID(String uniqueID)
Returns the client database id of a client with the given unique id.
|
Vector<HashMap<String,String>> |
getClientList()
Returns the last loaded client list from the currently connected Teamspeak 3 server.
|
HashMap<String,String> |
getClientListEntry(int clientID)
Returns a clientlist entry of a single client.
|
int |
getDefaultChannelID()
Returns the default channel id of the Teamspeak 3 server.
|
String |
getDifferenceTime(long from,
long to)
Returns a human readable String with the difference between two time stamps.
|
String |
getFileSizeString(long size,
boolean base1000)
Reformats the a size in bytes into human readable GB/GiB, MB/MiB or KB/KiB sizes, depends on the size.
|
long |
getIdleTime(HashMap<String,String> clientInfo,
int ignoreInChannel)
Extracts the client_idle_time from the clientInfo HashMap, converts this to a long and writes down a warning to the bot log, if the Teamspeak 3 server returned an invalid value (which can happen rarely).
|
int |
getInstanceID()
Returns the virtual bot instance id in the MySQL database.
|
int |
getListedGroup(String groupIDs,
Vector<Integer> list)
Returns the first group id, which is listed in the Vector list and in the comma separated list of groups as well.
|
short |
getMaxMessageLength(String type)
Request the maximum allowed length for messages.
|
String |
getMessageEncoding()
Returns the message encoding, which was selected by the user.
|
MySQLConnect |
getMySQLConnection()
Returns the used instance of the MySQL connection.
|
Vector<HashMap<String,String>> |
getServerGroupCache()
Returns the server group list cache.
|
String |
getServerGroupName(int groupID)
Returns the server group name of the server group id.
|
int |
getServerGroupType(int groupID)
Returns the server group type of the server group id.
|
ServerInfoCache_Interface |
getServerInfoCache()
Returns the used instance of the ServerInfoCache, which contains some information about the currently connected server.
|
String |
getStringFromTimestamp(long timestamp)
Converts the time stamp in milliseconds to a string containing the date and time with the user defined formatting rules.
|
int |
getUTF8Length(CharSequence sequence)
Get the UTF-8 byte size of a string with UTF-8 characters, important for TS3 chat messages (with a maximum of 1024).
|
String |
getVersionString(String version)
Reformats the client version string of the Teamspeak 3 client into a human readable version string with date and time.
|
boolean |
isGlobalMessageVarsEnabled()
Returns if the global message variables are enabled or disabled.
|
boolean |
isGroupListed(String groupIDs,
int searchGroupID)
Check if the comma separated list of groups contains the given group id.
|
boolean |
isGroupListed(String groupIDs,
Vector<Integer> list)
Check if the Vector list contains any of the comma separated list of groups.
|
boolean |
isIDListed(int searchID,
Vector<Integer> list)
Check if a Vector list contains a given id.
|
boolean |
isLocalClientDatabaseCacheEnabled()
Check if the local Client Database Cache is enabled in the bot configuration.
|
boolean |
isMessageLengthValid(String type,
String message)
Check if the message length is valid.
|
boolean |
isUIDListed(Vector<String> uidList,
String uid)
Check if the given unique id is in the Vector.
|
boolean |
loadMessages(String configPrefix,
String configKey_Path,
String[] configValues)
Loads messages from a simple messages file by keeping the messages encoding set by the user.
|
boolean |
removeChannelListEntry(int channelID)
Removes a channellist entry of a single channel.
|
boolean |
removeClientListEntry(int clientID)
Removes a clientlist entry of a single client.
|
String |
replaceGlobalMessageVars(String message)
Replace the global message variables at the given string.
|
boolean |
sendMessageToClient(String configPrefix,
String mode,
int clientID,
String message)
Send a chat or poke message to a client.
|
boolean |
setChannelName(int channelID,
String newName)
Set a new channel name in the channellist cache entry of a single channel.
|
void |
unloadFunction(Object c)
Use this to unload a function.
|
static final byte ERROR_LEVEL_CRITICAL
static final byte ERROR_LEVEL_DEBUG
static final byte ERROR_LEVEL_ERROR
static final byte ERROR_LEVEL_INFO
static final byte ERROR_LEVEL_WARNING
static final int LIST_AWAY
client_away
and client_away_message
to the clientlist.static final int LIST_COUNTRY
client_country
to the clientlist.static final int LIST_GROUPS
client_servergroups
, client_channel_group_id
and client_channel_group_inherited_channel_id
to the clientlist.static final int LIST_INFO
client_version
and client_platform
to the clientlist.static final int LIST_IP
connection_client_ip
to the clientlist.static final int LIST_TIMES
client_idle_time
, client_created
and client_lastconnected
to the clientlist.static final int LIST_UID
client_unique_identifier
to the clientlist.static final int LIST_VOICE
client_flag_talking
, client_input_muted
, client_output_muted
, client_input_hardware
, client_output_hardware
, client_talk_power
, client_is_talker
, client_is_priority_speaker
, client_is_recording
and client_is_channel_commander
to the clientlist.static final String VERSION
static final long VERSION_BUILD
void addBotTimer(TimerTask task, long firstStart, long interval)
task
- Your TimerTaskfirstStart
- The first start time in millisecondsinterval
- The interval of the TimerTask in millisecondsvoid addLogEntry(String functionName, byte type, String msg, boolean outputToSystemOut)
JTS3ServerMod_Interface
, constant names starts with ERROR_LEVEL_.functionName
- The config prefix from HandleBotEvents.initClass(JTS3ServerMod_Interface, de.stefan1200.jts3serverquery.JTS3ServerQuery, String)
type
- Log error levelmsg
- Message as String for the bot logoutputToSystemOut
- Set to true
, if this should be printed to the system standard output stream. In most cases this should be false
for plugins.ERROR_LEVEL_DEBUG
,
ERROR_LEVEL_INFO
,
ERROR_LEVEL_WARNING
,
ERROR_LEVEL_ERROR
,
ERROR_LEVEL_CRITICAL
void addLogEntry(String functionName, Throwable e, boolean outputToSystemOut)
functionName
- The config prefix from HandleBotEvents.initClass(JTS3ServerMod_Interface, de.stefan1200.jts3serverquery.JTS3ServerQuery, String)
e
- Throwable for the bot logoutputToSystemOut
- Set to true
, if this should be printed to the system standard output stream. In most cases this should be false
for plugins.void addTS3ChannelEvent(Object obj)
HandleTS3Events#handleClientEvents(String, HashMap)
at the given class.obj
- The class of the function which implements the HandleTS3Events
interface.HandleTS3Events#handleClientEvents(String, HashMap)
void addTS3ServerEvent(Object obj)
HandleTS3Events#handleClientEvents(String, HashMap)
at the given class.obj
- The class of the function which implements the HandleTS3Events
interface.HandleTS3Events#handleClientEvents(String, HashMap)
Vector<HashMap<String,String>> getChannelGroupCache()
String getChannelGroupName(int groupID)
groupID
- The channel group id of the channel groupnull
, if the channel group id was not found (or is currently not cached).int getChannelGroupType(int groupID)
groupID
- The channel group id of the channel groupVector<HashMap<String,String>> getChannelList()
String getChannelName(int channelID)
channelID
- The channel id of the channelnull
, if the channel id was not found (or is currently not cached).int getCheckInterval()
ClientDatabaseCache_Interface getClientCache()
ClientDatabaseCache_Interface
int getClientDBID(String uniqueID)
uniqueID
- The unique id of the clientVector<HashMap<String,String>> getClientList()
HashMap<String,String> getClientListEntry(int clientID)
clientID
- The client id as intnull
if not.int getDefaultChannelID()
String getDifferenceTime(long from, long to)
from
- Smaller time stampto
- Higher time stampString getFileSizeString(long size, boolean base1000)
size
- The size in bytes as long.base1000
- Set true
to use the base 1000 for the size.long getIdleTime(HashMap<String,String> clientInfo, int ignoreInChannel)
clientInfo
- HashMap containing the client infoignoreInChannel
- Set a channel id here, to prevent writing a warning to the bot log, if the client is in the given channel id.int getInstanceID()
int getListedGroup(String groupIDs, Vector<Integer> list)
groupIDs
- A comma separated list of groupslist
- The list as Vector containing Integershort getMaxMessageLength(String type)
isMessageLengthValid(String, String)
instead.type
- chat
, kick
or poke
is possible here.isMessageLengthValid(String, String)
String getMessageEncoding()
MySQLConnect getMySQLConnection()
MySQLConnect
Vector<HashMap<String,String>> getServerGroupCache()
String getServerGroupName(int groupID)
groupID
- The server group id of the server groupnull
, if the server group id was not found (or is currently not cached).int getServerGroupType(int groupID)
groupID
- The server group id of the server groupServerInfoCache_Interface getServerInfoCache()
ServerInfoCache_Interface
String getStringFromTimestamp(long timestamp)
timestamp
- The time stamp you want to convert into a String.int getUTF8Length(CharSequence sequence)
sequence
- The stringString getVersionString(String version)
version
- The Teamspeak 3 client version string from the clientlist or clientinfo.boolean isGlobalMessageVarsEnabled()
replaceGlobalMessageVars(String)
method to replace the global message variables.sendMessageToClient(String, String, int, String)
method.false
, if the global message variables are disabled, true
if enabled.replaceGlobalMessageVars(String)
boolean isGroupListed(String groupIDs, int searchGroupID)
groupIDs
- A comma separated list of groupssearchGroupID
- A single group id as inttrue
, if the list contains the given id, false
if not.boolean isGroupListed(String groupIDs, Vector<Integer> list)
groupIDs
- A comma separated list of groupslist
- The list as Vector containing Integerstrue
, if the list contains the given id, false
if not.boolean isIDListed(int searchID, Vector<Integer> list)
searchID
- The idlist
- The list as Vector containing Integertrue
, if the list contains the given id, false
if not.boolean isLocalClientDatabaseCacheEnabled()
true
, if the local Client Database Cache is enabled in the bot configuration, false
if not.boolean isMessageLengthValid(String type, String message)
type
- chat
, kick
or poke
is possible here.message
- The message as string.false
, if the message length is not valid. true
if everything is good.boolean isUIDListed(Vector<String> uidList, String uid)
uidList
- The list as Vector containing Stringsuid
- The unique id as Stringtrue
, if the list contains the given unique id, false
if not.boolean loadMessages(String configPrefix, String configKey_Path, String[] configValues)
# JTS3ServerMod Config File
configValues
, all following lines will be ignores.String[] configKeys = {configPrefix + "_firstMessage", configPrefix + "_secondMessage"}; if (!modClass.loadMessages(configPrefix, "_file", configKeys)) { throw new BotConfigurationException("Messages could not be loaded!"); } String firstMessage = config.getValue(configKeys[0]); String secondMessage = config.getValue(configKeys[1]);
configPrefix
- The config prefix from HandleBotEvents.initClass(JTS3ServerMod_Interface, de.stefan1200.jts3serverquery.JTS3ServerQuery, String)
configKey_Path
- The config suffix which contains the file path to the messages.configValues
- A String array with the config key names, where the messages should be stored. Needs to be in the same order as in the messages file.false
, if anything was going wrong while loading the messages. More information are printed into the log file. true
if everything was good or the MySQL mode is activated (in this case all messages are already loaded from the database).boolean removeChannelListEntry(int channelID)
channelID
- The channel id as inttrue
, if the channel was found and removed from the last received channellist, false
if not.boolean removeClientListEntry(int clientID)
clientID
- The client id as inttrue
, if the client was found and removed from the last received clientlist, false
if not.String replaceGlobalMessageVars(String message)
sendMessageToClient(String, String, int, String)
method.message
- The message which might contain global message variables.isGlobalMessageVarsEnabled()
boolean sendMessageToClient(String configPrefix, String mode, int clientID, String message)
§+§
will be parsed automatically and will send multiple messages to the client.configPrefix
- The config prefix from HandleBotEvents.initClass(JTS3ServerMod_Interface, de.stefan1200.jts3serverquery.JTS3ServerQuery, String)
mode
- chat
or poke
is possible here.clientID
- The client id of the target client.message
- The message as string.false
, if anything was going wrong while sending the messages to the client. More information are printed into the log file. true
if everything was good.boolean setChannelName(int channelID, String newName)
channelID
- The channel id as intnewName
- The new channel name as Stringtrue
, if the channel was found and the name was changed successfully, false
if not.void unloadFunction(Object c)
unloadFunction(this)
within the own class.c
- The class of the function.