There are some plugins that broadcast when a player has gone AFK. That's fine, but if a player joins after the broadcast, how is that player going to know that the first player is AFK? This plugin solves that problem.
When a player goes AFK, the plugin will turn their player's name blue and will put the characters "(AFK)" at the end of their name in the tab list. Other players will know this player is going AFK because the server broadcasts that the player is AFK, and players who miss the broadcast simply have to hold down tab to view those who are AFK.
Players who are AFK will not take damage or lose hunger.
Commands
There are two commands.
There are three permissions.
This is the default config:
This plugin uses the scoreboard's teams. When the plugin is enabled, the plugin will create the team called "afkers" if it doesn't exist already. It will set the team color to blue and set the team suffix to " (AFK)" if the team is created. When players type /afk, they will be put into the "afkers". Once they type /afk again, or somehow else leave AFK mode, they will be taken out of the "afkers" team, and will not be in a team afterward.
If allow-collisions is set to true in the config, the team's collisions rule is set to NEVER when the plugin is loaded or reloaded. Otherwise, the team's collisions rule is set to ALWAYS.
API Documentation
WhosAFK calls an event when a player goes into AFK mode (either by command, or automatic) and when a player leaves AFK. Here's an example:
Source Code
The source code is on GItHub. Click here to view on GitHub.
To-do List
When a player goes AFK, the plugin will turn their player's name blue and will put the characters "(AFK)" at the end of their name in the tab list. Other players will know this player is going AFK because the server broadcasts that the player is AFK, and players who miss the broadcast simply have to hold down tab to view those who are AFK.
Players who are AFK will not take damage or lose hunger.
Commands
There are two commands.
- /afk : This is the main command which will broadcast that the player who executed the command is AFK. An operator can set another player's status to AFK by adding the other player's username as an argument to the command.
- /whosafkreload : Use this command to reload the config if you make a change to it. Requires the permission whosafk.reload .
There are three permissions.
- whosafk.afk : Allows the player to use the command /afk. By default all players have this.
- whosafk.autoafk : Allows the player to automatically go into AFK mode if he stands still for a while. By default all players have this.
- whosafk.reload : Allows player to use the command /whosafkreload. By default this is given to operators.
This is the default config:
Code (Text):
auto-afk:
enabled: true
timeout: 60
allow-movement-while-afk: true
movement-affects-afk: true
allow-collisions: false
enabled: true
timeout: 60
allow-movement-while-afk: true
movement-affects-afk: true
allow-collisions: false
- auto-afk.enabled : If set to true, the plugin will automatically put players into AFK mode if they do nothing for a configurable amount of time.
- auto-afk.timeout : This is the number of seconds during which players must do nothing in order to be automatically put in AFK mode.
- allow-movement-while-afk : If set to false, players will not be able to move until they type /afk.
- movement-affects-afk : If set to true, players will automatically leave AFK mode if they move or some exterior force moves the player. NOTE: This has no effect if allow-movement-while-afk is set to false .
- allow-collisions : If set to false, other mobs or players cannot push players in AFK mode, which will push them out of AFK mode.
This plugin uses the scoreboard's teams. When the plugin is enabled, the plugin will create the team called "afkers" if it doesn't exist already. It will set the team color to blue and set the team suffix to " (AFK)" if the team is created. When players type /afk, they will be put into the "afkers". Once they type /afk again, or somehow else leave AFK mode, they will be taken out of the "afkers" team, and will not be in a team afterward.
If allow-collisions is set to true in the config, the team's collisions rule is set to NEVER when the plugin is loaded or reloaded. Otherwise, the team's collisions rule is set to ALWAYS.
API Documentation
WhosAFK calls an event when a player goes into AFK mode (either by command, or automatic) and when a player leaves AFK. Here's an example:
Code (Text):
@EventHandler
public void playerGoesIntoAFKMode(AFKStatusOnEvent e){
// Set a custom message:
e.setMessage(ChatColor.YELLOW + "- " + e.getPlayer().getName() + " is now AFK");
// Disable the message
e.setMessage(null);
// Cancel the event
e.setCancelled(true);
}
@EventHandler
public void playerLeavesAFKMode(AFKStatusOffEvent e){
// Set a custom message:
e.setMessage(ChatColor.YELLOW + "- " + e.getPlayer().getName() + " is no longer AFK");
// Disable the message
e.setMessage(null);
// Cancel the event
e.setCancelled(true);
}
public void playerGoesIntoAFKMode(AFKStatusOnEvent e){
// Set a custom message:
e.setMessage(ChatColor.YELLOW + "- " + e.getPlayer().getName() + " is now AFK");
// Disable the message
e.setMessage(null);
// Cancel the event
e.setCancelled(true);
}
@EventHandler
public void playerLeavesAFKMode(AFKStatusOffEvent e){
// Set a custom message:
e.setMessage(ChatColor.YELLOW + "- " + e.getPlayer().getName() + " is no longer AFK");
// Disable the message
e.setMessage(null);
// Cancel the event
e.setCancelled(true);
}
Source Code
The source code is on GItHub. Click here to view on GitHub.
To-do List
- Add Configuration file Done!
Quick facts
- Edition: Minecraft Java
- File type: .jar
- Minecraft versions listed: 1.7, 1.8, 1.9
- How to install: Install the matching mod loader (Forge, Fabric or NeoForge) for your Minecraft version. → Download the .jar. → Put it in the .minecraft/mods folder and launch that loader profile.
- Where to get it: Opens on Spigot — not every file is mirrored on our own servers.
Install steps are the general flow for this file type — How to install Minecraft Java mods & modpacks walks through it step by step.
WhosAFK is a free Minecraft Java mod. Compatible with Minecraft 1.7, 1.8, 1.9, 1.10 and newer. Downloaded 57,359 times (via Spigot). Download it and open it directly in the game.