Book Image

Building Minecraft Server Modifications

By : Cody M. Sommer
Book Image

Building Minecraft Server Modifications

By: Cody M. Sommer

Overview of this book

If you have ever played Minecraft on a public server then the chances are that the server was powered by Bukkit. Bukkit plugins allow a server to be modified in more ways than you can imagine. Learning to program your own server mods will allow you to customize the game to your own liking. Building Minecraft Server Modifications is a complete guide that walks you through the creation of Minecraft server mods. From setting up a server, to testing your newly made plugins, this book teaches you everything you need to know. With the help of this book you can start practising for a career in software development or simply create something awesome to play with your friends. This book walks you through installing your own Minecraft server for you and your friends. Once your server is running, it will aid you in modifying the game by programming Bukkit plugins. You will learn how to program simple plugin features such as player commands and permissions. You will also learn more complex features including listening for events, creating a configurable plugin, and utilizing the Bukkit scheduler. All of this will be accomplished while writing your own server mods. You will become familiar with the most important aspects of the Bukkit API. Additional API features will become a breeze to learn after tackling these more complicated tasks.
Table of Contents (17 chapters)
Building Minecraft Server Modifications
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Setup


You will see the server folder populated with several files and folders. I will go over a few of them now, as shown in the following list, but most of these files will not concern you at this time:

  • The plugins folder: This folder is where you will place all of the Bukkit plugins that you wish to use on your server.

  • The folders that begin with world (world, world_nether, and so on): These folders have been created that include all of the information for the new world of your server. If you already have a Minecraft world that you wish to use, then replace these new folders with your old world folders. Do not attempt to do this while the server is running, as it will cause problems.

  • server.properties: This file holds several options which allow changing how a Minecraft server operates. You can open it with any text editor. There are many settings and most of them are pretty self explanatory. I will go over a few settings in the following list that you may want to modify. For a full list of property explanations, you can visit www.minecraftwiki.net/wiki/Server.properties.

    • pvp=true: The pvp property can be set to a boolean value. PvP stands for player vs. player and sets whether players can attack and harm each other. You will want to set this to true or false depending on whether you want PvP to be on or off, respectively.

    • difficulty=1: The difficulty property can be set to a number 0 to 3. 0 means Peaceful, 1 means Easy, 2 means Normal, and 3 means Hard. Everyone on the server will be playing at this difficulty.

    • gamemode=0: This property determines which game mode players will start in. 0 means Survival, 1 means Creative, and 2 means Adventure.

    • motd=A Minecraft Server: motd stands for Message of the day. This message will be displayed when viewing your server in the Minecraft multiplayer server list as shown in the following screenshot:

    • It is a good idea to set this to a short description of your server, for example, Bukkit plugin testing.

    • online-mode=true: This can be set to false to allow players to connect to the server while in offline mode. This can be useful if http://minecraft.net/ is unavailable or your computer is not connected to the Internet. Running your server in offline mode can cause security issues, such as other players logging in to your account.

  • bukkit.yml: This file contains many more server options. These are the options that a vanilla server does not offer and are only available through running a CraftBukkit server. You will notice that this file is a YMAL (.yml) file rather than a PROPERTIES (.properties) file. When you open it, you will see how the two file types are formatted differently. The first difference that you will notice is that certain lines are indented. You do not need to fully understand the YMAL formatting, as it will be explained further as we progress through making the Bukkit plugins. There are a few settings in this file that I will bring to your attention, as shown in the following list. For a full list of these Bukkit settings you can visit wiki.bukkit.org/Bukkit.yml:

    • allow-end: true: A vanilla Minecraft server allows you to disable the nether world from functioning. A Bukkit server allows you to disable the end world as well. Set this to false to prevent players from traveling to the end.

    • use-exact-login-location: false: Vanilla Minecraft contains a feature that will prevent players from spawning inside a block. The player will instead be spawned above the block, so they will not suffocate and die. This can easily be exploited to be able to climb onto blocks that a player could normally not reach. Bukkit can prevent this from occurring by spawning the player exactly where they logged out. Set this property to true if you wish to prevent this exploit.

    • spawn-limits: Bukkit allows a server admin to modify how many monsters and animals are allowed to spawn within any given chunk. If you are unfamiliar with the term chunk, it is a group of 16 x 16 blocks from bedrock to the highest point of the sky. The following is a picture of a single chunk in Minecraft:

      If you feel that there are too many (or too few) mobs, then you will want to adjust these values accordingly.

    • ticks-per: autosave: 0: Unlike vanilla Minecraft, a Bukkit server will not periodically save your player/world data. Automatically saving may prevent the server from losing any changes that were made within the game if it were to crash or shut down for any reason (such as the computer losing power). Vanilla defaults this setting to 6000. There are 20 ticks every second. We can determine how long 6000 ticks is with the following math: 6000 ticks / 20 ticks/second = 300 seconds and 300 seconds / 60 seconds/minute = 5 minutes. From the previous calculation you should be able to calculate an appropriate time period that you wish your server to autosave. If your server lags whenever it saves, then you may want to increase this number. A setting of 72000 would only cause lag once every hour; however, if the server crashes right before it saves, then you may lose any progress you have made in the past hour.