[ADMN] AfkBooter v1.0.3 - Boot players that idle too much [1000]

Discussion in 'Inactive/Unsupported Plugins' started by neromir, Feb 16, 2011.

  1. Offline

    neromir

    AfkBooter - Boot players who idle too much on your server:
    Version: v1.0.3


    This plugin is no longer being maintained by neromir. It has been taken on by morganm. Please see the BukkitDev site http://dev.bukkit.org/server-mods/afkbooter/ for the latest version, support, and questions.


    Download AfkBooter v1.0.3: jar
    Source Code: https://github.com/neromir/AfkBooter

    Important Note: If you are upgrading from pre-1.0, take special note of the listened-events property! You must set it or the plugin will not work!

    This plugin monitors the last activity time a player has on your server and will boot them if that time longer than a settable idle-allowance.

    Current version was tested against CB 1000, 935 and 953. Previous versions will work with CB 860, 818, 803, 798, 766, 740, 733, 677, 670, 617, 556, 531, and 493. Version 0.7.1 and above require 612+ due to interface changes. Version 0.4 requires at least CB 432+ due to the changes with the plugin constructor.

    Features:
    • Prevent players from idling on your server beyond a given time limit.
    • Allows you to set a list of player names who are immune to idle-kicking.
    • Allows you to set a player count threshold below which nobody will be kicked.
    • Allows you to set a custom kick message for both the kicked player to see and one that is broadcast to all players on the server when the player is kicked.
    • Allows you to determine if player idling status should be merely announced rather than having idlers kicked. If set to true, it will be announced when players are no longer idling. The kick broadcast message is used to determine the text of the message announced when a player goes idle.
    • Works with any number of people on the server (does not fail when there's only a single person on).
    • Allows you to set a kick-check frequency. Rather than arbitrarily set a kick-check interval for you, it allows you to determine what is best for your server.
    • Allows you to specify which events, out of a given set, should be listened to for purposes of activity checking.
    • Allows you to specify if players should be counted as active while moving in a vehicle.
    • Allows you to set whether idlers should be counted as "in bed" for checking if all players are in bed to move the server time forward to day.
    • Allows you to set whether idlers should be blocked from picking up items.
    • Integrated with Permissions 3.1.6. Should also work fine with Permissions 2.7.3.

    To install
    Simply put the jar file in your plugins directory for CraftBukkit. On first run it will create a file called "afkbooter.properties" in the directory "plugins/AfkBooter" and populate it with the default settings. You should then stop your server, change the settings to match what you want, and re-run it.

    To upgrade

    Important Note: If you are upgrading from pre-1.0, take special note of the listened-events property! You must set it or the plugin will not work!

    Put the new jar in your plugins directory for CraftBukkit and start the server. Use one of the below-listed commands which changes a value, such as kickTimeout, from inside the server console. You can just reset it to the already-configured value. This will update your settings file to contain all the latest settings. Stop the server, change any of the new settings. Restart and you're good.

    The properties file looks like this:

    Code:
    #Default auto-created config file. Version 1.0.2. Please change.
    #kick-timeout is amount of time (sec) players can be idle, kick-message is the message the
    #kicked player sees, kick-broadcast is the message all players see when a player is kicked (name + message), 
    #timeout-check-interval is the frequency (sec) to check for players to boot, and exempt-players is the list
    #of players not to kick at all. player-count-threshold is the number of players that must be present before
    #players start getting kicked for idling.  Set to 0 for always. Set use-jump-ignoring to use the experimental
    #code which ignores vertical movement for activity purposes. Set kick-idlers to determine whether or not idlers
    #should actually be kicked or merely announced. ignore-vehicle-movement if set to true will not consider a player's 
    #movement if they are in a vehicle. use-faux-sleep will count AFK players as "sleeping" for the purposes of beds
    #moving the clock forward; only works if kick-idlers is false.
    #Sun May 8 19:09:36 MST 2011
    exempt-players=name1,name2,name3
    use-jump-ignoring=false
    timeout-check-interval=10
    kick-message=Kicked for idling too much.
    kick-timeout=30
    kick-broadcast=kicked for idling too much.
    player-count-threshold=0
    kick-idlers=false
    ignore-vehicle-movement=false
    use-faux-sleep=false
    block-idle-items=false
    listened-events=PLAYER_MOVE,PLAYER_CHAT,INVENTORY_OPEN
    
    Note that the server broadcast for kick-broadcast will show up as "<kickedPlayerName> <kick-broadcast>". So in this case, it'd be "neromir kicked for idling too much."

    Permissions nodes:
    Code:
    - 'afkbooter.exempt'
    - 'afkbooter.config'
    
    Anyone that has the exempt node will not be kicked by the plugin. Anyone that has the config node will have access to all the below-listed commands. Note that the exempt node is in addition to any names listed in the exempt-players list in the settings file. Also note that ops have access to all commands as well, regardless of whether or not they have the config permission.

    Commands:
    Code:
    Example: /afkbooter kickTimeout [number] - Changes the idle time (sec) allowed before players are kicked.
    Example: /afkbooter kickMessage [message] - Changes the message a kicked player sees.
    Example: /afkbooter kickBroadcast [message] - Changes the message broadcast to all players when someone is kicked.
    Example: /afkbooter listExempt - List the players on the exempt list.
    Example: /afkbooter addExempt [playerName] - Add a player to the exempt list.
    Example: /afkbooter removeExempt [playerName] - Remove a player from the exempt list.
    Example: /afkbooter playercount [number] - Set the threshold below which no players will be kicked.
    Example: /afkbooter useJumpIgnore [true|false] - Set whether or not to use experimental jump ignoring code.
    Example: /afkbooter kickIdlers [true|false] - Set whether or not idlers should be kicked or merely announced as idling.
    Example: /afkbooter ignoreVehicles [true|false] - Set whether or not to ignore player movement while in vehicles.
    Example: /afkbooter useFauxSleep [true|false] - Set whether or not to use faux sleep (afk players are considered in bed).
    Example: /afkbooter blockIdleItems [true|false] - Set whether or not item pickup should be blocked for idlers.
    Example: /afkbooter list - List players marked as AFK.
    
    Also note that a player newly added to the exempt list may get kicked for idling if they are in the server when they are added. They should be exempt from tracking once they rejoin the server, however.

    A player can be considered active when the plugin catches one of the following events (depending on how you set it):
    • Join
    • Movement (looking around past a certain threshold, I believe 30 degrees, does count as movement).
    • Chat/command
    • Opening the inventory (simply holding the inventory open does not trigger this-- only the actual open inventory action does).
    • Block placement.
    • Block break.
    • Dropped item.
    • Player interacting with a block.
    • Player interacting with an entity.

    Event names which can be listed in the listened-events property:
    Code:
    PLAYER_MOVE
    PLAYER_CHAT
    PLAYER_COMMAND_PREPROCESS (to detect commands as well as chat)
    INVENTORY_OPEN (does not work currently due to Bukkit event issues with inventory)
    PLAYER_DROP_ITEM
    BLOCK_PLACE
    BLOCK_BREAK
    PLAYER_INTERACT
    PLAYER_ENTITY_INTERACT
    
    Changelog (open)

    Changelog:
    Version 1.0.3
    • Fixed an exception that was thrown if the "/afkbooter list" command was used while nobody was AFK.
    Version 1.0.2
    • Added ability to listen to PLAYER_INTERACT and PLAYER_ENTITY_INTERACT events.
    • Added /afkbooter list command which will list idle players if kickIdlers=false
    Version 1.0.1
    • Added a bad formatting check, should catch exceptions when you screw up the listened-events property.
    Version 1.0
    • Fixed bug which required a restart of the AfkBooter when you changed the kickTimeout. It will now properly detect it when changed while the server is running.
    • Added ability to block pick up of items for players which are idling. Note that this only functions when kickIdlers is false.
    • Added ability to listen to players' commands in addition to their chat for determining activity status.
    • Completely revamped the way that events are listened to for determining activity status in order to allow for easier adding of additional events. You now must list the event names in the listened-events property. Events should be comma separated. For events that can be listened to, please see the list above.
    Version 0.9
    • Added option to ignore player movement while in a vehicle. Set the ignore-vehicle-movement property to true for this.
    • Added ability to set AFK players as "asleep" according to the new Bukkit feature in CB 677. This only works if you have kick-idlers set to false. If use-faux-sleep is set to true, then players who are AFK will be marked as "in bed" for checking if all players are in bed to move the server clock to day.
    Version 0.8.1
    • Fixed possible NPE through the Permissions plugin. Looks like he's not checking if the Player object passed in to his PermissionHandler.has() method is null or not.
    Version 0.8
    • Added ability to simply make an announcement of idling status. This is controlled through the kick-idlers property of the properties file to false. Defaults to kick idlers (true).
    • Added a check for player online-ness before trying to kick them. Should hopefully help prevent some of the NPEs, since the previous check for player presence was apparently insufficient.
    • Changed kick announcement color to yellow.
    Version 0.7.1
    • Simple changes to method signatures to match the changes in CB 612? (Not sure exactly which version they were introduced). Makes plugin fully compatible with CB 617.
    Version 0.7
    • Added the ability to determine whether certain events should be listened to. The events which can be listened to currently are:
      Player move
      Open inventory
      Player chat
      Block place
      Block break
      Player drop item.

      These are modified by setting one of the "listen-*" settings in the properties file.
    Version 0.6.1
    • Corrected a NullPointerException that was occurring if you were not running the Permissions plugin.
    Version 0.6
    • Added support for Permissions plugin.
    • Added synchronization for the playersToKick list. Seemed like we were getting some log messages that indicated there was some concurrent access happening. This should prevent it while simultaneously not slowing bukkit down much.
    • Added some nicer cleanup in onDisable() so it wipes some stuff out for potential subsequent startup better.
    • Added a setting for the experimental jump ignoring code so I no longer have to maintain multiple versions of the plugin. It's "use-jump-ignoring" in the properties file. Also added the command "useJumpIgnore [true|false]" to the plugin's command description and commands it is capable of handling.
    Version 0.5.1
    • Added some experimental jump-ignoring code.
    Version 0.5
    • Added a player count threshold making it so if the number of players on the server is below this threshold then nobody will be kicked. Set to 0 to always kick idlers.
    • Made the system a bit more robust so if there's a problem with the players to be kicked task not happening we're not totally hosed until server restart. You should get a log message after 60 seconds saying that kicking players failed and then the system should be ready to go.
    Version 0.4
    • Fixed the TSLPC error.
    • Corrected a problem in which the player command event was being listened for but not caught instead of listening for the player chat event which was attempted to be caught.
    Version 0.3
    • Added commands that allow you to hot-swap config values while the server is running.
    • Added config-file saving which happens every time you change a value with a command. See commands above.
    Version 0.2
    • Removed setting re-saving on shutdown until settings hot-swapping is enabled while the server is running.
    Version 0.1
    • Releasing the AfkBooter.


    Features for the future:
    • Look into allowing multi-line kick messages. (low priority, haven't been able to figure it out yet).

    Old Versions:
    v1.0.2: jar
    v1.0.1: jar
    v1.0: jar
    v0.9: jar
    v0.8.1: jar
    v0.8: jar
    v0.7.1: jar
    v0.7: jar
    v0.6.1: jar
    v0.6: jar
    v0.5.1 (experimental, see change log): jar
    v0.5: jar
    v0.4: jar
    v0.3: jar
    v0.2: jar
    v0.1: jar
     
    morganm and ssechaud like this.
  2. Offline

    neromir

    If I understand correctly, no, monster killed listening is not yet handled. Is there a particular reason you would want it?
     
  3. Offline

    jullleee

    ye alot of player are using mob towers on my server. and i don't want when a player move beacuse the can palce a cow behind them and then the plugin will think they are moving
    and when i add PLAYER_DROP_ITEM to events the plugin automatically adds PLAYER_PICKUP_ITEM, and beacuse of this i can't kick them beacuse i can't use move. beacuse the explorers will get kick beacuse they just run around.
     
  4. Offline

    neromir

    That doesn't make sense to me. The plugin only listens for PLAYER_PICKUP_ITEM in order to block idle players from picking items up. Have you tried adding BLOCK_PLACE and/or BLOCK_BREAK and telling your explorers to slap a block of dirt down periodically or something?
     
  5. Offline

    jullleee

    no, thanks =) i can use that =D
     
  6. Offline

    NopeDK

    What about a double action for idlers? So at the 30 sec mark it announces that a player is AFK and broadcasts it, and when it hits 1 min (all values configurable) it kicks him.
     
  7. Offline

    neromir

    I honestly don't see a use for that. The AfkBooter already logs who it is kicking both when it happens in the chat and in the server log. If you're looking for a longer time to allow people to stay in, then just set your time longer. If the player is sitting still so long that he gets the announcement, and only moves when he sees that, then he'll get the hint just as well when he gets kicked, and that'll encourage him not to idle so much.
     
  8. Offline

    Don Redhorse

    would it be possible if the idler is NOT kicked to move him into afk mode and when he moves again to remove the afk mode automatically?
     
  9. Offline

    neromir

    That's exactly what it does if you have "kick-idlers=false".
     
  10. Offline

    Don Redhorse

    ah, haven't tried it yet... does the nickname also change?
     
  11. Offline

    neromir

    Please read the first post.

     
  12. Offline

    Don Redhorse

    yeah I know... what I meant is that the name which is displayed in playerlists etc is AFK-neromir
     
  13. Offline

    neromir

    Ah, I had misunderstood your question. No, the plugin does not do anything with the player list. Changing player's names is hairy and generally inadvisable; it tends to cause a lot of problems for the server.

    It would maybe be possible to intercept a /list command and change the displayed output. If any other plugins tried to intercept the /list command or used their own listing, it wouldn't work, however. Alternatively, it might be possible to simply create a "list AFK players" command of my own that only lists people who are AFK.
     
  14. Offline

    wassilij

    I need this plugin so badly, but it don't work .. i had yesterday 18 players online (from 18)
    Check Interval set to 30s
    and kick to 120s
    some minuts later .. 80% of the players was kicked "because they are idle..", but they were all active
     
  15. Offline

    neromir

    It works for me just fine. I will need more information in order to try to help. Pastebin your afkbooter.properties file, please.
     
  16. Offline

    wassilij

    http://pastebin.com/YLPn511E

    Server-Info:
     
  17. Offline

    neromir

    Your listened-events property is empty, so it is not listening for anything to determine activity; therefore, everyone is always idle after 2 minutes after joining.

    To fix this, set your listened-events property as specified in the first post. Default is:

    Code:
    listened-events=PLAYER_MOVE,PLAYER_CHAT,INVENTORY_OPEN
    
     
  18. Offline

    wassilij

    oh i'm so sorry, that i don't read the first post :(

    thx for the help.
     
  19. Offline

    neromir

    No problem. On this issue it's a bit more acceptable as it's something that changed recently in 1.0. :)

    Edit: Added a big fat red warning message so the issue is more noticeable.
     
    wassilij likes this.
  20. Offline

    kaasinees

    works with 798?
     
  21. Offline

    neromir

    As far as I can tell.
     
  22. Offline

    wassilij

    Work perfectly with Bukkut 803, thx
     
  23. Offline

    Racha

    It is not kicking, it only shows the message and the player is till online
     
  24. Offline

    neromir

    Please pastebin your afkbooter.properties file.
     
  25. Offline

    wassilij

    Not working with Bukkit 812,814,815
     
  26. Offline

    Kahl

    Hows this working with 818?
     
  27. Offline

    neromir

    I have not had time to test it yet, so no idea if it's buggy or not.
     
  28. Offline

    Sirgue

    I going to test with cb818.
     
  29. Offline

    Umbra

    I can confirm this is not working with #818. An update would be cool.
     
  30. Offline

    neromir

    All right, I'll see if I can get it fixed and working sometime this weekend.
     
  31. Offline

    Sirgue

    Ok thanks, I wait... ;)
     

Share This Page