Leaf Essentials Wiki
  • Discord
  • Contribute
  • MCBETools
  • Github
  • Home
  • Installation
  • More Projects
  • More Resources
  • Server List
Chat
  • Channels
  • Ranks Configuration
    • Legacy Ranks
      deprecated
    • Managing Ranks
  • Chat Widgets
    • Introduction to Chat Widgets
  • Chat Rank Formats
    • Introduction to Chat Formats
Customizer
  • Basics
    • Creating UIs
    • About Buttons
    • Formatting
  • Advanced
    • /leaf:render_as
      advanced
    • How to Use conditions
      advanced
    • How to Use invites
      advanced
  • Miscellaneous
    • Button Meta
      info
  • Essentials
    • Opening builtin Leaf UIs
  • Extensions
    • Button Meta Hooks
FAQ
  • FAQ - General
  • Leaf Not Working on Realms
  • Plant Kitty
Misc Features
  • World Utilities
    • Binds
    • Block Property Editor
    • Entity Property Editor
    • Zones (Old Docs)
Moderation Hub
  • Bans
Script API
  • Basics
    • Hooks
Slash Commands
  • Utilities
    • /trigger & /on
    • Inventory Saving
    • Leaf Tell
    • Persistent Points
    • Server Transferring
    • Teams
    • Weighted RNG
    • World Tags
Zones
  • Zones - Basics
  • Zones - Triggers

Hooks

Hooks
Basic Hook Example
js
let ticks = 0;
let seconds = 0;
let tickHook = hook("tick", ()=>{
    ticks++;
    if(ticks % 20 == 0) {
        seconds++;
        mc.world.sendMessage("Hello, world!")
        if(seconds >= 5) {
            unhook(tickHook)
        }
    }
})
1
2
3
4
5
6
7
8
9
10
11
12

Contributors

Edit Hooks on GitHub