Skip to content

API reference / @jsprismarine/prismarine / scripting/scriptPlayerActions

scripting/scriptPlayerActions ​

Interfaces ​

ScriptPlayerActions ​

Defined in: packages/prismarine/src/scripting/scriptPlayerActions.ts:37

What a level's scripts reach of its players' item use and block breaking.

Methods ​

events() ​

events(listener): () => void

Defined in: packages/prismarine/src/scripting/scriptPlayerActions.ts:51

Calls listener with each block a player of the level broke, each item one used and each click on a block or an entity that did something.

Parameters ​
listener ​

(event) => void

Returns ​

A function that stops it.

() => void

guardBlockBreak() ​

guardBlockBreak(guard): () => void

Defined in: packages/prismarine/src/scripting/scriptPlayerActions.ts:39

Parameters ​
guard ​

VetoGuard<BlockBreakIntent>

Returns ​

A function that removes the guard.

() => void

guardBlockInteract() ​

guardBlockInteract(guard): () => void

Defined in: packages/prismarine/src/scripting/scriptPlayerActions.ts:43

Parameters ​
guard ​

VetoGuard<BlockInteractIntent>

Returns ​

A function that removes the guard.

() => void

guardEntityInteract() ​

guardEntityInteract(guard): () => void

Defined in: packages/prismarine/src/scripting/scriptPlayerActions.ts:45

Parameters ​
guard ​

VetoGuard<EntityInteractIntent>

Returns ​

A function that removes the guard.

() => void

guardItemUse() ​

guardItemUse(guard): () => void

Defined in: packages/prismarine/src/scripting/scriptPlayerActions.ts:41

Parameters ​
guard ​

VetoGuard<ItemUseIntent>

Returns ​

A function that removes the guard.

() => void

Type Aliases ​

ScriptPlayerActionEvent ​

ScriptPlayerActionEvent = Extract<ScriptWorldEvent, { type: "playerBreakBlock" | "itemUse" | "playerInteractWithBlock" | "playerInteractWithEntity"; }>

Defined in: packages/prismarine/src/scripting/scriptPlayerActions.ts:31

The after-events of a player's actions.

Functions ​

levelPlayerActions() ​

levelPlayerActions(server, level): ScriptPlayerActions

Defined in: packages/prismarine/src/scripting/scriptPlayerActions.ts:62

Builds the player actions of one level's scripts.

Parameters ​

server ​

Server

The server whose events carry the actions.

level ​

Level

The level whose players the scripts see.

Returns ​

ScriptPlayerActions