Plugin: Stuck

Let’s look at a plugin that will encase a player in solid rock (the full plugin is in code/Stuck). When you issue the command stuck with a player’s name, that player will suddenly be encased in a pile of blocks. (If you’re alone on the server, your player name might be the wonderfully descriptive name “player.”)

We’ll start by looking at pieces of this plugin, and then put it all together.

All the interesting parts are in a separate helper function named stuck. The main part of the plugin should look pretty familiar by now:

Stuck/src/stuck/Stuck.java
 
package​ stuck;
 
 
import​ net.canarymod.plugin.Plugin;
 
import​ net.canarymod.logger.Logman;
 
import​ net.canarymod.Canary;
 
import​ net.canarymod.commandsys.*;
 
import ...

Get Learn to Program with Minecraft Plugins, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.