Inactive [MECH] AFK v1.5 - An Advanced AFK System [1000]

Discussion in 'Inactive/Unsupported Plugins' started by isamgray, Jul 20, 2011.

  1. Offline

    isamgray

    AFK - Advanced AFK System
    Version: v2.0​
    This plugin gives you a nice AFK system to start with. I will add extra features if they are requested, but I think this is a good start. I hope you all enjoy it!​
    Features:
    • Makes the "/afk" command toggle your AFK status in-game.
    • When you try talking, /telling, interacting(mining, etc.), or moving while AFK, it will automatically get rid of your AFK status.
    • Sending a /tell to a person who is AFK will let you know they're AFK, yet they'll still receive the message.
    • Puts a green [AFK] tag in front of your display name.
    • While AFK your immune to creatures targeting you, as long as one wasn't already targeting you when you went AFK.
    • If the server is full, and some online users are AFK, and another user is trying to login, it will kick a AFK user to make room for the new user.
    • Now generates a folder called "AFK" with a "properties.txt" that allows you to disable/enable two of the major functions of this plugin.(protection from monsters, and kick AFKers for new room for users)
    Features Coming:
    • Expand the property list to include ability to disable/enable every feature.
    • Auto-marking people as AFK after a certain amount of time doing nothing.
    • Auto-kick AFK players after a certain amount of time.
    • Keep track of the time someone has been AFK.(hopefully useful for when the plugin API gets written, so other plugins can communicate with this)
    • Figure out a way to detect if the player moved, or if something else forced them to move.
    Change Log:

    Version 2.0
    • Just modernized to use the new API. Tested and works on the beta 1.3.2-R0.1 Everything seems to work fine like before. The source is still available via the link above on github too. :)
    Version 1.5
    • Adds a property file to enable/disable some features.
    Version 1.42
    • Fixes a bug with Entity targeting.

    Version 1.41
    • Fixes a bug that spams the server full of targeting information.

    Version 1.4
    • Now kicks AFK users if the server is full and needs room for a new logging in user.

    Version 1.3
    • Now people who are AFK can not be targeted by creatures. However, to keep from people abusing the /afk command just to get immunity, if a creature already has them targeted before they go AFK, they will still be attacked and also become un-AFK'ed.

    Version 1.2
    • Now if a player interacts with the world at all(tries mining, etc.) while AFK, it'll disable the AFK status.

    Version 1.1
    • Changed the way AFK gets disabled. Now whenever you move, /tell, or chat while AFK it automatically gets rid of your AFK status.
    • AFK people will still receive any /tell messages they get.
    Version 1.0
    • Just the initial release with the features listed above.
    Version 1.5
    • Adds a property file to enable/disable some features.
     
  2. Offline

    NuclearW

    I'll see about lending you some help with making an API for it.

    I know one of my plugins could do well with an AFK plugin for extra features.
     
  3. Offline

    isamgray

    Awesome! That'd be great if you don't mind. Thank you very much for the offer. If you have Skype or anything like that and want to talk on there to make collaborating easier, send me a PM.

    I'm rather new to Java so I don't know exactly how to make my plugin accessible to other's easily with APIs. C/C++/Objective-C is what I'm good at. lol
     
  4. Offline

    Ture

    Great work! Thanks! I'm definitly going to use this on my server.

    An idea for an additional feature: Ignore idle players from sleep checks so other players can pass the night while others are afk.
     
  5. Offline

    ohtwo

    Good update man. Definitely downloading now.
     
  6. Offline

    isamgray

    Will look into it. And thanks! I hope you enjoy it. :)

    Thanks for the compliment, I hope you enjoy it as well!
     
  7. Offline

    Phant0mX

    Thanks for the reply. Its working great on my server!
     
  8. Offline

    isamgray

    Just an update on what's happening:
    I'm waiting for @NuclearW to finish making an API for this plugin so I can see how it's done. Then I plan on adding in auto-AFK'ing features, and stuff like that. Such as people have requested. So until he's done that, version 1.4 will be here to stay for awhile.
     
  9. Offline

    meiamone

    I keep getting spam, seems like just at night, and an error that says:
    Code:
    23:53:12 [INFO] Player name: meiamone
    23:53:12 [INFO] Player name: meiamone
    23:53:12 [INFO] Player name: meiamone
    23:53:12 [INFO] Player name: meiamone
    23:53:12 [INFO] Player name: meiamone
    23:53:12 [INFO] Player name: meiamone
    23:53:12 [INFO] Player name: meiamone
    23:53:27 [SEVERE] Could not pass event ENTITY_TARGET to AFK
    java.lang.NullPointerException
            at me.sam.afk.AFKEntityListener.onEntityTarget(AFKEntityListener.java:31
    )
            at org.bukkit.plugin.java.JavaPluginLoader$63.execute(JavaPluginLoader.j
    ava:684)
            at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.jav
    a:58)
            at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.j
    ava:332)
            at net.minecraft.server.EntityCreature.c_(EntityCreature.java:50)
            at net.minecraft.server.EntityLiving.v(EntityLiving.java:685)
            at net.minecraft.server.EntityMonster.v(EntityMonster.java:26)
            at net.minecraft.server.EntitySkeleton.v(EntitySkeleton.java:45)
            at net.minecraft.server.EntityLiving.m_(EntityLiving.java:218)
            at net.minecraft.server.EntityMonster.m_(EntityMonster.java:30)
            at net.minecraft.server.World.entityJoinedWorld(World.java:1198)
            at net.minecraft.server.WorldServer.entityJoinedWorld(WorldServer.java:4
    8)
            at net.minecraft.server.World.playerJoinedWorld(World.java:1180)
            at net.minecraft.server.World.cleanUp(World.java:1104)
            at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:447)
            at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:361)
            at net.minecraft.server.ThreadServerApplication.run(SourceFile:422)
     
  10. Offline

    isamgray

    Thanks for the error report. I'll look into it as soon as I have the chance.
     
  11. Offline

    meiamone

    Thanks, I love the mod otherwise! Also, my guy seems to always get bumped by a mob and it brings him out of AFK, and they start attacking. Maybe you can find a way to fix that?
     
  12. Offline

    isamgray

    It's probably because the monster has you targeted already before you go AFK. Or do you mean they run into you, and it bumps you and then turns off AFK? If it's the latter I'll try to figure out if there is a way to detect if it's the actual player doing the moving, and not a forced move.

    -written on iPhone-

    I had time to look into this, the spamming(not the error message) is just because I forgot to take out a debugging line in the code. I'll fix that up in a sec, and reupload as version 1.41. Later today when I have more time, I'll see about the actual error message though.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 17, 2016
  13. will you be automatic tag afk, when your are afk ?
     
  14. Offline

    fysics

    @Parideis
    @SilencShadoW
    For god's sake, read the thread before you ask questions that have been answered before (sometimes directly above your post).
     
  15. Offline

    isamgray

    Couldn't have said it better myself. haha

    Your bugs have been fixed in version 1.42. Also, I'm trying to figure out a way to detect if it was the player's choice to move, or something externally moved them, so then they don't go un-AFK. Just like you requested.

    ALSO: Everyone, I added something to the first post. A "Features Coming" section, so read that before you suggest your ideas please. That way I don't have to keep saying "already done" or "working on it". Just read the first post and you'll get all the info you need.

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

    wiigor

    I miss a config file to set some options.

    Like my server is survival i dont want any plugin keeping players alive if they are afk. But i do like the feature of afk players only being kicked when the server is full and another wants to join.(as opposed to kicking them after a timeout even if the server is not full.)

    Why not make a property file with for example:

    protect.afk.mob = true
    protect.afk.player = false
    kick.afk.timeout =

    later on maybe you could implement permissions so different player groups would get a different afk treatment.

    For example premium/ vip users get a nicer treatment than a newbie user or whatever you name your groups.

    i would really like to just get the kick afk on server full without the protect player options.
     
  17. Offline

    isamgray

    Love your ideas. I'll add them to my to-do list, for version 1.5. Also, I would do permissions as well...but I have no clue how. I'm very new to the whole MineCraft server scene, and permissions confuse me. So when I bother taking the time to learn about permissions, I'll add in that feature for sure. For now, I'll just work on the property file so you can modify what features you want enabled.

    Thanks for the great suggestion!
     
  18. Offline

    wiigor

    No problem, its me who should be thanking you for your great plugin :D As soon as i can configure it not to protect people who are afk, i will install the plugin. (since my server is a survival server (minecrafters.nl) they must pay attention and cannot go afk without the risk of a painful death, also I dislike kicking players and only want to kick them if the server is full and another player wants to join, that last idea is a great idea of yours that no other afk plugin uses. (it keeps the server full while not needlessly hurting the feelings of players :D) :) Thanks
     
  19. Offline

    isamgray

    Just updated to version 1.5! Read the description/update log and you'll see that what you've requested has be implemented. :) Please let me know how it goes on your server. I hope you enjoy it.

    Soon I'll be adding auto-AFK I think, meaning players who just sit there and do nothing will be flagged for AFK after a certain amount of time.
     
  20. Offline

    Pythros

    Maybe this would be best with permissions if you get around to that, a way to have a player to be immune to the settings that auto remove the AFK tag?
     
  21. Offline

    isamgray

    Possibly, I'm new to this whole scene, so I don't know much about permissions at all. I'm going to be looking into them soon, but before I get into all the permissions stuff, I want the other things on my to-do list done.

    Also, @Pythros , are you using my plugin? Just curious what servers are now using my plugin. :) And it'd be an honor to have your use mine, cause it seems your server is quite large.
     
  22. Offline

    Zackme

    you should make an afk player can teleport to a specific spot while afk and teleport them back to their original spot
     
  23. Offline

    Pythros

    No not yet. I'm migrating a bunch of plugins and this is on my watch to use when I throw out Essentials. ;)
     
  24. Offline

    isamgray

    I don't think that's really the place of an AFK system like this one. If @NuclearW finishes the API for this like he said he was going to, then I might possibly try and integrate my Home system in a way that will allow someone to set a "default home" and when they /afk, it warps them there for safety. Once again, this is a maybe, would take both plugins, and be able to be disabled on will like the other features of the plugin now.

    Ah gotcha. :) Well, please let me know how it works on your server when you start using it! I'd love to know.
     
  25. Offline

    NuclearW

    Probably going to be done by monday, with all the other things I need to do, just so you know.
     
  26. Offline

    isamgray

    Awesome Monday sounds great.
     
  27. Offline

    wiigor

    Hi isamgray, wow good job on implementing the new feature so fast. maybe i have an idea for you for the auto afk system. Just make a boolean array isActive for every online player. The array should be filled with false initially For every movement or chat command a player issues set the boolean of the player to true (dont even check with if(){} (its faster this way) then every minute check which booleans are not true and those players are marked afk (then reset the booleans) i think this is one of the fastest implementations possible since it has no branches on the main execution path and a very small memory footprint.

    or maybe even more efficient is only listen to chat/use commands and dont listen for movements commands just store the current position and compare it every minute with the old position if the old position == the new position && no chat commands issued => user afk
     
  28. Offline

    isamgray

    Ya, I already had those ideas, thanks for reassuring me in them though. :p I'll probably be implementing that feature in the near future, just gonna be busy for the next few days with Mac/iOS app stuff, and my girlfriend. haha
     
  29. Offline

    seriosbrad

    I take it this doesn't work with herochat or mods with prefixes and such? AFK isn't showing up in anyones names

    edit: nevermind, it shows [AFK] in the /who list. The first post wasn't clear
     
  30. Offline

    wiigor

    well if at time 0 minutes you store the coordinates of player A and at time 5 minutes you compare the old position of player A with the new coordinates then you know very probable that player A has not moved at least for 5 minutes if the coordinates are still the same (its very rare for players to be on the same position after 5 minutes, and very improbable for a to be at time 0 at position (10,-10 and then move and then by coincidence after exactly 5 minutes be again at coordinates 10, -10) This way you only need to run code once every 5 minutes and its very light on resources even if there is a very small probability it will mark some player as afk when he is not.
     
  31. Offline

    isamgray

    Ya, I know. :) I already have how I am going to do it planned out.
     

Share This Page