[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


    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.

    • 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:

    #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
    kick-message=Kicked for idling too much.
    kick-broadcast=kicked for idling too much.
    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:
    - '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.

    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:
    PLAYER_COMMAND_PREPROCESS (to detect commands as well as chat)
    INVENTORY_OPEN (does not work currently due to Bukkit event issues with inventory)
    Changelog (open)

    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


    I have an Problem.
    The plugin goes to load with 2011-03-13 08:45:43 [INFO] [AfkBooter] Kick timeout 1800 sec, exempt players: name1, name2, name3

    But i kicks nobody :(
    I dont know why. My build is 531.
  3. Offline


    Are you using the Permissions plugin? If so, does anyone/everyone have either the '*' permission or 'afkbooter.exempt' permission? What is your timeout-check-interval set to? Also what is your player-count-threshold set to and how many players were on while you were testing?

    Also, with your kick timeout set to 1800 sec, that's 30 minutes-- a long time. That means that 30 minutes have to go by with at least one person sitting there doing nothing before they will be kicked. If they move even a little bit during that window, or chat, or open their inventory, then the plugin will determine they're active and won't kick them.

    I would recommend setting the kick timeout to something ridiculous, like 10 seconds, just for testing purposes, and restarting your server. Then if you don't have the exempt permission, sit still for 10-20 seconds and make sure it kicks you as expected. If that works, then you must simply have nobody being idle for 30 minutes. I recommend a kick-timeout setting of something around 600 seconds-- that's 10 minutes and is still pretty reasonable.
  4. Offline


    I am getting this error, any explanation?
    2011-03-13 16:48:08 [SEVERE] Could not pass event PLAYER_MOVE to AfkBooter
        at com.runicsystems.bukkit.AfkBooter.AfkBooter.recordPlayerActivity(AfkBooter.java:469)
        at com.runicsystems.bukkit.AfkBooter.AfkBooterPlayerListener.onPlayerMove(AfkBooterPlayerListener.java:26)
        at org.bukkit.plugin.java.JavaPluginLoader$7.execute(JavaPluginLoader.java:192)
        at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:59)
        at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:255)
        at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:124)
        at net.minecraft.server.Packet10Flying.a(SourceFile:126)
        at net.minecraft.server.NetworkManager.a(SourceFile:230)
        at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:76)
        at net.minecraft.server.NetworkListenThread.a(SourceFile:100)
        at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:357)
        at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:272)
        at net.minecraft.server.ThreadServerApplication.run(SourceFile:366)
  5. Offline


    Are you not running the Permissions plugin? I just found a couple of possible places where that can occur. Apparently my testing strategy was slightly flawed in that I neglected to test the case where Permissions is not installed.

    If that is the case, and you are getting this error consistently, for now possible work-arounds would be to install Permissions or use version 0.5. I'll get that corrected for the next release.

    Edit: Just put up version 0.6.1 which should correct this, so go get that version.

  6. yeah, i read it.

    As to the absurdidty, i mean its absurd to run the server for who knows how long, because i had this running for about 4 days without a problem, and then it randomly decided to start crashing (with no changes in mods or any other aspects of teh server)

    I've been running an exact copy of my test server on a machine at my house, and its been running for 3 days, same mods, no problems. That knocks out the possibility that its a plugin confliction. The only thing i can seem to think is that it happens when a user doesn't successfully get kicked.
    Sorry to frustrate you. Even though its an absurd, i still know its the only way to try and solve it, which is why i immediately copied all the stuff from the server, and launched it on a local machine.

    Also, after re-reading a few posts, i'd just like to clarify the errors. It happens randomly, and when the error does come up, its appearing at random intervals (not at the set check/kick intervals).

    If it helps, i can give a list of plugins... but as i've said, i've been running the local server, logging in and being kicked periodically, at all times of day, and other variations that may conflict with your plugin.

    Again, i'm sorry if i've been a bit frustrating. I'm fighting a flu bug, as well as a funeral this past weekend. I'm trying to fix bugs on the side, and keep getting flooded with email complaining that users cannot log on.
  7. Offline


    Okay, I think I misunderstood what you were saying, then. So, to clarify, this is not happening all the time, just periodically at random intervals, and once it starts it does stop before long?

    Do you see a [SEVERE] level message about failing to kick players after about a minute of getting these other error messages?

    Yeah, if you can give me a list of plugins you're using and their version numbers it would help, as well as your CraftBukkit build #. That way I can go through and try to reproduce the problem on my own.

    If it fails to kick a player in general you'd probably see another exception-- something about player not being in a given chunk. I'm thinking it might have something to do with bukkit not properly scheduling the task which goes through and kicks players which are set to be kicked.
  8. It is happening periodically, with no observable patterns. However, once it starts spamming that error, it doesn't stop until i forcibly restart the server (all commands are ignored). The longest i saw the error message being spammed was over-night (as i slept) which was about 7 hours straight. During that time, everyone experiences a timeout error. However, i've noticed that different server-monitors (such as the things on mcserverlist.net) do not see this as being down.

    I never see any SEVERE messages. Just the one that i pasted, over and over again
    (luckily, i keep all plugins on an external hard drive sorted by plugin, and version types, so i can keep track of which versions i am running :D)
    I'm currently running CB 493. Plugins are as follows:
    Big Brother v1-6-3
    BorderGuard 2.00
    Citizens1.06 (error has occurred with and without this plugin)
    Command Book 1.1-e052bf1d53
    ExtendDay (no version number given)
    Gastronomic 1.3 (Error occured before addition of this plugin)
    HelpPages (no version number given)
    HeroChat 4.1.2
    HeroSneak 1.0.4 (Error occurred before addition of this plugin)
    iConomy 4.3(.1)
    iSee (No version number given, Error occurred before addition of this plugin)
    ItemId 1.12
    Jail 0.5.3
    KiwiAdmin (no version number given)
    LocalShops 1.5b
    LWC 1.57
    MeasuringTape 0.7d
    MyWarp v1-10-3
    nSpleef 0.1.1
    Permissions 2.5.2
    Reserved 2.2.1b
    SpawnControl v0.7
    SpawnMob 1.7B
    Stargate 0.26
    TeleConfirmLite (no version number given)
    Whitelist 2.4
    worldedit 4.0-beta8
    worldguard 4.0-alpha1
    Yeditor (no version number given)

    I try to only update things when i see a vital update. I also check for updates and try do do an up-to-speed update every 2 weeks. (of coruse, local tests are done constantly). That may be why some of the plugins that i haev are not the very latest builds... but they've all worked perfectly :)

    Looking back over the listing, the only thing i can see that actually handles the kick commands, woudl be KiwiAdmin... (I did the custom build of CommandBook which took out the administration stuff like kick/ban/mute)

    Again, sorry for being so difficult. I've just been a bit too stressed this past weekend.
  9. Offline


    No problem, I know how that goes-- I've been fairly stressed as well. Just moved into a house a couple weeks ago and have a lot of stuff I have to fix around it, so that's been eating into a lot of my free time.

    At any rate, that's going to take me a little while to run through that list... I only run about 5 plugins on my servers, so I'll have to see if I can get that sorted out. I may see if I can get a work-around version out before I finish tracking this down for good-- it'd potentially be somewhat less reliable at kicking people, but you at least wouldn't get the error so much, I hope.

    What version of AfkBooter are you running, by the way, latest?
  10. sorry for late reply (super late).

    I've updated to CB 531, as well as AfkBooter 0.6.1, and as of the last 36 hours, no problems
  11. Offline


    Thanks, very useful plugin. Not only for big servers.
    I'm using it on my privat server, where i've extendDay installed. The nights are very long and its disturbing if someone idles if everone else wants to skip the night with the bedfeature..

    so thanks, and keep on working on it.
  12. Offline


  13. Offline


    Well, I'll hold off on the mightily ugly hack I was going to attempt, then. Let me know if the problem recurs.

    As mentioned previously, I use the version numbers to keep track of downloads of various versions. Once he supports redirects, then I'll consider implementing support for his plugin.

    For everyone else, note that the current version has been tested and verified to work on CB #556, the latest recommended build as of time of writing. OP updated to reflect that.
  14. Offline


    - deleted -
  15. Offline


    Any way to make it so we could add permissions groups to the exempt list instead of individual players?
  16. Offline


    Build 531... It seems to only kick admins with the star permission, also it kicks the even if they are not afk
  17. Offline


    Someone found a way to override this using CB556

    Opening a chest and leaving it open while your afk, Apprently it does not kick!
  18. Offline


    I know it's on your to-do list but I would love if I could set it to where the only thing that keeps you from being booted for being afk was movement. It would be so much easier to tell who's using a script to keep from getting booted.
  19. Offline


    Add the 'afkbooter.exempt' permission to the group you don't want to have get booted.

    Don't know what to tell you on this one-- I ran it for a couple of weeks on my server (531) with it functioning as intended with the '*' permission. You'll need to give me more info, such as what other plugins you're running. Have you set the timeout intentionally low for testing purposes (like 10 seconds)? What does your permissions file look like (dump it in pastebin)?

    I wonder if they changed the open inventory event... I'm not even listening for chest opening.

    Yeah, I need to find a way to implement this; so far I haven't come up with a good method to do it.
  20. Offline


    We use LWC as well not sure if that has anything to do with it.
  21. Offline


    Possibly, I'd need to look into exactly what they're doing. Regardless, I'm going to try to get that configurable events thing figured out soon so you can solve the issue yourself with specific events.
  22. Offline


    Hey neromir, the author now sais he supports redirects...:

  23. Offline


    ohh cool plugin im going to try this:)
  24. Offline


    That would work too.
  25. Offline


    It shows this error -
    2011-03-24 14:35:05 [SEVERE] [AfkBooter] Failed to kick idle players. Passed timeout (60 sec) after found idlers.
    2011-03-24 14:36:45 [SEVERE] [AfkBooter] Failed to kick idle players. Passed timeout (60 sec) after found idlers.
    And than no body can connect, showing logging in.. I dont know if it is because of AFK Booter, but this is the last in console.

    Ok there are full console of this, but there is more -
    2011-03-24 14:08:25 [SEVERE] [AfkBooter] Failed to kick idle players. Passed timeout (60 sec) after found idlers.
    2011-03-24 14:09:49 [SEVERE] java.net.SocketException: Connection reset
    2011-03-24 14:09:49 [SEVERE]     at java.net.SocketInputStream.read(SocketInputStream.java:168)
    2011-03-24 14:09:49 [SEVERE]     at java.net.SocketInputStream.read(SocketInputStream.java:182)
    2011-03-24 14:09:49 [SEVERE]     at java.io.FilterInputStream.read(FilterInputStream.java:66)
    2011-03-24 14:09:49 [SEVERE]     at net.minecraft.server.Packet.b(SourceFile:113)
    2011-03-24 14:09:49 [SEVERE]     at net.minecraft.server.NetworkManager.f(SourceFile:155)
    2011-03-24 14:09:49 [SEVERE]     at net.minecraft.server.NetworkManager.c(SourceFile:9)
    2011-03-24 14:09:49 [SEVERE]     at net.minecraft.server.NetworkReaderThread.run(SourceFile:62)
    2011-03-24 14:10:05 [SEVERE] [AfkBooter] Failed to kick idle players. Passed timeout (60 sec) after found idlers.
    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: May 9, 2016
  26. Offline


    What versions of AfkBooter and CraftBukkit are you running?
  27. Offline


    So just a heads up for you.

    A user on my server figured out if he made a infinite booster of minecarts and then get in one of them that for some reason afk booter ignores him. My admin found him riding around in a minecart at max speed in a loop. He was afk. The only reason the admin found him is because he tried to talk to the person in question.
  28. Offline


    Well, he's moving, so he's not counted as afk. Frankly I'm not sure what to do about that besides ignore all movement in vehicles, and that has other negative side effects. Like if you're legitimately riding on a subway system you could get booted. Some subways are quite long-- there are legs of the one on my server that take minutes between stations, and ours isn't all that large. At this point I'd just ban the guy and make him an example to everyone else.

    I guess once I get this new version out you could have it not listen to movement and only listen to block place/break. Then you'd be booting people who were not afk but simply weren't building anything. *shrug* It's a trade-off.

    In other news, got the coding done for the first version that allows you to choose some events to listen to and some to ignore. Haven't been able to test it yet, though-- hopefully get that done and uploaded this weekend.
  29. Offline


    Can multiple lines of text be used with the kick-message= ? I know some messages can wrap lines with a special character.
  30. Could you add somethign like
    [yellow text] <player> has gone idle

    annoucement to the chat when player enters idle. That would be great. I don't want to kick idle but would just like to know when they enter and leave idle mode.
  31. Offline


    Not right now. I'll look into adding it.

    Yeah, I'll see if I can get that added in for the next version.

    Updated to version 0.7 which allows you to set whether or not your server should listen for particular types of activity to determine if players should be kicked. The current list of events is quite limited. I'll probably end up changing how it works later-- I really don't like the way I had to do it this time. Unfortunately, I have only about two other choices: enumerate every possible event in the properties file, or make it so you have to go and look up which events are possible as the user. Neither of them are appealing at the moment.

    Also for those of you who have been requesting the CraftBukkitUpToDate stuff, I submitted an RSS permanent link for him.

Share This Page