Saturday, August 9, 2014

Minecraft Server 1.7.9 on EC2 Ubuntu

My boys LOVE Minecraft. Their obsession has evolved from learning how to mine and place blocks to troubleshooting Forge, working with multiple mods, and downloading texture packs. They're smart kids, and they've surpassed my knowledge of the game. They've learned how to identify suspicious downloads (which you run into a lot in the weird world of and mediafire-hosted files) and can work with compressed files and the quirks of the 8.1 Metro interface without much assistance.

But the one thing I've got over them is an EC2 instance running a minecraft server.

I launched it last fall to test out EC2. I figured I'd have zero credibility in the technical community if I'd never, you know, actually used AWS. So I launched a micro instance running Ubuntu 12.04 LTS, installed java, downloaded the minecraft server .jar file, and I was up and running.

But that was last fall, when 1.7.6 was the latest release, and it relied on whitelisting via a text file named whitelist.txt. That file was easy to maintain: each player that you want to whitelist gets its own line. Easy. Basic.

Enter 1.7.9. Whitelisting (and OPing, and banning) is now configured via JSON files. And the format of these files is significantly different from the old whitelist.txt files I was familiar with. So this post is about how to get whitelist.json and ops.json configured manually for at least one player. And remember, I'm running minecraft_server.1.7.9.jar from a linux server with no GUI. That's what makes this slightly more interesting.

Manually Editing Your 1.7.9 Whitelist

Here's what my whitelist.json file looks like. Follow this format for yours, too.

You'll notice that we've got more than just a username here. We've got the corresponding UUID along with the username. So your first task is to gather the UUID for the users you'll be adding to the whitelist. To do this, I just launched Minecraft on my Mac and tried to connect to the server. The connection failed, because I wasn't whitelisted quite yet. But with access to the server and its logs, I knew I'd see an entry in my /usr/minecraft_server/logs directory that listed my username and UUID along with an error. I copied that UUID into the whitelist.json file, saved it, restarted minecraft_server.1.7.9.jar, and I was able to connect. But I couldn't use the in-game console to add my boys to the server. It's because I wasn't an OP.

Manually Editing Your 1.7.9 OPS list

You won't be surprised to learn that this file is of the same format as whitelist.json. So you can cut and paste from that file into this one (assuming you want the users listed in your whitelist to also be server operators).

The only bit that's unique to this file is the level line. It's a measure of how much control an OP has over the game and server (see this article for the details). I gave myself 4 because awesome.

Next Steps

Now you're configured to log into your minecraft server and use console commands to manage these two lists from here on out. You have to admit: /whitelist add username is a hell of a lot easier that the manual method above. But on this early Saturday morning, while I'm listening to Gang Starr and drinking coffee out of a mug from the US House of Representatives, getting into some old-school vi trouble is just what I was looking for. :)