import { ScriptEventSource, system } from "@minecraft/server";
system.afterEvents.scriptEventReceive.subscribe(args => {
    if (args.id == 'debug:clear_entity') {
        let entities;
        if (args.sourceType == ScriptEventSource.Entity) {
            entities = args.sourceEntity.dimension.getEntities();
        }
        else {
            entities = args.sourceBlock.dimension.getEntities();
        }
        for (const entity of entities) {
            if (entity.typeId != 'minecraft:player') {
                entity.remove();
            }
        }
    }
    if (args.id == 'debug:guidebook_test') {
        const entity = args.sourceEntity;
        if (entity) {
            entity.runCommand('say guidebook test!');
        }
    }
}, { namespaces: ['debug'] });
