AFK
Change Log
Check all changes which have been done so far.
Known Bugs
Animals/Players can cancel your AFK status by pushing you.
Using
Write /afk and server will broadcast "player_name is now AFK" message. If you move, type this command again, or type something into chat, server broadcasts opposite message "player_name is no longer AFK". If player is AFK, his name is gray in a player list.
Have outher plugin with /afk command?
then use /afk:afk
If you want to use Afk Time you must add {TIME} key.
ForEx: noAfk: '{DISPLAYNAME} is back after {TIME}!'
Config
# Events: def. true # Colors: def. gray [black, dark_blue, dark_green, dark_aqua, dark_red, dark_purple, gold, gray, dark_gray, blue, green, aqua, red, light_purple, yellow, white] # IdleTimer: def. true, 60 sec # Messages: def. true (keys: {DISPLAYNAME}, {TIME}) Events: move: true chat: true Colors: message: gray player: gray IdleTimer: enabled: true period: 60 Messages: enabled: true nicknames: false +afk: "{DISPLAYNAME} is now AFK" -afk: "{DISPLAYNAME} is no longer AFK"
TO DO
Java 7 | V4.5 | 100 % | done |
Minecraft 1.10 | V4.5.1 | 100 % | done |
Minecraft 1.9 | V4.5 | 100 % | done |
Reason option | V4.5.1 | 100 % | done |
Permissions | 0 % | allmost | |
AFK commands support | 2 % | allmost | |
Reload command | 0 % | none | |
Idle Timer v2 | v4.0.0 | 100 % | done |
AFK Time | v2.1.0 | 100 % | done |
Java 6 | v2.0.2b | 100 % | done |
Idle Timer | v2.0.0 | 100 % | done |
Config | v1.3.0 | 100 % | done |
source code V4.3 & higher | source code V4.2.1 & lower.
Quote:Now that you got an /afk command, would you like an antiswearing plugin? try BSwear
Could you possibly add tab afk-colors that can be customised per player group?
For example:
Colors:
message: gray
groups:
guest: gray
moderator: yellow
users:
schneckk: gray
thisusernameismine: gold
Please let me know what you think :)
Hi, great idea unfortunately it doesn't even register as a command for me.
I get this HUGE error after entering afk mode
2013-02-05 17:53:58 [SEVERE] Exception in thread "pool-1-thread-80" 2013-02-05 17:53:58 [SEVERE] org.apache.commons.lang.UnhandledException: Plugin AFK v3.4.1 generated an exception while executing task 4673 at org.bukkit.craftbukkit.v1_4_R1.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:56) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Caused by: java.lang.IllegalArgumentException: No enum constant org.bukkit.ChatColor.LIGHT_BLUE at java.lang.Enum.valueOf(Unknown Source) at org.bukkit.ChatColor.valueOf(ChatColor.java:13) at com.github.alesvojta.afk.AFK.becomeAFK(AFK.java:124) at com.github.alesvojta.afk.IdleTimer.run(IdleTimer.java:37) at org.bukkit.craftbukkit.v1_4_R1.scheduler.CraftTask.run(CraftTask.java:53) at org.bukkit.craftbukkit.v1_4_R1.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:53) ... 3 more
2013-02-05 17:56:58 [SEVERE] Could not pass event PlayerMoveEvent to AFK v3.4.1 org.bukkit.event.EventException at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:427) at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:477) at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:462) at net.minecraft.server.v1_4_R1.PlayerConnection.a(PlayerConnection.java:220) at net.minecraft.server.v1_4_R1.Packet10Flying.handle(SourceFile:136) at net.minecraft.server.v1_4_R1.NetworkManager.b(NetworkManager.java:290) at net.minecraft.server.v1_4_R1.PlayerConnection.d(PlayerConnection.java:113) at net.minecraft.server.v1_4_R1.ServerConnection.b(SourceFile:39) at net.minecraft.server.v1_4_R1.DedicatedServerConnection.b(SourceFile:30) at net.minecraft.server.v1_4_R1.MinecraftServer.r(MinecraftServer.java:598) at net.minecraft.server.v1_4_R1.DedicatedServer.r(DedicatedServer.java:224) at net.minecraft.server.v1_4_R1.MinecraftServer.q(MinecraftServer.java:494) at net.minecraft.server.v1_4_R1.MinecraftServer.run(MinecraftServer.java:427) at net.minecraft.server.v1_4_R1.ThreadServerApplication.run(SourceFile:849) Caused by: java.lang.IllegalArgumentException: No enum constant org.bukkit.ChatColor.LIGHT_BLUE at java.lang.Enum.valueOf(Unknown Source) at org.bukkit.ChatColor.valueOf(ChatColor.java:13) at com.github.alesvojta.afk.AFK.cancelAFK(AFK.java:160) at com.github.alesvojta.afk.Events.onPlayerMove(Events.java:79) at sun.reflect.GeneratedMethodAccessor361.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:425) ... 14 more
worked fine, but if i change the color of the broadcast it crashes.
help?
add auto kick after long afk ? :D
Hey, great plugin, but I have an issue: It doesn't show my display name correctly; My real name is "sentriz", and my display name is "&csentriz" (sentriz in red).. other players have different colours, eg. "&6toolers". Currently, it only shows my name in grey, like the rest of the text. Please help me. Thanks in advance, Senan.
Hi,
You have done a great plugin but the way you made it is horrible :( You should not be creating task/timer for each player. It can use a lot of ram and too much the cpu.
I highly suggest you to do this in next version:
1. Create only ONE scheduleSyncRepeatingTask
2. Create a HashMap<String, long> (String is playerName and long idle time)
3. In your task check if the idle time is over x, if it is then broadcast he is afk
4. Use listener : OnPlayerMove, OnPlayerChat.. and when those are trigged, reset idle time
and btw, that way it is compatible with Java 6 ;)
Thanks ! :)
@grid21
Hello, this was probably caused by 'LIGHT_BLUE' colour which isn't supported, see # Colors: def. gray [black, dark_blue, dark_green, dark_aqua, dark_red, purple, gold, gray, dark_gray, indigo, bright_green, aqua, red, pink, yellow, white] in config file or http://www.minecraftwiki.net/wiki/Formatting_codes
BTW it will be updated to 1.4 but unfortunately I don't have created workspace after w8 upgrade yet and I'm still busy in my job too. I'll try at the weekend.Updated!
Guess what? I have a Java error.
2012-10-31 16:49:04 [SEVERE] Exception in thread "pool-1-thread-11" 2012-10-31 16:49:04 [SEVERE] org.apache.commons.lang.UnhandledException: Plugin AFK v3.4.0 generated an exception while executing task 118 at org.bukkit.craftbukkit.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:56) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Caused by: java.lang.IllegalArgumentException: No enum constant org.bukkit.ChatColor.LIGHT_BLUE at java.lang.Enum.valueOf(Unknown Source) at org.bukkit.ChatColor.valueOf(ChatColor.java:13) at com.github.alesvojta.afk.AFK.becomeAFK(AFK.java:124) at com.github.alesvojta.afk.IdleTimer.run(IdleTimer.java:37) at org.bukkit.craftbukkit.scheduler.CraftTask.run(CraftTask.java:53) at org.bukkit.craftbukkit.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:53) ... 3 more
2012-10-31 16:49:38 [SEVERE] Could not pass event PlayerMoveEvent to AFK v3.4.0 org.bukkit.event.EventException at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:341) at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:477) at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:462) at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:218) at net.minecraft.server.Packet10Flying.handle(SourceFile:136) at net.minecraft.server.NetworkManager.b(NetworkManager.java:282) at net.minecraft.server.NetServerHandler.d(NetServerHandler.java:111) at net.minecraft.server.ServerConnection.b(SourceFile:35) at net.minecraft.server.DedicatedServerConnection.b(SourceFile:30) at net.minecraft.server.MinecraftServer.r(MinecraftServer.java:569) at net.minecraft.server.DedicatedServer.r(DedicatedServer.java:215) at net.minecraft.server.MinecraftServer.q(MinecraftServer.java:486) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:419) at net.minecraft.server.ThreadServerApplication.run(SourceFile:818) Caused by: java.lang.IllegalArgumentException: No enum constant org.bukkit.ChatColor.LIGHT_BLUE at java.lang.Enum.valueOf(Unknown Source) at org.bukkit.ChatColor.valueOf(ChatColor.java:13) at com.github.alesvojta.afk.AFK.cancelAFK(AFK.java:160) at com.github.alesvojta.afk.Events.onPlayerMove(Events.java:79) at sun.reflect.GeneratedMethodAccessor102.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:339) ... 14 more 2012-10-31 16:49:39 [SEVERE] Could not pass event PlayerMoveEvent to AFK v3.4.0 org.bukkit.event.EventException at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:341) at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:477) at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:462) at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:218) at net.minecraft.server.Packet10Flying.handle(SourceFile:136) at net.minecraft.server.NetworkManager.b(NetworkManager.java:282) at net.minecraft.server.NetServerHandler.d(NetServerHandler.java:111) at net.minecraft.server.ServerConnection.b(SourceFile:35) at net.minecraft.server.DedicatedServerConnection.b(SourceFile:30) at net.minecraft.server.MinecraftServer.r(MinecraftServer.java:569) at net.minecraft.server.DedicatedServer.r(DedicatedServer.java:215) at net.minecraft.server.MinecraftServer.q(MinecraftServer.java:486) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:419) at net.minecraft.server.ThreadServerApplication.run(SourceFile:818) Caused by: java.lang.IllegalArgumentException: No enum constant org.bukkit.ChatColor.LIGHT_BLUE at java.lang.Enum.valueOf(Unknown Source) at org.bukkit.ChatColor.valueOf(ChatColor.java:13) at com.github.alesvojta.afk.AFK.cancelAFK(AFK.java:160) at com.github.alesvojta.afk.Events.onPlayerMove(Events.java:79) at sun.reflect.GeneratedMethodAccessor102.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:339) ... 14 more
Will this be updated to 1.4?
@schneckk
I don't see it anymore, so I think its fixed... thanks :)
If you want suggestions, I have a few:
New version 3.4.0 was uploaded, please test it for 'NullPointerException', thanks. :]
@schneckk
Yea, I'm also getting a null error:
Caused by: java.lang.NullPointerException at com.github.alesvojta.afk.AFK.isPlayerAfk(AFK.java:28) at com.github.alesvojta.afk.IdleTimer.run(IdleTimer.java:33)
Not exactly sure when/why its happening though but I see it in the Console frequently.
@hdnerds
I think I have something wrong in my code. I'll fix this but unfortunately I don't have much time now, sorry.
@grid21
I get that message to, do you think it has to do with the permissions?
I get an error in my console when loggout of the server. It's a good plugin but this error needs fixing.
2012-10-08 23:00:06 [SEVERE] Could not pass event PlayerQuitEvent to AFK org.bukkit.event.EventException at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:341) at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:477) at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:462) at net.minecraft.server.ServerConfigurationManagerAbstract.disconnect(ServerConfigurationManagerAbstract.java:206) at net.minecraft.server.NetServerHandler.disconnect(NetServerHandler.java:165) at org.bukkit.craftbukkit.entity.CraftPlayer.kickPlayer(CraftPlayer.java:216) at com.runicsystems.bukkit.AfkBooter.AfkBooter$PlayerKicker.run(AfkBooter.java:714) at org.bukkit.craftbukkit.scheduler.CraftTask.run(CraftTask.java:52) at org.bukkit.craftbukkit.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:321) at net.minecraft.server.MinecraftServer.q(MinecraftServer.java:509) at net.minecraft.server.DedicatedServer.q(DedicatedServer.java:213) at net.minecraft.server.MinecraftServer.p(MinecraftServer.java:473) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:405) at net.minecraft.server.ThreadServerApplication.run(SourceFile:539) Caused by: java.lang.NullPointerException at com.github.alesvojta.afk.Events.getTaskId(Events.java:54) at com.github.alesvojta.afk.Events.onPlayerQuit(Events.java:96) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:339) ... 14 more
its very usefull super :)
Then I would like the AFK-Prefix while afk... :)
@HeavenMc
It has an option to disable afk while chatting. However, depending on your chat plugin you may require some changes to code to support your chat plugin. Although that shouldn't affect the config option.
Hi !
Awesome plugin (i guess that is integrated into Essentials, because it seems to be exactly the same).
But i search a plugin similary of "jail", for exemple, if i say /afk, i'm tp in location where i have make /setafk and once teleport if a speak, move, or types a command, i am immediately teleport on the default spawn or in my home (if i make sethome).