Leaf Essentials Wiki
  • Discord
  • Contribute
  • MCBETools
  • Github
  • Home
  • Installation
  • More Projects
  • More Resources
  • Server List
Chat
  • 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
  • Leaf Not Working on Realms
  • Plant Kitty
Misc Features
  • World Utilities
    • Binds
    • Block Property Editor
    • Entity Property Editor
    • Zones
Moderation Hub
  • Bans
Script API
  • Basics
    • Hooks

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