[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


    In this case it looks like an easy fix. You may not need to downgrade after all.

    Your listened-events property is empty. So you'll need to set that to whatever events you want to listen to. With it empty, it tells the plugin that basically players are AFK all the time, so boot them as soon as the timer runs out. You mentioned breaking and placing blocks, so I'll fill those in for you here so you can see how it should be, but the full list of what's supported is in the OP.

    To get it to not kick on block placement, breaking, and chatting (assuming you want commands listened to as well), use the following for listened-events:
  3. Offline


    Working good with Bukkit 1000 ;)
  4. Offline


    I just switched to Permissions 3 from Pex. The Exempt work with Pex, but not Perm3. I have the same permissions set up for both and I am using RB1000.

    Here is my config
    kick-message=Kicked for idling.
    kick-broadcast=kicked for idling.
  5. Offline


    I am not familiar with Pex, but I do know that Permissions 3 required some changes from Permissions 2.7.x in the permissions files themselves. Can you post your Permissions 3 perm files?

    Note that there were no actual code changes required for the AfkBooter between Permissions 3 and Permissions 2.7.x, so if your configuration is correct, the problem is likely with the Permissions plugin.
  6. Offline


    I actually have it all in MySQL.. I can export that for you if you wish..
  7. Offline


    I'm not familiar with the way Permissions 3 works in MySQL, I've just been using it in its configuration file format. Does the other permission for the AfkBooter work aside from Exempt (the config permission)?
  8. Offline


    Yes. I have it enabled for my mods. No matter what I do though, the exempt won't work.
  9. Offline


    Right, but I mean the AfkBooter's "config" permission node. If that's enabled and working (it allows you to use the commands in the OP, so that's a good way to test), then the problem must be with how the exempt permission node is enabled because they both use the exact same code. Not being familiar with the way it's set up in MySQL (and I'm at work, so I can't look into it right now), I'd say take a look at the differences between the afkbooter.config node and the afkbooter.exempt node in MySQL.

    Failing that, you could always manually add people that should be exempted to the exempt-players list in the afkbooter.properties file. Granted, that'd be extremely tedious for a larger server, but if this is something that needs to be done now and can't wait, then the possibility is there.

    Edit: Nevermind the first sentence, I misunderstood what you were saying with "mods". Derp.
  10. Offline


    Alright. I'll keep on messing around with it and see what happens. Thanks!
  11. Offline

    Justin VonHagen

    Installed latest version today. I didn't change my config, but now I am getting this error:
    16:25:47 [SEVERE] [AfkBooter] Failed to kick idle players. Passed timeout (60 sec) after found idlers.
    16:25:47 [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:656)
            at org.bukkit.craftbukkit.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:137)
            at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:438)
            at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:361)
            at net.minecraft.server.ThreadServerApplication.run(SourceFile:422)
    16:25:47 [SEVERE] [AfkBooter] Failed to kick idle players. Passed timeout (60 sec) after found idlers.
    16:25:47 [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:656)
            at org.bukkit.craftbukkit.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:137)
            at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:438)
            at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:361)
            at net.minecraft.server.ThreadServerApplication.run(SourceFile:422)
    My config looks like:
    kick-message=Kicked for idling.
    kick-broadcast=kicked for idling.
    I searched this thread and haven't found anyone with the same error. Any ideas?
  12. Offline


    Looks like a problem with the player kicking task. What version of CraftBukkit are you running?
  13. Offline

    Justin VonHagen

  14. Offline


    @neromir Iis there a way you can add in blacklist event listener, so that the plugin will ignore certain events and still flag them as afk such as sword swings or attacking a mob. Recently I've caught several afk macroers on my server padding their wallets at spawners, I'd like to effectively shut them down by being able to control what events get ignored as well as monitored :).
  15. Offline


    I haven't been able to reproduce this, unfortunately. As such, I have no idea what exactly might cause it. My best guess would be some other plugin you're running interfering with it.

    That's kind of already included in the listened-events property. The property functions as a white-list, so anything not listed in there is already black-listed. Unfortunately, Bukkit only allows a certain granularity in the events it allows me to respond to. For instance, a sword swing is lumped in under "ENTITY_INTERACT" as well as "PLAYER_MOVE" I believe. I've found that the only real way to stop macroers like that is to turn off movement tracking and put it on block placement or breaking.

    A good way to test if something is lumped in or not is to put the AfkBooter on a test server with kick idlers set to false and, then only turn on the events you want to test, and make sure you're not exempt from kicking. Then you'll see an announcement in the chat log when it says you're AFK, and another when you do something that's tracked as not being AFK.
  16. Offline


    Appreciate the quick response got that working perfectly now, second request >:), anyway you can set players flagged as idle to not receive coin drops or will that be specific to the plugin that is allowing mobs to drop coin?
  17. Offline


    Glad you got it going. :D

    As to the other request, that's going to depend on the specific plugin. As far as I know there's no common interface for determining AFK-ness, so it wouldn't necessarily be easy, either.

    There's a few options:

    1) If the other plugin author wants to link to the AfkBooter (doubtful... I know I wouldn't necessarily want to if I were in his position), then I provide a public method which will report if a player is idle or not.

    2) If you have use-faux-sleep set to true in the properties, the plugin will set a player to be ignored for "everyone in bed" calculations. The other plugin author can check that to see if a player is AFK. Not sure if this would have other unintended consequences with other plugins that may be setting admins to ignored for sleeping purposes or whatnot.

    3) You can set block-idle-items to true, and if the other plugin author fires an event when he wants the player to pickup these coins, then the AfkBooter will set the event to canceled (AfkBooter listens for PlayerPickupItemEvent if you set that property). This requires the other plugin author to look for that and make sure that it's not canceled by someone when it comes time to actually give the player the coin, though. This is probably the most robust option and will make the coin dropping plugin more compatible with other people as well, without requiring him to tie directly into the AfkBooter specifically.
  18. Offline


    What if AfkBooter cancelled economy events to player altogether whilst they are idle? Would that require to high of a priority from the plugin?
    (No I don't want to make your life harder than it already is, just a very very sexy fix to a problem I have had for a bit :p)
  19. Offline


    Ehhh... That would depend on whether or not there's a kind of standardized system for economy events, like there is (for the most part) for Permissions stuff. If it was pretty standardized, I might be persuaded to do that.

    However, last I heard (and granted I have not been very active with Bukkit stuff lately), there was a big knock-down-drag-out about the various economy systems and their lack of agreement on how to go about things.

    The sentiment is much appreciated. If you give me the name of the particular plugin you're using for this, I'll spend a little time looking into it, but no guarantees on whether or not I'll decide to go through with it. I still think the PlayerPickupItemEvent approach is the more generic/robust of the possibilities, though.
  20. Offline


    Well if you were going to work with something standardized I would recommend having a look at the Vault Plugin http://ci.milkbowl.net/job/Vault/ as it does exactly what you want.
  21. Offline


    I have had it reported to me that when my server gets full (I have 15 slots) and some goes AFK according to your plugin, ALL my players get kicked. Have you heard of this before? If not I will just keep an eye on it but I thought I would mention if and see if you have seen this happen before?

    My Config:
    kick-message=Other players wanted to play. You got kicked for being idle.
    kick-broadcast=kicked for idling.
    I'm on CB1000.

    My Plugins:

    MobBounty, BananaLogArchiver, SuperLog, NSCommand, Residence, VIP, MyHome, WurkIt, SimpleHelp, HeroicDeath, PlgLogCmd, iConomyDeath, Minequery, MyWarp, AfkBooter, iConomyChestShop, FLTDetector, CommandBook, iConomy, Permissions, DailyBonus, AntiXRay, LWC, MantraChat, PermissionsPlus, p2Aliases, NoCheat
  22. Offline


    I haven't seen that happen before, but I also don't run with a player limit on my main server, so it's possible that my shorter-term test server doesn't bring it out. I'd be very interested to know if you can find a consistent reproduction case for this.
  23. Offline


    I'll keep you posted.
  24. Offline


    Server is becoming unresponsive and is being spammed with AFKBooter in console.
    2011-08-12 05:41:35 [SEVERE] [AfkBooter] Failed to kick idle players. Passed timeout (60 sec) after found idlers.
    2011-08-12 05:42:05 [INFO] [AfkBooter] Player count: 1. Attempting to re-check for players to kick too soon. Please set interval higher.
    This is spammed every min or so after the server becomes unresponsive, Does this mean it was the plugin that caused the server to do this or a different plugin?
  25. Offline


    It means that something is making your server unable to process the AfkBooter's kick-players task. Likely something is bogging down your processor or otherwise taking up too many resources, so the AfkBooter is not able to kick players it has marked as needing to be kicked.

    Essentially it's a warning that, due to some problem with your system, the AfkBooter is being prevented from doing its job. It probably means that there is some other plugin interfering with it.

    If this is happening frequently, you could try setting the timeout-check-interval property much higher than it is (it should be at most about half of what your kick-timeout value is), but that may very well not fix the issue, since this is simply a symptom of a larger problem.
  26. Offline



    please update for 1060 u.u
  27. Offline


    Have you tried running it with 1060 yet? I cant confirm anything as of now still being on 1000, but it should work just fine.

    Also, does this work with the current PEX or BukkitPermissions?
  28. Offline


    yes i've tried but i don't understand why he crash all the tyme
  29. Offline


    Hmm...I'm not a plugin dev but I'm pretty sure there isn't anything in 1060 that would of caused the plugin to break.

    Your best bet would be to post a log of the error and wait for neromir to get to it.

    EDIT: Do you plan on adding this to BukkitDev any time soon?
  30. On 1.8:

    23:38:17 [WARNING] Task of 'AfkBooter' generated an exception
            at org.bukkit.craftbukkit.entity.CraftPlayer.sendRawMessage(CraftPlayer.java:106)
            at org.bukkit.craftbukkit.entity.CraftPlayer.sendMessage(CraftPlayer.java:110)
            at org.bukkit.craftbukkit.CraftServer.broadcast(CraftServer.java:770)
            at org.bukkit.craftbukkit.CraftServer.broadcastMessage(CraftServer.java:241)
            at com.runicsystems.bukkit.AfkBooter.AfkBooter$PlayerKicker.run(AfkBooter.java:673)
            at org.bukkit.craftbukkit.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:137)
            at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:439)
            at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:374)
            at net.minecraft.server.ThreadServerApplication.run(SourceFile:417)
  31. Offline


    Not working in the 1.8 builds either. Boots ppl whether they're afk or not.

Share This Page