Play Strawberry Docs
Referencia

Esta página se muestra en inglés.

command

Commands, argument types, suggestions, senders and sensitive commands.

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

How to use it: guide.

WIT declarations

text
use %world.{%world, entity};
use player.{player};
use block-entity.{command-block-entity};
use common.{position, block-pos, locale, game-mode};
use item-stack.{item-stack};
use text.{text-component};
use server.{server, difficulty};

variant command-error {
    invalid-consumption(option<string>),
    invalid-requirement,
    permission-denied,
    command-failed(text-component),
}

resource command-node {
    literal: static func(name: string) -> command-node;
    argument: static func(name: string, %type: argument-type) -> command-node;
    then: func(node: command-node);
    execute-with-handler-id: func(handler-id: u32);
    suggest-with-handler-id: func(handler-id: u32);
    require-with-handler-id: func(handler-id: u32);
    require-permission: func(permission: string);
}

record suggestion-request {
    input: string,
    cursor: u32,
    start: u32,
    remaining: string,
}

record command-suggestion {
    value: string,
    tooltip: option<text-component>,
}

record command-suggestions {
    start: u32,
    length: u32,
    values: list<command-suggestion>,
}

variant argument-type {
    %bool,
    float(tuple<option<f32>, option<f32>>),
    double(tuple<option<f64>, option<f64>>),
    integer(tuple<option<s32>, option<s32>>),
    long(tuple<option<s64>, option<s64>>),
    %string(string-type),
    entities,
    entity,
    players,
    game-profile,
    block-pos,
    column-pos,
    position3d,
    position2d,
    block-state,
    block-predicate,
    item,
    item-predicate,
    color,
    component,
    style,
    message,
    nbt-compound-tag,
    nbt-tag,
    nbt-path,
    objective,
    objective-criteria,
    operation,
    particle,
    angle,
    rotation,
    scoreboard-slot,
    score-holder(bool),
    swizzle,
    team,
    item-slot,
    resource-location,
    mob-effect,
    function,
    entity-anchor,
    int-range,
    float-range,
    dimension,
    gamemode,
    difficulty,
    time(option<s32>),
    %resource(string),
    resource-or-tag(string),
    resource-or-tag-key(string),
    resource-key(string),
    template-mirror,
    template-rotation,
    uuid,
}

record entity-argument {
    single: bool,
    players-only: bool,
}

variant command-sender-type {
    rcon,
    console,
    player(player),
    command-block(tuple<command-block-entity, %world>),
    dummy,
}

enum permission-level {
    zero,
    one,
    two,
    three,
    four,
}

resource command-sender {
    get-command-sender-type: func() -> command-sender-type;
    get-name: func() -> string;
    send-message: func(text: text-component);
    send-system-message: func(text: text-component);
    send-error: func(text: text-component);
    set-success-count: func(count: s32);
    is-player: func() -> bool;
    is-console: func() -> bool;
    as-player: func() -> option<player>;
    as-command-minecart: func() -> option<entity>;
    permission-level: func() -> permission-level;
    has-permission-level: func(level: permission-level) -> bool;
    has-permission: func(server: borrow<server>, node: string) -> bool;
    position: func() -> option<position>;
    %world: func() -> option<%world>;
    get-locale: func() -> locale;
    should-receive-feedback: func() -> bool;
    should-track-output: func() -> bool;
    should-broadcast-console-to-ops: func() -> bool;
    dispatch-command: func(command: string) -> bool;
}

enum string-type {
    single-word,
    quotable,
    greedy,
}

enum suggestion-type {
    ask-server,
    all-recipes,
    available-sounds,
    available-biomes,
    summonable-entities,
}

variant arg {
    simple(string),
    msg(string),
    %bool(bool),
    item(string),
    item-predicate(string),
    resource-location(string),
    block(string),
    block-predicate(string),
    time(s32),
    num(result<number, not-in-bounds>),
    block-pos(block-pos),
    pos3d(tuple<f64, f64, f64>),
    pos2d(tuple<f64, f64>),
    rotation(tuple<f32, bool, f32, bool>),
    gamemode(game-mode),
    difficulty(difficulty),
    players(list<player>),
    particle(string),
    text-component(text-component),
    bossbar-color(bossbar-color),
    bossbar-style(bossbar-style),
    sound-category(sound-category),
    damage-type(string),
    effect(string),
    enchantment(string),
    advancement(string),
    entity-anchor(entity-anchor),
}

enum bossbar-color {
    pink,
    blue,
    red,
    green,
    yellow,
    purple,
    white,
}

enum bossbar-style {
    no-division,
    notches6,
    notches10,
    notches12,
    notches20,
}

enum sound-category {
    master,
    music,
    records,
    weather,
    blocks,
    hostile,
    neutral,
    players,
    ambient,
    voice,
}

enum entity-anchor {
    eyes,
    feet,
}

variant number {
    float64(f64),
    float32(f32),
    int32(s32),
    int64(s64),
}

variant not-in-bounds {
    lower-bound(tuple<number, number>),
    upper-bound(tuple<number, number>),
}

resource consumed-args {
    get-value: func(key: string) -> arg;
}

resource command {
    constructor(names: list<string>, description: string);
    then: func(node: command-node);
    execute-with-handler-id: func(handler-id: u32);
    sensitive: func();
}

En esta página