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

Minecraft/Bukkit server commands


We now have all the custom options set. Next, let's log on to the server and take a look at the in-game server commands.

To log in to your server, you will need to know the IP address of your computer. Later in this chapter, we will work through finding this essential information. However, I will assume that for now, you will be playing Minecraft on the same machine on which you are running your server. In this case, for the IP of the server, simply type localhost. Once you are connected to the server, you will see that the Spigot server is essentially the same as the vanilla server because you do not have any plugins installed yet. The first indication that the server is running Bukkit is that you will have a few extra commands at your disposal.

Bukkit inherits all the Minecraft server commands. If you have ever played on a Minecraft server, then you have probably already used some of these commands. In case you have not, I will explain some of the useful ones. These commands can be typed into the console or an in-game console. By "console", I am referring to the command prompt that is running your server. Bukkit has a built-in permissions system that limits players from using specific commands.

They cannot use a command if they do not have the necessary permissions. We will discuss this in detail in a later chapter, but for now, we will make your player an operator, or op for short. An operator automatically has all the permissions and will be able to execute all the commands that will be presented. To make yourself an operator, issue the op command to the console, as follows:

>op <player>

Replace <player> with your player name. See the highlighted command in the following screenshot for an example:

Once you have been Opped, you are ready to test some of the in-game server commands. In order to understand how to use commands properly, you must understand the command syntax. Let's look at the gamemode command as an example:

gamemode <0 | 1 | 2 | 3> [player]
  • < > indicates that it is a required argument.

  • [ ] indicates that it is an optional parameter. For this command, if the player parameter is not included, then the game mode of your own player will be set.

  • | is a known symbol for the word or. So, <0 | 1 | 2 | 3> indicates that 0, 1, 2, or 3 can be entered. They represent Survival, Creative, Adventure, and Spectator respectively.

  • Parameters must always be typed in the same order in which they are displayed. Usually, if you enter an incorrect command, a help message will appear, reminding you of how to use the command properly.

Note that when you issue an in-game command, you must start with /, but when issuing a command from the console, / must be left out. A proper use of the gamemode command will be /gamemode 1, which will set your game mode to Creative, as shown in the following screenshot:

Another example of this command is /gamemode 2 Steve, which will find the player whose username is Steve and change his game mode to Adventure.

Now that you understand the basic syntax for commands, you can learn how to use some other useful server commands from the following list. Most of these commands are also present in vanilla Minecraft. Only a few of them are specific to Bukkit servers:

  • gamerule <rule> [true | false]

    An example of this is /gamerule mobGriefing false.

    The rule parameter can be set to any of the following:

    • doMobSpawning: This determines whether mobs will naturally spawn

    • keepInventory: This determines whether players will keep their items if they die

    • mobGriefing: This determines whether mobs, such as creepers, can destroy blocks

    • doFireTick: This determines whether fire should be spread

    • doMobLoot: This determines whether mobs should drop items

    • doDaylightCycle: This determines whether the day/night cycle is in effect

  • give <player> <item> [amount [data]]

    • For example, /give Codisimus wool 3 14 gives Codisimus 3 red wool.

  • plugins (applicable only in Bukkit)

    • For example, /plugins or /pl displays a list of all the plugins that are installed on the server.

  • reload (applicable only in Bukkit)

    • For example, /reload or /rl disables all the plugins and re-enables them. This command is used to load new settings for a plugin without shutting down the entire server.

  • spawnpoint [player] [x y z]

    • For example, /spawnpoint allows you to spawn where you are standing when you die.

  • stop

    • For example, /stop saves your progress and shuts down the server. This is how you should stop the server to ensure that data is saved. You will lose data if you simply close the command prompt by clicking on X.

  • tell <player> <message>

    • For example, /tell Steve my secret base is behind the waterfall sends a message that only Steve will be able to see. Note that these messages will also be printed to the console.

  • time set <day | night>

    • For example, /time set day sets the time of the server to 0 (daytime).

  • toggledownfall

    • For example, /toggledownfall stops or starts rain/snowfall.

  • tp [player] <targetplayer>

    • For example, /tp Steve Codisimus teleports Steve to the location of Codisimus.

For more information regarding these and other commands, visit minecraft.gamepedia.com/Commands and wiki.bukkit.org/CraftBukkit_commands. The commands and property files mentioned earlier give you a lot of control over how the server functions.