Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Building Minecraft Server Modifications - Second Edition

You're reading from   Building Minecraft Server Modifications - Second Edition Create and customize your very own Minecraft server using Java and the Spigot API

Arrow left icon
Product type Paperback
Published in Dec 2015
Publisher
ISBN-13 9781785883026
Length 158 pages
Edition 2nd Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Cody M. Sommer Cody M. Sommer
Author Profile Icon Cody M. Sommer
Cody M. Sommer
Arrow right icon
View More author details
Toc

Table of Contents (12) Chapters Close

Preface 1. Deploying a Spigot Server FREE CHAPTER 2. Learning the Bukkit API 3. Creating Your First Bukkit Plugin 4. Testing on the Spigot Server 5. Plugin Commands 6. Player Permissions 7. The Bukkit Event System 8. Making Your Plugin Configurable 9. Saving Your Data 10. The Bukkit Scheduler 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:

Minecraft/Bukkit server commands

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:

Minecraft/Bukkit server commands

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.

You have been reading a chapter from
Building Minecraft Server Modifications - Second Edition - Second Edition
Published in: Dec 2015
Publisher:
ISBN-13: 9781785883026
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image