Book Image

Building Minecraft Server Modifications - Second Edition

By : Cody M. Sommer
4 (1)
Book Image

Building Minecraft Server Modifications - Second Edition

4 (1)
By: Cody M. Sommer

Overview of this book

Minecraft is a sandbox game that allows you to play it in any way you want. Coupled with a multiplayer server powered by Spigot, you can customize the game even more! Using the Bukkit API, anyone interested in learning how to program can control their Minecraft world by developing server plugins. This book is a great introduction to software development through the wonderful world of Minecraft. We start by instructing you through how to set up your home PC for Minecraft server development. This includes an IDE complete with the required libraries as well as a Spigot server to test on. You will be guided through writing code for several different plugins. Each chapter teaches you new skills to create plugins of increasing complexity, and each plugin adds a new concept of the Bukkit API By the end of the book, you will have all the knowledge you need about the API to successfully create any type of plugin. You can then practice and build your Java skills through developing more mods for their server.
Table of Contents (17 chapters)
Building Minecraft Server Modifications Second Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

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 forward to doing 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 that can be run on the server. It starts with the basic features of a Bukkit plugin, such as commands and permissions, and continues towards advanced concepts, such and saving and loading data. This book will help readers create a complete Bukkit plugin, irrespective of whether they are new to Java or just new to Bukkit. The advanced topics cover portions of the Bukkit API that could even aid the current plugin developers in expanding their knowledge in order to improve their existing plugins.

What this book covers

Chapter 1, Deploying a Spigot Server, instructs readers how to download and set up a Minecraft server that runs on Spigot, which includes the forwarding of 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 by 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 readers through installing an IDE and creating a simple "Hello World" Bukkit plugin.

Chapter 4, Testing on the Spigot Server, discusses how to install a plugin on a Spigot server as well as simple testing and the debugging of 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 in a plugin by modifying Enchanter. This chapter also guides readers through installing a third-party plugin called CodsPerms.

Chapter 7, The Bukkit Event System, teaches how to create complex mods that use event listeners. This chapter also helps readers learn by creating two new plugins, namely NoRain and MobEnhancer.

Chapter 8, Making Your Plugin Configurable, teaches readers program configuration by expanding MobEnhancer. This chapter also explains static variables and communication between classes.

Chapter 9, Saving Your Data, talks about how to save and load program data through the YAML file configuration. This chapter also helps create a new plugin called Warper.

Chapter 10, The Bukkit Scheduler, explores 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 benefit 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 https://minecraft.net/. The other software that is used in this book includes the Spigot 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 on a Windows PC.

Who this book is for

This book is great for anyone who is interested in customizing their Minecraft server. Even if you may be new to programming, Java, Bukkit, or even Minecraft itself, this book has you covered. All that you need is a valid Minecraft account. This book is a great introduction to software development. If you have no prior knowledge of Java or writing software, you can visit http://codisimus.com/learnjava for some introductory teaching to prepare yourself for working through the chapters of this book. If you are interested in programming as a career or hobby, this book will get you started. If you are simply interested in playing Minecraft with your friends, then this book will help you make that experience even more enjoyable.

Conventions

In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.

Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "<java bin path> should be replaced with the location of the Java installation. The java path depends on the version of Java that you have on your computer."

A block of code is set as follows:

"<java bin path>\java.exe" -jar BuildTools.jar

Any command-line input or output is written as follows:

>op <player>

New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: "Open the File menu and click on New Project...."

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 disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of.

To send us general feedback, simply e-mail , and mention the book's title in 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 at 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.

Downloading the example code

You can download the example code files from your account at http://www.packtpub.com for all the Packt Publishing books you have purchased. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

Downloading the color images of this book

We also provide you with a PDF file that has color images of the screenshots/diagrams used in this book. The color images will help you better understand the changes in the output. You can download this file from https://www.packtpub.com/sites/default/files/downloads/BuildingMinecraftServerModificationsServerSecondEdition_ColorImages.pdf.

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 could 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 to our website or added to any list of existing errata under the Errata section of that title.

To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.

Piracy

Piracy of copyrighted 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 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

If you have a problem with any aspect of this book, you can contact us at , and we will do our best to address the problem.