[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

    Umbra

    Thanks for having included my request. Definitely a great plugin and a great author !
     
  3. Offline

    neromir

    No problem, always happy to see people pleased with it. :)
     
  4. Offline

    neromir

    It looks like v0.9 should be compatible with CB 733, but I haven't had time to test it much. I'll likely get to testing it some more tomorrow, in the mean time, let me know if there are any bugs.
     
  5. Offline

    rareshutzu

    I will get it anyway for build 733. I will comeback tomorrow to tell y'all if working.
     
  6. Offline

    austin101

    Works good with 733 :D
     
  7. Offline

    Damien711

    Im not sure why but I set my kick timeout to 900 seconds (30 mins) and the timeout check to 450 (15 mins) however it kicks one player for idling after around 5 mins not sure why. I set all things to true except for the vertical move and vehicle movement. If posting my config is needed I will any help would be great.
     
  8. Offline

    neromir

    There seems to be a problem with the timeout check not being loaded properly if you change it while the server is running; it likes to keep using the old value for some reason that I haven't been able to figure out yet. It should write the change out to your config file just fine and reload it all right on a restart, though. Did you restart the server after changing the timeout check and kick timeout? If not, try that and let me know if that gets it.
     
  9. Offline

    Damien711

    Ok I will try your suggestion now thanks.
     
  10. Offline

    Jakeob22

    I love the plug in! But one of my players claim to be kicked when they are riding in a boat. Is that possible?
     
  11. Offline

    neromir

    Yes, check your value for "ignore-vehicle-movement" in your afkbooter.properties file. If it is set to true, then players riding in boats or minecarts for the duration of your kick-timeout would get kicked. If it is set to false, then see if you can reproduce it and let me know; it shouldn't be kicking you in that case.
     
  12. Offline

    Jakeob22

    thanks a ton! I feel dumb now! ;)
     
  13. Offline

    Kalais

    Will players that have a mouse button taped down, in order to attack mobs, be seen as afk? If not, can this be implemented?
     
  14. Offline

    neromir

    Depends on whether or not swinging your arm is counted as movement by Bukkit and is a question I don't know the answer to off the top of my head; I'd have to test it. You could test it yourself probably faster than I'll be able to get to it. Just set your kick-timeout artificially low (like 5 seconds) with a similarly low timeout-check-interval then hold down the left mouse button without moving around and see if you get booted.

    If holding your mouse button down is counted as movement, then there likely is not anything I could do about it short of tracking where the player has been for the last x amount of time, and that's a lot more state information than I'm interested in storing. If that were the case, your best bet, then would be to turn off movement tracking and turn on block break/placement tracking. Either that or ban the offender to get the point across to other potential offenders.
     
  15. Offline

    Pontus Lantz

    I love this plugin on my server but there's one thing driving me crazy. If you stand still and write commands it doesn't count as chat. Could you either make commands be counted as chat or make an new command listening part? Would be highly appreciated [meat]
     
  16. Offline

    Johannes F. Oma

    Hi, i get this error meesage in the console when the plugin tries to kick idle players.

    Code:
    16:10:23 [SEVERE] [AfkBooter] Failed to kick idle players. Passed timeout (60 sec) after found idlers.
    16:10:23 [WARNING] Task of 'AfkBooter' generated an exception
    java.lang.IllegalAccessError: tried to access method com.runicsystems.bukkit.AfkBooter.AfkBooter.access$000(Lcom/runicsystems/bukkit/AfkBooter/AfkBooter;)Ljava/lang/Object; from class com.runicsystems.bukkit.AfkBooter.AfkBooter$PlayerKicker
        at com.runicsystems.bukkit.AfkBooter.AfkBooter$PlayerKicker.run(AfkBooter.java:506)
        at org.bukkit.craftbukkit.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:128)
        at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:358)
        at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:285)
        at net.minecraft.server.ThreadServerApplication.run(SourceFile:394)
    16:10:24 [INFO] [AfkBooter] Player count: 1. Attempting to re-check for players to kick too soon. Please set interval higher.
    
    I really need this plugin to work, so please help me.
     
  17. Offline

    neromir

    I'll make the setting for listening to chat also make it listen to commands. I'll get that added in for the next version, which is getting close to release, by the way (hopefully tomorrow).

    That's a really weird error. What version of CraftBukkit are you running? Are you running 0.9 of the AfkBooter? Does it happen every time it tries to kick a player, or has it successfully kicked players at other times and this error only happens sometimes?
     
  18. I am having some difficulties configuring the "afkbooter.properties"-file.
    Is it somehow write-protected by default? I don't have direct access to my server, but I have FTP-Access.
    When I try to update/delete/rename the file it says "access denied". I tried to alter the access-attribute to '777', doesn't work either. With all my other plugins deleting/renaming/updating works well. I only had one plugin once, that gave me the same "access denied" in FileZilla, but I managed to get rid of it somehow :-/
    I also tried it from my Server-Webinterface, same result.
    I don't need write-protection, because I am the only one who has access to the server-files.
     
  19. Offline

    neromir

    I don't enable write protecting on the file, as I recall, however the file is created by the server on first run if it can't find it. So if the server is running on a different user than what you're accessing via FTP, then it would probably appear write-protected. I'll look into it for this version and see if I can figure out what's causing it to save it in write-protected mode. If I'm unable to do that, I'll see if I can add a command that takes that off.

    Edit: Just updated to 1.0. Please note the change in the way that events are registered for determining activity status.

    @little_evil I ran out of time for trying to figure out what's going on with the write permissions issue. I've double-checked the way my properties file is created and it seems to be no different from the way the other plugins I'm running do it. Can you tell me what the permissions are on the afkbooter.properties file and how that differs from other plugins you're running? Also it would be helpful to know the owner of the file in both of those cases as well (or if it's different from the user you're using at any rate).
     
  20. Offline

    PhantomGamers

    Awesome update.
    Though there should be a static jar so this can be added to CraftBukkitUpToDate :p

    (Just realized it was already in CBUTD, but it should be a static jar name (AFKBooter.jar instead of AFKBooter1.0.jar) so there aren't multiple copies of the plugin in the plugins folder :S)
     
  21. Offline

    neromir

    Thanks, glad you like it.

     
  22. Offline

    PhantomGamers

    Yeah... I saw that. Still kinda annoying. But I guess if that's your stance it's worth it.
    The plugin IS really awesome :p
     
  23. Offline

    wassilij

    I get this error with Bukkit 766:
     
  24. Offline

    neromir

    Thanks for pointing that out. Will try to get that fixed shortly.

    Also, could you pastebin your afkbooter.properties file for me?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 9, 2016
    wassilij likes this.
  25. Offline

    Dev

    I'm getting this on server start. Using CB740 and AFKBooter 1.0
     
  26. Offline

    neromir

    Same goes for you, pastebin your afkbooter.properties file.

    I cannot reproduce this problem on my own servers. Checking to see if it's a misspelling or invalid configuration, but I won't know for sure until one or both of you posts your properties file.

    Possible fix uploaded.
     
  27. Offline

    Dev

    1.0.1 fixed it. Thanks for the good plugin support.
     
  28. @neromir Sorry for the late post, I forgot to check this thread again ;)
    I fixed it by myself :D
    There is an Option "Refresh FTP-Rights", that gives all the files in the FTP-Directory "770-rights".
    Now I can edit/delete the file.
    Nevertheless, thank you for trying to solve the problem :)
    Awesome Plugin [diamond]
     
  29. Offline

    jullleee

    any way to change the msg "Name no longer idle."?? Thanks!

    or can i remove the broadcast msg?

    and does 1.0.1 work for 740? Thanks!

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 9, 2016
  30. Offline

    neromir

    @jullleee Wow... please use edits to condense your posts when they're so close together in time, rather than simply posting a new reply.

    As to your questions, in order:

    1) No, it's hardcoded right now. I can look at adding a setting to change/remove it.
    2) You can, simply set it to blank. If that doesn't work properly, then it's a bug.
    3) It should, but I have not explicitly tested it with that version.
     
  31. Offline

    jullleee

    oh thanks =) any event like monster killed?
    and some one like if you walked 100 blocks the your not afk, because else ppls can build mob towers
     

Share This Page