Skip to content

Task Module Specification

Overview

The task channel is the core communication channel of the Yeow plugin, used to perform all game-state-related operations.

Message Format

json
{
  "type": "player.get",
  "params": { "key": "value" },
  "cb": "cb_42"
}
FieldTypeRequiredDescription
typestringYesTask type identifier, named by functional module (e.g. player.get)
paramsobjectNoTask parameters, each task has its own fields
cbstringNoCallback ID. Present → asynchronous: the runtime immediately returns null and delivers the result through the callback. Absent → synchronous: the runtime blocks JS until completion and returns the result synchronously

Priority

Task priority can be controlled via the message top-level priority field (at the same level as cb):

ValueBudget shareDescription
high50%High priority (default priority of synchronous call)
normal30%Default priority (default priority of asynchronous post)
low20%Low priority
json
{ "type": "player.get", "params": { "identifier": "uuid" }, "priority": "high" }

If not provided or an invalid value is given, it falls back to normal. The runtime allocates execution time each tick according to the budget proportions. If the high-priority budget is not fully used, the remainder spills over to the next level. Once all budgets are exhausted, the remaining tasks queue up for the next tick. Finally, it enters a greedy phase (ignoring the budget and consuming as much as possible in priority order).

Return Value Conventions

  • Returns true/false — whether the operation succeeded
  • Returns null — entity/player/world does not exist
  • Returns {} object — contains specific data
  • Returns [] array — list data
  • Asynchronous tasks deliver results through the cb channel

Error Handling

If an exception is thrown during task execution, the callback data field r is an object containing detailed error information:

json
{
  "err": "java.lang.NullPointerException",
  "type": "NullPointerException",
  "task": "pdc.get",
  "stack": "java.lang.NullPointerException\n\tat ...\n\tat ..."
}
FieldTypeDescription
errstringException message
typestringJava exception class name
taskstringTask type that triggered the exception
stackstringFull Java stack trace

Module List

ModuleDescriptionTask count
playerPlayer operations51
entityEntity + potion effects38
worldWorld + block + chunk snapshot + sound + particle + entity spawn + WorldBorder49
inventoryInventory + container blocks + custom Inventory17
serverServer-global operations + Material queries + permission registration13
commandCommand registration + Tab completion4
event-systemEvent subscription/completion3
bossbarBossBar12
scoreboardScoreboard24
pdcCustom persistent data6
advancementAdvancements5
recipeRecipes3

Total: 225 tasks (permission.register counted in the server module; material.* counted in server; block.breakNaturally, chunk.* counted in world). The Paper and Folia task sets are strictly identical (Folia's recipe.add is dispatched internally by recipe type shaped/shapeless/furnace/blast/smoker/campfire, not as separate tasks). Counting basis: number of task-semantics cases in Tasks.java / FoliaTasks.java, 2026-08-18.