Play Strawberry Belgeler
Başvuru

Bu sayfa İngilizce gösteriliyor.

Script worlds

The script worlds: what every script imports and exports, and the two optional worlds.

Declarations from the script contract strawberry:plugin, version 0.2.0, without source comments.

The three worlds

  • plugin: every script implements it. The SDK builds it for you.
  • extended-plugin: plugin plus the optional handle-extension-event export. The server calls it when a script has it, so scripts built for plugin keep loading. The SDK builds this world.
  • gametest-plugin: plugin plus the GameTest import and callbacks, which the GameTest runner of a developer server calls.

World plugin

text
use context.{context};
use event.{event};
use server.{server as server-instance};
use command.{command-sender, consumed-args, command-error, command-suggestions, suggestion-request};
use %world.{entity, chunk-buffer, generation-phase};
use ipc.{plugin-id, ipc-message};
import logging;
import gui;
import scoreboard;
import server;
import text;
import command;
import context;
import i18n;
import scheduler;
import %world;
import entity;
import boss-bar;
import forms;
import java-dialogs;
import status-effect;
import block-entity;
import ipc;
import attributes;
import player;
import advancement;
import recipe;
import inventory;
import datapack;
import enchantments;
import damage-types;
import screens;
import statistics;
import display;
import game-rules;
import game-events;
import potions;
import entity-statuses;
import password;
import store;
import purchases;
import player-data;
import login-gate;
import connection-check;
import skins;
import values;
import custom-blocks;
import achievements;
import modules;
import sub-servers;
import content;
import merchant;
import friends;
import teleport;
export init-plugin: func();
export on-load: func(context: context) -> result<_, string>;
export on-unload: func(context: context) -> result<_, string>;
export metadata;
export handle-event: func(event-id: u32, server: server-instance, event: event) -> event;
export handle-command: func(command-id: u32, sender: command-sender, server: server-instance, args: consumed-args) -> result<s32, command-error>;
export handle-command-suggestion: func(handler-id: u32, sender: command-sender, server: server-instance, request: suggestion-request) -> command-suggestions;
export handle-task: func(handler-id: u32, server: server-instance);
export handle-ipc-message: func(sender: plugin-id, message: ipc-message) -> result<ipc-message, string>;
export handle-ai-goal-can-start: func(goal-id: u32, server: server-instance, entity: entity) -> bool;
export handle-ai-goal-should-continue: func(goal-id: u32, server: server-instance, entity: entity) -> bool;
export handle-ai-goal-start: func(goal-id: u32, server: server-instance, entity: entity);
export handle-ai-goal-tick: func(goal-id: u32, server: server-instance, entity: entity);
export handle-ai-goal-stop: func(goal-id: u32, server: server-instance, entity: entity);
export handle-generate-phase: func(generator-id: u32, phase: generation-phase, chunk: chunk-buffer);

World extended-plugin

text
include plugin;
use event.{extension-event};
use server.{server as extension-server};
export handle-extension-event: func(handler-id: u32, server: extension-server, event: borrow<extension-event>);
use modules.{module-function};
export module-functions: func() -> list<module-function>;
export handle-module-call: func(caller: string, function: string, arguments: list<u8>) -> result<list<u8>, string>;

World gametest-plugin

text
include plugin;
import gametest;
export gametest-callbacks;

Bu sayfada