The UseItemStartEvent class is fired when a Mob or Player starts using an Item. Setting the duration to zero or less cancels this event.
Prevent those nasty skeletons from shooting you.
Events.on('UseItemStartEvent'):call(function(event)
if event.entity.name == 'Skeleton' then
event.canceled = true
end
end)
The UseItemStartEvent class is a subtype of the UseItemEvent class and inherits all its properties and functions.