import {world} from '@minecraft/server';
import {skillRequirements} from '../config.js';
import {cancelEvent} from '../utils.js';

world.beforeEvents.itemUse.subscribe((e) => {
	const {itemStack,source: player} = e;
	if (!itemStack) return;
	const typeId = itemStack.typeId;
	const item = skillRequirements['items'][typeId];
	if (!item) return;
	cancelEvent(item, player, e);
});
