Preface
This book is an introduction to programming Minecraft server plugins with the Bukkit API. Minecraft is a very versatile sandbox game, and players are always looking to do more with it. Bukkit allows programmers to do just that. This book is geared towards individuals who may not have a programming background. It explains how to set up a Bukkit server and create your own custom plugins to run on that server. It starts with the basic features of a Bukkit plugin such as commands and permissions but continues to more advanced concepts such and saving and loading data. This book will help readers create a complete Bukkit plugin whether they are new to Java or just new to Bukkit. The more advanced topics even cover portions of the Bukkit API that could aid current plugin developers in expanding their plugins.
What this book covers
Chapter 1, Deploying a CraftBukkit Server, instructs readers on how to set up a Minecraft server running CraftBukkit, including forwarding ports to allow other players to connect. In this chapter common server settings and commands are explained as well.
Chapter 2, Learning the Bukkit API, introduces Bukkit through teaching how to read its API documentation. In this chapter, common Java data types and Bukkit classes are discussed.
Chapter 3, Creating Your First Bukkit Plugin, guides the reader through installing an IDE and creating a simple "Hello World" Bukkit plugin.
Chapter 4, Testing on the CraftBukkit Server, informs of how to install a plugin onto a CraftBukkit server as well as simple testing techniques.
Chapter 5, Plugin Commands, instructs how to program user commands into a server plugin by creating a plugin called Enchanter.
Chapter 6, Player Permissions, teaches how to program permission checks within a mod by modifying Enchanter. This chapter also guides the reader through installing a third party plugin called PermissionsBukkit.
Chapter 7, The Bukkit Event System, teaches how to create more complex mods that use event listeners. This chapter also helps the reader to learn by creating two new plugins, NoRain, and MobEnhancer.
Chapter 8, Making Your Plugin Configurable, teaches the reader program configuration by expanding MobEnhancer. This chapter also explains static variables and communication between classes.
Chapter 9, Saving Your Data, informs the reader on how to save and load their program data through YAML file configuration. This chapter also helps to create a new plugin called Warper.
Chapter 10, The Bukkit Scheduler, teaches the Bukkit Scheduler while creating a new plugin called AlwaysDay. In this chapter Warper is also modified to incorporate scheduled programming.
What you need for this book
In order to receive the full experience from this book you will need a Minecraft account. The Minecraft game client can be downloaded for free but an account must be bought at minecraft.net. Other software that is used includes the CraftBukkit server jar (this is different from the normal Minecraft server jar) and an IDE, such as Netbeans or Eclipse. This book will walk you through the process of downloading and installing both the server and the IDE.
Who this book is for
This book is for the average Minecraft player who wishes to get more out of their game. Anyone who has set up a Minecraft server has most likely heard of CraftBukkit. CraftBukkit, along with its plugins, powers the majority of Minecraft servers that operate around the world. Whether you are already a plugin developer or are new to programming, this book can help you to create cool and unique plugins for your server.
Conventions
In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.
Code words in text are shown as follows: "We can include other contexts through the use of the include
directive."
A block of code is set as follows:
[default] exten => s,1,Dial(Zap/1|30) exten => s,2,Voicemail(u100) exten => s,102,Voicemail(b100) exten => i,1,Voicemail(s0)
When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:
[default]
exten => s,1,Dial(Zap/1|30)
exten => s,2,Voicemail(u100)
exten => s,102,Voicemail(b100)
exten => i,1,Voicemail(s0)
Any command-line input or output is written as follows:
# cp /usr/src/asterisk-addons/configs/cdr_mysql.conf.sample /etc/asterisk/cdr_mysql.conf
New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "clicking the Next button moves you to the next screen".
Note
Warnings or important notes appear in a box like this.
Tip
Tips and tricks appear like this.
Reader feedback
Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.
To send us general feedback, simply send an e-mail to <feedback@packtpub.com>
, and mention the book title via the subject of your message.
If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.
Customer support
Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.
Errata
Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.
Piracy
Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.
Please contact us at <copyright@packtpub.com>
with a link to the suspected pirated material.
We appreciate your help in protecting our authors, and our ability to bring you valuable content.
Questions
You can contact us at <questions@packtpub.com>
if you are having a problem with any aspect of the book, and we will do our best to address it.