#(abrar32) armor equip event.

19 messages · Page 1 of 1 (latest)

ruby valve
#

Hey im looking to create a script that disables netherite armor. however when i search meta docs
https://meta.denizenscript.com/Docs/Search/item#player equips|unequips armor|helmet|chestplate|leggings|boots

The player equip event says it triggers when a player unequips an armor not when he tries to equip it

And anyway it also works as it says

prevent_netherite_armor_equip:
  type: world
  debug: false
  events:
    on player clicks item in inventory:
    - if <context.slot_type.contains_text[ARMOR]> && <context.item.material.name.contains_text[NETHERITE]>:
      - determine cancelled
      - narrate "<red>Wearing Netherite armor is not allowed."
    on player right clicks item:
    - if <context.item.material.name.contains_text[NETHERITE]> && <context.item.material.name.contains_any_text[_HELMET|_CHESTPLATE|_LEGGINGS|_BOOTS]>:
      - determine cancelled
      - narrate "<red>You can't equip Netherite armor."
    on player inventory slot changes:
    - if <context.slot> >= 36 && <context.slot> <= 39:
      - if <context.new_item.material.name.contains_text[NETHERITE]>:
        - inventory set d:<context.old_item> slot:<context.slot> o:<player.inventory>
        - give <context.new_item> to:<player.inventory>
        - narrate "<red>Netherite armor can't be worn."

Here i can equip it but not unequip. and it duplicates maybe because it doesnt actual cancel the armor and give a new one. rather it retains the one that is supposed to be canceled and still gives another one

brittle birchBOT
#

(abrar32) armor equip event.

brittle birchBOT
#

Hi I'm AutoThreadBot! Don't mind me, I'll just be adding the helper team to this thread so they can see it. A human will get to you soon.

spare flare
#

!e player equips

errant elkBOT
# spare flare !e player equips
Required Plugins or Platforms

Paper

Group

Paper

**WARNING**

This event is not reliable, and may miss some types of equipment changes or fire when equipment hasn't actually changed.

Event Lines

player equips|unequips armor|helmet|chestplate|leggings|boots player equips|unequips <item>

Triggers

when a player (un)equips armor.

Has Player

Always. - this adds switches flagged:<flag name> + permission:<node>, in addition to the <player> link.

Context

<context.new_item> returns the ItemTag that is now in the slot.
<context.old_item> returns the ItemTag that used to be in the slot.
<context.slot> returns the name of the slot.

spare flare
#

Depends on which type you put in the event line. Equips = only when armor is equipped, unequipped = only when armor is unequipped

olive shore
#

!haste

errant elkBOT
olive shore
#

Yeah I ran into a similar problem, I don't use the equip event usually and I just use clicks item in inventory. But this is also because I need to check for additional stuff.

I'm unsure if the event is more reliable or not now, but there is multiple things that need to be covered for trying to catch equipping and unequipping items.

Examples being:

  • Right clicking with armor/helmets in your hand
  • A dispenser spitting armor onto you and you don't have any equipped
  • Inventory dragging, not clicking
  • Inventory dragging and closing the inventory which requires inventory slot changes event because mojang
#

Also, shift-clicking in the inventory opposed to just clicking.

ruby valve
#

Cause the equip armor looks unreliable

olive shore
#

I don't have a samplescript for clicks item in inventoty no. I only have my own which uses custom procedures, and custom events.

#

I still haven't even checked for shift clicking because I neglected it.

burnt oracleBOT
#
Thread Closing Reminder

Has your issue been resolved, or your question been answered?
If so, please use the </resolved:1028673926114594866> command to close your thread.
Or </invalid:1028673926898909185> if it's not possible to resolve.

If not yet resolved, please reply below to tell us what you still need.

(Note that if there is no reply for a few days, this thread will eventually close itself.)

#

@ruby valve