With this chapter you'll add these abilities to your toolbox:
• Modify blocks in the world
• Modify and spawn new entities
• Listen for and react to game events
• Manage plugin permissions
This is exciting! Now you have most of the basic tools you need; you
can alter the world and react to in-game events.
Modify, Spawn, and Listen in Minecraft
Now we're going to go beyond issuing simple commands and dropping squid
bombs, and look at a wider range of things you can do in Minecraft. By the
end of this chapter, you'll be able to affect behavior in the game without
having to issue any commands at all.
All you have to do is listen—you'll see how, by learning about Minecraft events.
We'll listen for events, act on them, and even schedule our own events to fire
sometime in the future.
From your plugin code, you can change existing blocks and entities, and you
can spawn new ones. We'll look at exactly how to do that:
•Modify existing blocks: change things like location, properties, and
•Modify existing entities: change properties on a Player
•Spawn new entities and blocks
We've done some of this already—we've changed a Player 's location, and we've
spawned more than a few Squid s. Let's take a closer look at what else you can
do with the basic elements in the Minecraft world, and then we'll see how you
can react to in-game events to affect those elements and create new ones.
The basic recipe for a block object in Minecraft is listed in the Canary docu-
mentation under net.canarymod.api.world.blocks.Block . 1
There are many interesting functions in a Block , and we won't cover them all,
but here are a few of the most useful and interesting things you can do to a