ItemsCore
  • ⚔️ItemsCore
  • ⚖️Free VS Premium
  • How to use
    • 👋Introduction
    • 📝Use the item editor
      • 🎀Simple Customization
      • 📇Click Type & Skull Owner
      • 🥊Custom model data
      • 💣Actions
    • The code
      • ❗Create abilities
      • 🎉Events
      • 🎣Hooks
    • 🔌Supported Plugins
  • The API
    • 👋Introduction
    • 📤Placeholders
Powered by GitBook
On this page
  1. How to use
  2. The code

Events

How to create events

Those are the current events on the plugin:

DamageEvent:
  Special variables:
    attacker -> Player who attacked
    victim -> Entity that got damaged
    cause -> DamageCause of the event
    event -> The event itself (you can do core.cancelEvent(event) to cancel it like it never happened)
    damage -> The amount of damage dealt item -> Item used to damage
    item -> Item used to attack
  Usage:
    item.setDamageEvent(core.createRunnable("<code>"))
DamageEvent:
  Special variables:
    attacker -> Player who attacked
    victim -> Entity that got damaged
    cause -> DamageCause of the event
    event -> The event itself (you can do core.cancelEvent(event) to cancel it like it never happened)
    damage -> The amount of damage dealt item -> Item used to damage
    item -> Item used to attack
  Usage:
    item.setDamageEvent(core.createRunnable("<code>"))

ProjectileHitEntityEvent (Called when the projectile from core.shootProjectile() hits an entity):
  Special variables:
    shooter -> Player that shot the projectile
    victim -> Entity that got hit
    lastLocation -> Last location of the projectile (Entity location for this event)
    event -> The event itself (you can do core.cancelEvent(event) to cancel it like it never happened)
    item -> Item used to shoot
  Usage:
    item.setParticleHitEvent(core.createRunnable("<code>"))
  
ProjectileHitBlockEvent (Called when the projectile from core.shootProjectile() hits a block):
  Special variables:
    shooter -> Player that shot the projectile
    lastLocation -> The last location of the projectile before he got destroyed
    event -> The event itself (you can do core.cancelEvent(event) to cancel it like it never happened)
    item -> Item used to shoot
  Usage:
    item.setParticleHitEvent(core.createRunnable("<code>"))

ArmorEquipEvent (Called when the player equips an armor piece)
  Special variables:
    player -> Player who equipped the armor
    item -> Equipped item
    event -> The event itself (you can do core.cancelEvent(event) to cancel it like it never happened)
  Usage:
    item.setArmorEquipEvent(core.createRunnable("<code>"))

ArmorUnEquipEvent (Called when the player un-equips an armor piece)
  Special variables:
    player -> Player who un-equipped the armor
    item -> Un-Equipped item
    event -> The event itself (you can do core.cancelEvent(event) to cancel it like it never happened)
  Usage:
    item.setArmorUnEquipEvent(core.createRunnable("<code>"))

PlayerMoveEvent (Called when the player moves while holding the item or when equipped as his armor)
  Special Variables:
    player -> The player who moved
    item -> Held item / Equipped item
    event -> The event itself (you can do core.cancelEvent(event) to cancel it like it never happened)
  Usage:
    item.setPlayerMoveEvent(core.createRunnable("<code>"))

PlayerDamageEvent (Called when the player gets damaged, called for the item the player holds and for each armor piece he has equipped)
  Special Variables:
      player-> The player that got damaged
      item -> The item the player has (held item & armor pieces)
      cause -> The damage cause
      causeName -> The name of the damage cause (just cause.getName() used for the ingame editor)
      damage -> The amount of damage taken
      event -> The event itself (you can do core.cancelEvent(event) to cancel it like it never happened)
    Usage:
      item.setPlayerDamageEvent(core.createRunnable("<code>"))
PreviousCreate abilitiesNextHooks

Last updated 1 month ago

🎉