Private
constructorReadonly
scriptAn event that fires when a /scriptevent command is set. This provides a way for commands and other systems to trigger behavior within script.
import { system, world } from "@minecraft/server";
system.afterEvents.scriptEventReceive.subscribe((event) => {
const { id, message, sourceEntity, sourceType } = event;
console.log(id); // wiki:test
console.log(message); // Hello World
console.log(sourceEntity); // Player object
console.log(sourceType); // Entity
});
world.getPlayers().forEach((player) => {
player.runCommand("scriptevent wiki:test Hello World");
});
import { system, world } from "@minecraft/server";
system.afterEvents.scriptEventReceive.subscribe((event) => {
const { id, message, sourceType } = event;
console.log(id); // wiki:test
console.log(message); // Hello World
console.log(sourceType); // Server
});
world.getDimension("overworld").runCommand("scriptevent wiki:test Hello World");
Provides a set of events that fire within the broader scripting system within Minecraft.