Building Minecraft Server Modifications - Second Edition

Book description

Create and customize your very own Minecraft server using Java and the Spigot API

About This Book

  • Set up a Minecraft server that you control
  • Use object-oriented programming to modify Minecraft regardless of your level of experience
  • This interactive guide will help you create a unique experience for you and your friends

Who This Book Is For

This book is great for anyone who is interested in customizing their Minecraft server. Whether you are new to programming, Java, Bukkit, or even Minecraft itself, this book has you covered. All you need is a valid Minecraft account. 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.

What You Will Learn

  • Install and run a Spigot server for free on your home PC
  • Adjust the server settings to customize Minecraft to your liking
  • Install an IDE and configure a project to write code
  • Install and test plugins on a Spigot server
  • Test your plugins through debugging the code
  • Program in game commands and permissions
  • Get to know advanced programming concepts such as event-driven programming, configuration files, saving/loading data, and scheduled tasks
  • Implement configuration files to make your plugins customizable
  • Save and load your plugin's data to persist across server restarts

In Detail

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.

Style and approach

This hands-on guide is filled with interactive examples to help you modify Minecraft. Programming terms and concepts are explained along the way so even those who have never written code before can keep up.

Publisher resources

Download Example Code

Table of contents

  1. Building Minecraft Server Modifications Second Edition
    1. Table of Contents
    2. Building Minecraft Server Modifications Second Edition
    3. Credits
    4. About the Author
    5. About the Reviewers
      1. Support files, eBooks, discount offers, and more
        1. Why subscribe?
        2. Free access for Packt account holders
    7. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Conventions
      5. Reader feedback
      6. Customer support
        1. Downloading the example code
        2. Downloading the color images of this book
        3. Errata
        4. Piracy
        5. Questions
    8. 1. Deploying a Spigot Server
      1. Introduction to Spigot
      2. Installing a new Spigot server
      3. Setting up a new server
      4. Minecraft/Bukkit server commands
      5. Port forwarding
      6. Summary
    9. 2. Learning the Bukkit API
      1. Introduction to APIs
      2. The Bukkit API documentation
      3. Navigating through the Bukkit API documentation
      4. Understanding the Java documentation
      5. Exploring the Bukkit API
      6. Summary
    10. 3. Creating Your First Bukkit Plugin
      1. Installing an IDE
      2. Creating a new project
      3. Adding Bukkit as a library
      4. The essentials of a Bukkit plugin
        1. The plugin.yml file
        2. The plugin's main class
      5. Making and calling new methods
      6. Expanding your code
      7. Summary
    11. 4. Testing on the Spigot Server
      1. Building a JAR file
      2. Installing the plugin
      3. Testing your plugin
      4. Testing new versions of the plugin
      5. Debugging the code
        1. Learning from your mistakes
        2. When researching is not enough
          1. Reading the stack trace
        3. Breaking down the code
        4. Adding debug messages
        5. Referring back to the Javadoc
        6. Fixing the bug only after you understand it
      6. Summary
    12. 5. Plugin Commands
      1. Adding a command to plugin.yml
      2. Programming the command actions
      3. Assigning the executor for the enchant command
      4. Summary
    13. 6. Player Permissions
      1. The benefits of permissions
      2. Understanding permission nodes
      3. Adding a permission node to plugin.yml
      4. Assigning a permission node to a plugin command
      5. Testing player permissions
      6. Using a third-party permissions plugin
      7. Using permission nodes throughout your plugins
      8. Summary
    14. 7. The Bukkit Event System
      1. Choosing an event
      2. Registering an event listener
      3. Listening for an event
      4. Canceling an event
      5. Communicating among events
      6. Modifying an event as it occurs
      7. Creating more plugins on your own
      8. Summary
    15. 8. Making Your Plugin Configurable
      1. Configurable data types
      2. Writing a config.yml file
      3. Saving, loading, and reloading the config file
      4. Reading and storing the configured values
      5. Using configured settings within your plugin
      6. ItemStack within a configuration
      7. YAML configuration hierarchy
      8. Storing configuration values as variables
      9. Accessing variables from another class
      10. Summary
    16. 9. Saving Your Data
      1. Types of data that can be saved
      2. Which data to save and when
      3. A sample teleportation plugin
      4. Writing a ConfigurationSerializable class
      5. Saving data to a YAML configuration
      6. Loading data from a YAML configuration
      7. Summary
    17. 10. The Bukkit Scheduler
      1. Creating a BukkitRunnable class
      2. Synchronous versus asynchronous tasks
        1. Running a task from a BukkitRunnable class
        2. Running a task later from a BukkitRunnable class
        3. Running a task timer from a BukkitRunnable class
      3. Writing a repeating task for a plugin
      4. Adding a delayed task to a plugin
      5. Executing code asynchronously
      6. Summary
    18. Index

Product information

  • Title: Building Minecraft Server Modifications - Second Edition
  • Author(s):
  • Release date: December 2015
  • Publisher(s): Packt Publishing
  • ISBN: 9781785883026