[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

    CyborgOne

    My users found out a way to stay on server without doing anything.
    Take a saddle and sit down on a chicken and the server let you stay where you are as long as you want ;)
     
  3. Offline

    neromir

    Sounds like the same issue Phanku mentioned a few posts ago. Please see my response to him.
     
  4. Offline

    Ditto8353

    Has this been tested with 602?
     
  5. Offline

    neromir

    Not yet. I haven't had time to work on it this week. Will probably be able to test it against 602 on Saturday. In the mean time, feel free to go for it, if you like. :)
     
  6. Offline

    Ditto8353

    No worries. The server can live without it for a while. And my server won't be updating until WorldGuard is updated anyways. I was just curious more than anything.
     
  7. Offline

    juchiu

    You should add a radius that the player must move out of to not be kicked. My players found a way to just have their character move a little bit every so often.
     
  8. Offline

    neromir

    Again, you can correct this yourself. Make it ignore movement and pay attention to block placement/destruction. Can you offer any details about this method they have of moving every so often? I can't even try to correct it if there's no specifics.

    Adding a radius of required movement is not feasible given the current design of the plugin and would require a lot more information to be stored.
     
  9. Offline

    Ditto8353

    Or just ban anyone trying to cheat the AFKBooter. Simple solution.
     
  10. Offline

    juchiu

    Haha, they're some of my best builders and most active though, just trying to farm too much. He's doing it by using java.Robot to press w and s on the window at some random frequency. But I'll try the ignoring movement. I feel it might interfere with long distance travel though.
     
  11. Offline

    Ditto8353

    What exactly is he farming? iConomy interest? Darkroom collection?
    You could always turn off iConomy interest earnings or get DropBonus and make it so mobs don't drop loot unless killed by a player.

    I did minimal testing and this plugin works for RB612.
    Some minor housekeeping needs to be done with the code, but it doesn't need to be rushed.
    The one thing that I have seen is on startup:
    Code:
    21:23:17 [SEVERE] Nag author: 'Neromir' of 'AfkBooter' about the following: onPlayerJoin has been replaced with a new signature, (PlayerJoinEvent)
    It also seems that setting the timeout to 30 seconds results in something closer to 45 seconds.

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

    neromir

    That's related to the timeout-check-interval you have set. It only checks for players to kick at whatever interval you have set there. So if you have the timeout-check-interval set to 10 seconds and the kick-timeout to 30 seconds, it won't have anyone to kick until someone has been idle for 30 seconds. So once someone has been idle for 30 seconds, it could be up to kick-timeout + timeout-check-interval seconds (with the previously mentioned settings, that'd be 40 seconds) in the worst case for the plugin to slate the player for kicking.

    Once the plugin has slated the player to be kicked, it schedules a job with the Bukkit internal scheduler to actually do the kicking, and I don't really have any control over how soon that happens. It should be relatively quick, but I wouldn't be too surprised if it takes a few more seconds, depending on what other plugins you have running and how busy the scheduler is.

    As to RB612-- if I get done testing it on my server tonight and manage to have time, I'll see if I can get an update out for that.

    In that case, even adding a radius wouldn't help. He'd just tweak his hack to bypass the adjustment.
     
  13. Offline

    Ditto8353

    Oh, derp. I changed my timeout from 300 seconds down to 30 so I could test the plugin, but I forgot to change my interval from 30. Thanks for pointing that out.
     
  14. Offline

    ManBearWaffle

    617 :)
     
  15. Offline

    neromir

    I did not have time. The update will happen sometime this weekend.
     
  16. Offline

    Umbra

    Hi,

    First of all thank you for developing this plugin. It's really helpful for me.
    In fact I installed it because people from my serveur had made a mob trapper and were always afk where all items were falling to them. This plugin first help me through this and they couldn't do that anymore.
    But a few days ago, I noticed a minecart circuit making circle beneath the object falling point and they could just sit in a cart, get their object and stay there as long as they want. Now I'm asking myself how I could possibly prevent this and I also can't afford to put listen-move to false because it won't be fair for other players.

    Hope you can help me on this


    Thanks,

    Umbra
     
  17. Offline

    neromir

    Unfortunately, I don't have a way to do that without ignoring all movement in vehicles, which carries similar consequences to setting listen-move to false. I'll probably at least add that as an option in the next version, although it would be turned off by default.

    To be honest, the type of person who is going to try to find ways to circumvent the plugin will likely continue to find ways to circumvent it even if I add additional features. Take the guy mentioned who developed a hack to make it push his forward and backward keys a few posts up, for example. If you really want to make an impression on people, ban the offender. Could maybe just be a temporary ban if you don't feel it's appropriate for a perma-ban.

    I know on my server I use the AfkBooter because I'm running it out of my apartment-- I have a cap set on my bandwidth that if we go over I get one warning, and then on the second offense they shut off my internet. So it's a pretty serious business-- if one person is threatening the integrity of my entire server, I have no problem with making an example out of them.

    If you have ideas on how I could track something like this, I'm open to hearing them; keep in mind I don't want to store a ton of information on what the player has done over the previous X minutes. Currently this plugin is fairly lightweight and I'd like to keep it that way. Something like seeing if a player is sitting on a minecart loop could generate a lot of lag when you're checking every player.
     
  18. Offline

    Umbra

    I believe that setting an option like "listen-minecart" would be a great idea and that it will surely solve my problem for now.
    But as you said, if you really want to get rid of "bot scripts" you will have to add a function that checks any mouvement to find loops and it will enventually costs more ressources and yet that only concerns "small hackers".
    As far as I know it's impossible to stop someone that will always look for a way to bypass it since anyone can easily develops a small script (ie with AutoIT) that will get around any afk kicker plugin anyway.


    Thanks for your concern

    Umbra
     
  19. Offline

    neromir

    I've put up v0.7.1 of the plugin to clear up the compatibility problems with CB 612+ (tested this one against RB 617). Was hoping to be able to get the latest couple of suggestions in this version, but I don't have time for now. Have to do some stuff around the house, and that takes priority. Hopefully tomorrow.
     
  20. Offline

    Jorrdan

    Hey i just want to thank you for this plugin, you did a great job on it! I love it :)
     
  21. Offline

    Puremin0rez

    If there are alot of players on my server at random this plugin will start throwing NPEs and ultimately kill the server. Is this known or am I just very unlucky? I have tried setting the interval and whatnot higher but no matter what I set it to it doesn't fix it.
     
  22. Offline

    neromir

    What constitutes a lot of players? What are the NPEs? Copy/paste them here or in pastebin.

    If you're having a lot of players leaving or getting disconnected due to connection resets, then that is a known problem and nothing I can do about it.
     
  23. Offline

    Puremin0rez

    I finally managed to get my server to crash from the plugin. Like I said, really random.

    There were 27 players online at a time and then suddenly this began to fill the server before eventually just freezing it completely up...

    http://pastebin.com/g5CnkXqu

    Since it seems related to permissions I'm using Permissions 2.5.5
     
  24. Offline

    neromir

    Yeah, that was generated inside the Permissions plugin. I'll see if I can see if something of mine caused that, but odds are it was caused by something in his plugin.
     
  25. Offline

    neromir

    Just to let you all know, this should still function with RB 670-- looks like no changes were necessary.

    Also, I'm still alive and working on this; I have already implemented (not tested) making it simply log/announce afk status rather than booting people (configurable, defaults to boot idlers). Working on multi-line kick messages, but haven't had a lot of time to test out my ideas for that yet. Also implemented a potential bugfix for all those NPEs you get when it tries to boot a player that has since lost a connection.

    Anyway, just wanted to let you all know I'm not dead yet. This has just been a very busy week or so, and this weekend's not going to necessarily be any easier (mother-in-law's going to be in town).

    TL;DR
    Still here, still working. It's just slow. :(
     
  26. Offline

    neromir

    And released the update to v0.8 followed quickly by v0.8.1 because some people got to the download before I was able to upload the fix for the Permissions NPE problem. v0.8 adds the ability to simply announce idle status of idlers rather than outright kicking them. It defaults to kick idlers and can be configured via the properties file.

    Also adds an additional check for player online-ness in order to try to prevent some of the NPEs that have been happening when kicking players who have disconnected.
     
    Puremin0rez likes this.
  27. Offline

    Umbra

    Thanks for this update. However are you still taking my request under consideration ?
     
  28. Offline

    neromir

    That had actually gotten lost in the shuffle, but I'll put that on my todo list and look into adding an option to ignore movement while in a vehicle.
     
  29. Offline

    Umbra

    I appreciate that. Thanks for your concern
     
  30. Offline

    bar10dr

    Feature request
    Add option to stop player being able to receive items when afk.

    I'd like this so people can't just go afk at their mob spawn and get stuff (Without kicking them from the server).
     
  31. Offline

    neromir

    Mm, that's a possibility.

    Uploaded version 0.9. Added ability to ignore vehicle movement for counting a player as active. Also added support for Bukkit's new faux sleep feature. If kick-idlers is set to false and use-faux-sleep is set to true, then idlers will be counted as "in bed" for purposes of seeing if everyone is in bed at night for moving the server time to day.

    I have not been able to find a way to make kick messages multi-line. It doesn't look like the Minecraft server provides a way to do that.
     

Share This Page