Features
This a complex API using many factors (configurable) to decide, if player is AFK. Plugin could be useful even for people who does not develop plugins (chat commands for certain actions are included here, see Commands).- Getting player's AFK status
- Getting player's AFK time
- Getting list of AFK players
- Setting up this plugin config through API, if needed and allowed in native config file
Permissions
This plugin uses the permission system. To assign a permission, use oxide.grant <user or group> <name or steam id> <permission>. To remove a permission, use oxide.revoke <user or group> <name or steam id> <permission>.- afkapi.use - Allows player to use /isafk and /getafk commands
- afkapi.kick - Allows player to kick all the AFK players at once
Chat Commands
- /isafk <Player name or id> - gives caller the status of targeted player (AFK, NOT AFK or OFFLINE)
- /getafk - gives caller the list of AFK players
- /kickafk - kicks all the AFK players from the server at once
Configuration
The settings and options can be configured in the AFKAPI file under the config directory. The use of an editor and validator is recommended to avoid formatting issues and syntax errors.Localization
The default messages are in the AFKAPI file under the lang/en directory. To add support for another language, create a new language folder (e.g. de for German) if not already created, copy the default language file to the new folder and then customize the messages.Developer API
Getting started
You'd need to reference plugin explicitely to use most hooks.Use the magic reference to make plugin manager automatically check if the plugin is present
// Requires: AFKAPI
Use PluginReferenceAttribute to define the plugin field
Check if player is AFK
API methodWill return true if the player is AFK, returns false if it's not or player is offline (or never been on the server)
Example call
Get player AFK time
Note that this method will return time of player doing nothing (what is tracked by API), even if he is not considered AFK at the momentAPI method
Will return number of seconds. Returns -1 if the player is not AFK / offline
Example call
Get list of AFK players
API methodExample call
Setup plugin config through API
Use this function only if highly required, it's always better to setup the native config manually to avoid conflicts with other plugins using this API and featuresNew plugin settings must be given as serialized json string. Use the class below and the example method to avoid errors.
API method
Will return true if settings are applied, needToSave might be used to save config file with new parameters (You can omit this, so settings will be keeped for this session only)
Settings class
Generate string
Example call