Events

This section describes the events that can be hooked through Context.Events.

Events

onTick

onChat

onDisconnected

onGameJoined

onSpawned

onWorldReload

onHealthUpdate

onDeath

onStartedStarving

onBlockChanged

onChunkLoaded

onPlayerMoved

onInventoryChanged

onSprintingChanged

onExplosion

onEntityEffectAdded

onObjectSpawned

onEntityVelocity

onPlayerUpdate

onExperienceChanged

onResourcePackReceived

onEntityAttached

Usage

You will generally be Registering tasks in the Start method of the task class. You will also generally want to unregister them in Stop method, otherwise the plugin may not stop execution.

Events

onTick

Called each client tick, which is around 50ms. ITickListener uses this.

onChat

Called when the bot receives a chat message from the server. This also includes middle of the screen titles and above the hotbar messages. The type of message (chat, screen, above hotbar) can be determined by the position variable.

onDisconnected

Called once the bot is disconnected from the server.

onGameJoined

Called once the player joins the game. It is important to note that this will most likely run only if the plugin is enabled before the bot is started.

onSpawned

Called once the player spawns into the game. This usually signifies that the bot's entity has been spawned by the server and is visible by other players.

onHealthUpdate

Called once the bot's health or hunger is updated by the server. It is important to note that this is also for hunger changes as well, while the name suggest that it's only for health updates.

onDeath

Called when the bot's health drops to 0, which signifies that it has died.

onStartedStarving

Called when the bot starts starving, which is when it reaches 0 food.

onBlockChange

Called once a block in the world changes.

onChunkLoaded

Called once a chunk is loaded/reloaded.

onPlayerMoved

Called once this bot is moved by the server. This will not be triggered when the bot moves it self.

onInventoryChanged

Called once an slot gets set or updated. This will also usually trigger when a new container is opened, as the server updates each slot of the container window.

onSprintChanged

Called once the bot's sprint state gets updated.

onWorldReload

Called once the world is fully reloaded, which is generally when respawning or teleporting.

onEntityAttached

Called when the server sends an entity attached packet (e.g.: player sits in a minecart). Note: This is only supported for 1.8.*

OnResourcePackReceived

Called when the server sends a resource pack URL and hash to the client.

onExperienceChanged

Called when the server updates the bot's experience

onPlayerUpdate

Called before the player update, allows you to cancel all physics.

onEntityVelocity

Called once the server set's an entities velocity,

onObjectSpawned

Called once an object spawns.

onEntityEffectAdded

Called once an Entity receives an effect.

onExplosion

Called once an explosion occurs.

Last updated