-
Notifications
You must be signed in to change notification settings - Fork 23
AFK Kick
This plugin will kick out players that remain AFK for more than the set amount of time.
If you wish to provide immunity to certain players, then give them access to the sh_afk
command. This is not a console command, but if a user has permission to it they are immune to being warned and kicked.
Also, you can instead assign sh_afk_partial
, which will make a player immune to being kicked, but not immune to being warned.
The default config file should look something like this:
{
"KickTimeInMinutes": 15,
"MinPlayers": 10,
"MovementDelaySeconds": 0,
"Delay": 1,
"SampleIntervalInSeconds": 0.25,
"OnlyCheckOnStarted": false,
"IgnoreSpectators": false,
"KickOnConnect": false,
"KickTimeIsAFKThreshold": 0.25,
"MarkPlayersAFK": true,
"WarnMinPlayers": 5,
"Warn": true,
"WarnTimeInMinutes": 5,
"WarnActions": {
"NoImmunity": [ "NOTIFY", "MOVE_TO_READY_ROOM" ],
"PartialImmunity": [ "NOTIFY", "MOVE_TO_SPECTATE" ]
},
"Leniency": {
"NoImmunity": "STRICT",
"PartialImmunity": "STRICT"
},
"PlayerCountRules": [],
"__Version": "1.10"
}
The file should be called "AFKKick.json" and should be placed in the directory defined as your plugin config directory (default is config://shine/plugins).
There are a few options available to tune the plugin to your liking.
Option | Description |
---|---|
KickTimeInMinutes | Controls how long (in minutes) a player has to be AFK before being kicked out. |
MinPlayers | Controls how many players should be present in the server before starting to kick AFK players. When using KickOnConnect , values less than the number of player slots will be ignored. |
MovementDelaySeconds | Sets the number of seconds after a player is warned before any move actions are applied to them. |
Delay | Controls how long (in minutes) after a player joins the plugin should wait before starting to check them. |
SampleIntervalInSeconds | Controls how frequent movement should be sampled. Lower values will potentially be more costly to server performance with higher player counts, but result in more accurate tracking. |
OnlyCheckOnStarted | Controls whether to check only when a game is in progress, or all the time. |
IgnoreSpectators | Sets whether to exclude spectators from AFK checks. |
KickOnConnect | When true, players who are AFK past the kick time will not be kicked until the number of players is greater equal the larger of MinPlayers and the number of player slots, and a new player tries to join. |
KickTimeIsAFKThreshold | When a player has been AFK for KickTime * KickTimeIsAFKThreshold , they will be marked as AFK on the scoreboard. |
MarkPlayersAFK | Sets whether to mark players as AFK on the scoreboard or not. |
PlayerCountRules | An array of rules to set any of WarnTimeInMinutes , KickTimeInMinutes or MarkPlayersAFK based on the current player count. |
WarnMinPlayers | Controls how many players should be present in the server before starting to warn, but not kick, players. |
Warn | Controls whether players should be warned about being kicked. |
WarnTimeInMinutes | Controls how long (in minutes) a player has to be AFK before being warned. |
WarnActions | Controls the actions to take when a player is warned. Those under NoImmunity apply to players with no access to sh_afk or sh_afk_partial . Those under PartialImmunity apply to those with access to sh_afk_partial only.The available actions are:
|
Leniency | Controls how the plugin resets a player's AFK time. As with WarnActions , this is configurable based on immunity. The options are:
|
Some configuration options can be configured based on player count. The PlayerCountRules
field should contain an array of rules with a MaxPlayers
and optionally MinPlayers
bound at which the rule's configuration options are applied. For example:
"PlayerCountRules": [
{
"MaxPlayers": 10,
"WarnTimeInMinutes": 1,
"KickTimeInMinutes": 5,
"MarkPlayersAFK": false
}
]
This rule would set the warn time to 1 minute, the kick time to 5 minutes and disable marking players as AFK when the number of players on the server is less than or equal to 10. For all other player counts, the default values specified in the top-level configuration are used.
Command | Chat Command | Arguments | Description |
---|---|---|---|
sh_afk_status | N/A | (player) | Prints a summary of the AFK state of the given player or all players to the console. This includes the last move time and last seen action, accrued AFK time, whether the player is considered frozen, whether the player has been seen to move at all etc. |