Aug 31, 2019

OpenAFK

Using Java and Spigot

Introduction

OpenAFK is a plugin for the Spigot Minecraft server software. It's intended to detect players who aren't actively playing the game and may be sat still, or trying to avoid AFK detection in order to keep something such as a farm loaded.

OpenAFK is also able to detect simple automatic fishing farms; although I believe these no longer work in later versions of the game.

Architecture

A lot of plugins of this nature don't have much flexibility, they'll do a single function and then rely upon people having the knowledge to hook into the API of the plugin, I worked around this by creating "ActionScripts", these are a list of actions that run upon certain events, that are fully configurable through YAML.

Sample "Actionscript":

onAfk:
    - action: "afkarea"

    - action: "message"
      content: "&cNow AFK"
      repeat: 2

    - action: "title"
      title: "&c&lAFK"
      subtitle: "&7See you soon!"
      fadeIn: 10
      fadeOut: 10
      stay: "permanent"

    - action: "actionbar"
      content: "&c&lAFK."
      to: "player"
      permanent: true

A full list of actions may be found in the Github README