ItemEvents.rightClicked(event => {
    const { player, level, server, item } = event;
    if (!player || !level || !server || level.isClientSide()) return;

    if (String(item.id) === 'securitycraft:camera_monitor') {
        // 15% chance to blow back
        if (Math.random() < 0.15) {
            let username = player.username.getString();
            
            server.runCommandSilent(`effect give ${username} minecraft:blindness 2 0 true`);
            server.runCommandSilent(`damage ${username} 3.0 minecraft:magic`);
            server.runCommandSilent(`playsound minecraft:block.conduit.deactivate ambient ${username} ~ ~ ~ 2.0 0.4`);
            
            player.displayClientMessage(Component.red("MONITOR SHORT-CIRCUIT: TERMINAL HARDWARE VOLTAGE FAULT"), true);
        }
    }
});