#Drop Unallowed Items

3 messages · Page 1 of 1 (latest)

bleak timber
#

I'm working with item stages and I want to automatically drop an item when a player isn't allowed to have it yet. I have no issue identifying when the player has picked up the item they are supposed to not have in their hotbar, but for some reason I can't remove it from their inventory? My current script just drops a duplicate item which isn't what I'm wanting.

onEvent('player.inventory.changed', (event => {
        if (event.slot <= 35) return;
        if (! event.player.stages.has('stage') && unallowed_stuff.includes(event.item.id)) {
            event.player.tell(Text.red('You dropped the item'))
            event.player.minecraftPlayer.drop(event.item)
            event.player.inventory.extract(event.slot)
        }
    }));
quartz sequoiaBOT
#

Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!