An open API service indexing awesome lists of open source software.

https://github.com/sakura-ryoko/afkplus

AFK Plus Mod for Minecraft. Developed for my RyokoCraft Vanila+ SMP -- This project started out as a fork of "AfkDisplay" by beabfc.
https://github.com/sakura-ryoko/afkplus

afk fabricmc-mod minecraft-mod

Last synced: 4 months ago
JSON representation

AFK Plus Mod for Minecraft. Developed for my RyokoCraft Vanila+ SMP -- This project started out as a fork of "AfkDisplay" by beabfc.

Awesome Lists containing this project

README

          

# AfkPlus Fabric Mod for Minecraft

![Example](https://sakuraryoko.com/files/1260026/afkplus.jpg)

## Basic Description:
- A forked project based upon AfkDisplay by beabfc. He has given me his blessing with proceeding to create this mod, look under my Archived Issues pane.
- Show which players are AFK in the player list, see the Reasons, Durations, and Times.
- Fully configurable and with [Placeholder API](https://placeholders.pb4.eu/user/general/), which includes all Placeholder API formatting nodes such as: yellow or bold natively. (You can even include a URL in your AFK Reason!)
- Mod can now be used on Single Player, and Integrated Servers (Open to LAN).

## Features :blush:
- Added a placeholder `%afkplus:afk%` for you to offer a very basic '**[AFK]**' tag to players who are AFK.
- Added a placeholder `%afkplus:name%`/`%afkplus:display_name%` so that you can use this as a replacement for the '**%player:displayname%**' placeholder under other Mods, such as [Styled Playerlist](https://modrinth.com/mod/styledplayerlist "Styled Playerlist").
***NOTE that this method was designed to be fully compliant with LuckPerms Prefixes under Styled Playerlist, because the standard method for playerlist updating fails, or you can simply use %afkplus:afk% to add formatting to existing names if you like.***
- Added a placeholder `%afkplus:duration%` so that you can get the time since someone went AFK, with configuration for a format prefix.
- Added a placeholder `%afkplus:time%` so that you can get the Time/Date when someone went AFK, with configuration for a format prefix.
- Added a placeholder `%afkplus:reason%` so that you can port the Afk Reason for why someone went AFK, with configuration for a format prefix.
- Added a placeholder `%afkplus:invulnerable%` so that you can display the "Disable Damage" status for all users, similar to the "[AFK]" placeholder tag, but more or less an "add on".
- There is a special configuration option 'prettyDuration' to configure the AFK Duration in a more human-readable format, instead of the default (HH:mm:ss.mss) format. Each method has its advantages though. ([Styled Nicknames](https://modrinth.com/mod/styled-nicknames) or [Styled Chat](https://modrinth.com/mod/styled-chat) comes to mind here)
- There are several mod / data pack conflict warnings for administrators to help them make better decisions on what mods they want to install.
- Added a "disableDamage" configuration to make AFK players immune to damage after a 15-second cool down. A new configurable server-wide message is now enforced by default when this occurs.
- Added a "disableDamageCooldown" configuration to allow Administrators to adjust the default "timer" that is applied after a player goes AFK. I highly recommend not setting this to '0', unless you don't think your players will abuse this privilege.
- Added a "whenDamageDisabled" configuration so that you can customize the message displayed when your players are marked as invulnerable.
- Added a "whenDamageEnabled" configuration so that you can customize the message displayed when your players are unmarked as invulnerable.
- Now also checks for if players are in Spectator Mode, and not only Creative for managing your AFK/Disable Damage status.
- [NEW] Adds several color nodes that players can use for AFK Reasons. See /afkex for a display example.
- brown, cyan, dark_brown, dark_pink, light_blue, light_brown, light_gray, light_pink, lime, magenta, purple, salmon,
- bluetiful, burnt_orange, canary, cool_mint, copper, powder_blue, royal_purple, shamrock, tickle_me_pink, ultramarine_blue
- [NEW] Added a "bypassSleepCount" configuration so that you can allow players marked as Afk to bypass the Sleeping Requirements.
- [NEW] Added a "bypassInsomnia" configuration so that you can allow players marked as Afk to block Phantom spawning.
- [NEW] Added a "/noafk" command for players to stop themselves from being marked as Afk.
- [NEW] Added a "displayDuration" configuration option so that you can enable/disable the "Gone for XX minutes, XX seconds" during whenReturn.
- [NEW] Added additional handling to allow "afkTimeoutString" to be set to "", and passing the "defaultReason" as "" to have more of the "Original" AfkDisplay feel.
- [NEW] Added a new "AFK Kick" system to automatically kick players from the server who are AFK after a configured amount of time. It has several configuration options:
- `afkKickEnabled` - (true/false) Enables the AFK Auto Kick manager.
- `afkKickNonSurvival` - (true/false) Allows Kicking Creative / Spectator players.
- `afkKickTimer` - The time beyond `timeoutSeconds` (Additive) when a player gets removed from the server, so if `timeoutSeconds` is 240, and `afkKickTimer` is set to 3600, the actual time they get kicked is at **3840**, or 64 minutes at the longest.
- `afkKickSafePermissions` - (Permission 3) The default Permissions level that is marked "safe" from being automatically kicked. (Luck Perms: afkplus.kick.safe)
- Note; that if a player has `afkPlusCommandPermissions` (Luck Perms: afkplus.afkplus), they will also be marked as safe from being automatically kicked, but this new configuration allows you to configure these permissions separately.
- `afkKickMessage` - The message sent to Players that get kicked as the reason for their removal. (Adds the Duration when `displayDuration` is enabled)
- `whenKicked` - The message broadcast to the server when a player gets kicked for being AFK. (Adds the Duration when `displayDuration` is enabled)
- NOTES: This feature *DOES NOT* automatically kick Carpet Mod Bots, because the 'fake' players do not get ticked by the server.
- This feature *DOES NOT* work in Single Player/Open To Lan, and requires a Dedicated Server Environment to function properly.

## Commands (Permissions via [Luck Permissions](https://luckperms.net/) or the AfkPermissions configurations)
- '**/afkplus**' with the AfkPlusCommandPermissions (Default: 4) setting the default restrictions. (Permission: afkplus.afkplus)
- Displays the Mod Version information.
- '**/afkplus reload**' command. (Permission: afkplus.afkplus.reload)
- This allows an Administrator to reload the configuration while the server is running.
- '**/afkplus ex**' command. (Permission: afkplus.afkplus.ex)
- This displays a simple "formatting test" to show the user what basic text nodes are available to use, and this also allows them to use this for Copy/Paste by clicking on colors/formats.
- '**/afkplus set [Player] [Reason]**' command. (Permission: afkplus.afkplus.set)
- This allows any administrator to set the AFK status of a player, and this also removes their NoAFK status.
- '**/afkplus clear [Player]**' command. (Permission: afkplus.afkplus.clear)
- This allows any administrator to clear the AFK status of a player.
- '**/afkplus damage enable [Player]**' command. (Permission: afkplus.afkplus.damage.enable)
- This allows an Administrator to force-enable an AFK player's ability to be damaged as long as they are connected.
- '**/afkplus damage disable [Player]**' command. (Permission: afkplus.afkplus.damage.disable)
- This allows an Administrator to revert a player's ability to use "Disable Damage" after it was forcefully removed.
- '**/afkplus info [Player]**' command. (Permission: afkplus.afkplus.info)
- This allows any administrator to check the AFK status of a player, and display the time and duration since they went AFK.
- '**/afkplus update [Player]**' command. (Permission: afkplus.afkplus.update)
- This allows any administrator to force a player list update for a player.
- '**/afkinfo [Player]**' with the AfkInfoCommandPermissions (Default: 2) setting the default restrictions, (Permission: afkplus.afkinfo)
- Does the same thing as '**/afkplus info [Player]**', but can be used for Mods, or players, or however you like to configure it for people to see.
- '**/afkex**' with the AfkExCommandPermissions (Default: 0) setting the default restrictions. (Permission: afkplus.afkex)
- This displays a simple "formatting test" to show the user what basic text nodes are available to use, and this also allows them to use this for Copy/Paste by clicking on colors/formats.
- '**/afk [Reason]**' with the AfkCommandPermissions (Default: 0) setting the default restrictions. (Permission: afkplus.afk)
- This allows any user to use a [Reason] along with setting their AFK status.
- [NEW] '**/noafk**' with the noAfkCommandPermissions (Default: 0) setting the default restrictions. (Permission: afkplus.noafk)
- This allows any user to set themselves in a state where they will not go Afk based on the configured timeout value.
- [NEW] 'afkKickSafePermissions' (Default: 3) sets the default permissions to mark an AFK player as safe from being kicked. (Permission: afkplus.kick.safe)

## Potential known conflicts (Make your choice)
- [afk display Data pack](https://vanillatweaks.net/picker/datapacks/) (Vanilla Tweaks Data pack, changes the player list display) -- Mod checks for any "afk" containing data packs in the name.
- [AfkDisplay](https://modrinth.com/mod/afkdisplay) -- because this is the mod that AfkPlus is based upon, and offers fewer features.
- [AntiLogout](https://modrinth.com/mod/noexits) (/afk command, timeout handling)
- [Auto AFK](https://modrinth.com/mod/auto-afk) (/afk command, timeout handling)
- [Sessility](https://modrinth.com/mod/sessility) (timeout handling)
- [Playtime-Tracker](https://modrinth.com/mod/playtime-tracker) (timeout handling)
- [SvrUtil](https://modrinth.com/mod/svrutil) (/afk command, the rest is safe)

## Example Configuration
The configuration is located in `afkplus.toml` inside your servers config folder.

```toml
[AfkPlusOptions]
# Allows you to disable the /afk command to mark yourself as AFK, with an optional [Reason] (Default: true)
enableAfkCommand = true
# Allows you to disable the /noafk command to mark yourself as NoAFK, which disables the timeout (Default: true)
enableNoAfkCommand = true
# Allows you to disable the /afkex command to allow players to see some default formattting nodes available. (Default: true)
enableAfkExCommand = true
# Allows you to disable the /afkinfo command to allow players to see someone's AFK status (Time, Duration, Reason). (Default: true)
enableAfkInfoCommand = true
# The /afk default command permissions, configurable with Luck Perms (afkplus.afk) node (Default: 0)
afkCommandPermissions = 0
# The /noafk default command permissions, configurable with Luck Perms (afkplus.noafk) node (Default: 0)
noAfkCommandPermissions = 0
# The /afkex default command permissions, configurable with Luck Perms (afkplus.afkex) node (Default: 0)
afkExCommandPermissions = 0
# The /afkinfo default command permissions, configurable with Luck Perms (afkplus.afkinfo) node (Usually for Mods) (Default: 2)
afkInfoCommandPermissions = 2
# The /afkplus default command permissions, configurable with Luck Perms (afkplus.afkplus with .subcommands) node (Default: 3)
afkPlusCommandPermissions = 3
# The default "timeout" AFK reason (Default: "timeout")
# --note; "" is a valid setting, and will disable the default timeout reason.
afkTimeoutString = "timeout"

[packetOptions]
# The time without actions after which a player is considered AFK. Set to -1 to disable automatic AFK detection. (Default: 240)
# --note; the Original AfkDisplay's default timeout was set to 180 seconds.
timeoutSeconds = 240
# Consider players that moved no longer AFK (enables easy bypass methods like AFK pools) (Default: false)
resetOnMovement = false
# Consider players which looked around no longer AFK (Default: false)
resetOnLook = false
# Disable damage after disableDamageCooldown seconds since a player went AFK (Default: false)
disableDamage = false
# Cooldown timer for enabling the "DisableDamage" feature. (Default: 15 seconds)
# - WARNING! Be advised that settings this too low can encourage poor player behavior.
disableDamageCooldown = 15
# Makes it so that Afk players are not counted in the Sleep Percentage check (Default: true)
bypassSleepCount = true
# Makes it so that Afk Players block Phantom Spawning attempts. (Default: true)
bypassInsomnia = true
# Enables the AFK Auto-Kick system. (Default: false)
afkKickEnabled = false
# Allows Non-Survival players to be kicked (Creative, Spectator, etc) (Default: false)
afkKickNonSurvival = false
# The time after `timeoutSeconds` to automatically kick an AFK player (Default: 3600, aka. 1 hour)
# --note; that this value is "Additive" to the `timeoutSeconds` value, so the actual time will be 3840, aka. 64 minutes.
afkKickTimer = 3600
# Default permission level to mark players as "safe" from being automatically kicked, i.e., Server Admins (Default: 3)
afkKickSafePermissions = 3

[PlaceholderOptions]
# This will be the value of the placeholder %afkplus:afk% if a player is AFK, option accepts full formatting nodes
# (Default: "[AFK%afkplus:invulnerable%]")
# -- note; *DOES NOT* place an "" at the end in the code (trying not to modify its default behavior)
afkPlaceholder = "[AFK%afkplus:invulnerable%]"
# Placeholder %afkplus:name% for backporting the entire %displayname% for use in other Mods, such as Styled Playerlist
# (Default: "[AFK%afkplus:invulnerable%] %player:displayname_unformatted%")
# -- note; *DOES NOT* places an "" at the end in the code (trying not to modify its default behavior)
afkPlusNamePlaceholderAfk = "[AFK%afkplus:invulnerable%] %player:displayname_unformatted%"
# Value for when a player is NOT AFK, (i.e., the default "%player:displayname%")
# -- note; *DOES NOT* places an "" at the end in the code (trying not to modify its default behavior)
afkPlusNamePlaceholder = "%player:displayname%"
# Adds a formatting prefix node for %afkplus:duration% (default: )
# -- note; places an "" at the end in the code, and this is used during /afkinfo
afkDurationPlaceholderFormatting = ""
# Adds a formatting prefix node for %afkplus:time% (default: )
# -- note; places an "" at the end in the code, and this is used during /afkinfo
afkTimePlaceholderFormatting = ""
# Adds a formatting prefix node for %afkplus:reason%, I'm not sure why someone might want this enabled, because
# formatting your [Reason] yourself is fun. (default: none)
# -- note; places an "" at the end of the code, and this is used during /afkinfo
afkReasonPlaceholderFormatting = ""
# Adds an option for using the "pretty" human-readable output for the %duration% placeholder. This might cause unexpected
# issues depending on where you use the placeholder. (Default: false)
afkDurationPretty = false
# Adds an option to configure a basic "Add-On" placeholder for attaching to the "[AFK]" tag to mark when a player is
# marked as Invulnerable using %afkplus:invulnerable% (Default: ":I")
afkInvulnerablePlaceholder = ":I"

[playerListOptions]
# Change the playerlist name for players who are AFK (Default: true)
# -- note; This is for when you're NOT using a player list display mods.
enableListDisplay = true
# The name that is shown in the playerlist if a player is AFK, and accepts formatting nodes
# (Default: "[AFK%afkplus:invulnerable%] %player:displayname%")
# -- note; This function works best when not using Player List mods!*
afkPlayerName = "[AFK%afkplus:invulnerable%] %player:displayname%"

[messageOptions]
# Enables chat messages when a player goes AFk or returns. (Default: true)
enableMessages = true
# The message content when a player goes AFK, and accepts formatting nodes (Default: "%player:displayname% is now AFK")
whenAfk = "%player:displayname% is now AFK"
# The messages content when a player returns from AFK, and accepts formatting nodes.
# (Default: "%player:displayname% is no longer AFK")
# --note; that this message gets the AFK duration added to the end if `displayDuration` is set to true.
whenReturn = "%player:displayname% is no longer AFK"
# Re-Formats the "duration" in chat messages and /afkinfo to a more human-readable format. (Default: true)
prettyDuration = true
# Default reason for going AFK via the /afk command. Leave in a poof of smoke without having to give a reason.
# (Default: "poof!")
# --note; "" is a valid setting, and will disable the default /afk reason.
defaultReason = "poof!"
# The message content when an AFK player is marked as Invulnerable.
# (Default: "%player:displayname% is marked as Invulnerable.")
whenDamageDisabled = "%player:displayname% is marked as Invulnerable."
# The message content when an AFK player is no longer marked as Invulnerable.
# (Default: "%player:displayname% is no longer Invulnerable.")
whenDamageEnabled = "%player:displayname% is no longer Invulnerable."
# This enables the display of "Gone for XX minutes, XX seconds" portion of the whenReturn message.
# (Default: true)
displayDuration = true
# The Kick Reason message sent to players that are removed. Can be set to "" to get a basic "AFK timeout" reason.
# (Default: "AFK beyond the allowed time limit set by your Administrator.")
# --note; that this message gets the AFK duration added to the end if `displayDuration` is set to true.
afkKickMessage = "AFK beyond the allowed time limit set by your Administrator."
# The message content when an AFK player gets kicked from the server.
# (Default: "%player:displayname% was kicked for being AFK.")
# --note; that this message gets the AFK duration added to the end if `displayDuration` is set to true.
whenKicked = "%player:displayname% was kicked for being AFK."
```