Java Reference
In-Depth Information
Once you have your list together, it's time to start writing some code—but
not all at once, as we'll see in the next section.
Try Each Part
We're going to start coding now, but as exciting as that is, we want to go
slowly. Whether you're following along with me here or working on your own
plugin, remember to take one small step at a time—don't rush it.
Let's begin by creating a new directory and the usual files that every plugin
needs. Once again we'll use the script to get started. Don't forget,
you'll be making your own plugin under desktop; my version is under Desk-
top/code .
~/Desktop$ ./ CreeperCow
~/Desktop$ cd CreeperCow
~/Desktop/CreeperCow$ ls -a
And we'll start right away by using Git to track our work (check back with
Chapter 12, Keep Your Code Safe , on page 169 , for a refresher if you need to).
The script thoughtfully made us a .gitignore that will ignore the bin/
and dist/ directories. So we'll add our first couple of files and commit them as
a baseline:
~/Desktop/CreeperCow$ git init
Initialized empty Git repository in /Users/andy/Desktop/CreeperCow/.git/
~/Desktop/CreeperCow$ git add .gitignore Canary.inf Manifest.txt src
~/Desktop/CreeperCow$ git commit -a -m First
[master (root-commit) 2e483f1] First
5 files changed, 95 insertions(+)
create mode 100644 .gitignore
create mode 100755
create mode 100644 Canary.inf
create mode 100644 Manifest.txt
create mode 100644 src/creepercow/
(If you are hooked up to a remote repository, you can do a gitpush now as well.)
Now on to the code.
We know that we need to create a static cowList and a spawnCows() method, and
we'll need to listen for some events, so let's start with that in .
Here's the interesting part (omitting other imports and the usual other stuff):
Search WWH ::

Custom Search