import com.sk89q.worldedit.bukkit.BukkitAdapter
import com.sk89q.worldguard.bukkit.WorldGuardPlugin
on load:
Check if WorldGuard plugin is available
if not pluginExists("WorldGuard"):
stop("This script requires WorldGuard plugin to be installed.")
Check if a player is standing in the AFK pool region every second
every 1 second:
loop all players:
if player is standing in afk pool region:
if {player} afk token timer is set:
# Check if the player has been standing for 5 minutes
if {player} afk token timer is >= 300:
remove {player} afk token timer
give {player} 1 lime dye named "AfkToken"
else:
set {player} afk token timer to 1
else:
remove {player} afk token timer
Define the AFK pool region
region afk pool:
flags:
- interact allow
- build allow
Function to check if a player is standing in the AFK pool region
function player is standing in afk pool region:
if region "afk pool" is in WorldGuardPlugin:
set {_loc} to player's location
set {_region} to region "afk pool" in WorldGuardPlugin
return {_region} contains {_loc}
else:
stop("The AFK pool region is not defined.")