Java Reference
In-Depth Information
Let's dig in and design a new plugin. I'm going to go through these steps on
my new plugin, and you'll do the same thing for your new plugin alongside
of me. Yours should do something different. And it's okay if this takes a while;
this isn't the sort of chapter you'll whip through in one evening.
Have an Idea
Before you start, you need some idea of what you want to write. It may not
be a great idea or a perfect idea yet, and that's okay. This is soft ware, after
all, and you're allowed to change your mind. But we need to start somewhere.
So I think I'd like to figure out how to randomly generate “creeper cows”—that
is, cows that jump around and try to attack you, and that explode when they
jump on you. That might be fun.
At this point, I have no idea how to even start such a thing.
Try This Yourself
What is your idea? Jot it down now. If you're stuck, take a look at plugins
other people have written, or just browse the Canary documentation and see
if something inspires you.
Gather Your Materials
Armed with an idea, you now “gather your materials.” If you were building a
craft project, you'd gather all the raw materials (glue, wood, paper, googly
eyes, plutonium) and tools (scissors, hammer, arc welder, cooling tower—what-
ever). We need to do the same. But what materials do we need?
Well, we need a first guess at what sort of data we'll require in the plugin,
how to keep track of it, and what makes the plugin run—is it run from a
command, or an event, or a timer? Here are some good questions to ask:
•What do you need to keep track of?
•How long do you need to keep it? (during a command, while the server is
running, across server reboots on disk…)
•What are the triggers? (user-entered command, in-game event, internal
state, timer, combination…)
•What parts of the game do you need to affect (blocks, players, potions,
inventory, and so on) and what Canary or Java functions will you need
to use for them?
•What can go wrong?
 
 
Search WWH ::




Custom Search