import { world } from "mojang-minecraft";

world.events.beforeChat.subscribe((eventData) => {
    var player_name = eventData.sender.name
    var player = eventData.sender
    var args = eventData.message.split(" ")
    if (args[0].charAt(0) == "!") {
        eventData.cancel = true
        if (args[0] == "!reload") {
            player.runCommand("function reload");
        } else {
            player.runCommand("tellraw @s {\"rawtext\":[{\"text\":\"§lНеизвестная команда\"}]}");
        }
    }
});