Pages

Thursday, August 22, 2013

Minecraft got me onto github

I've been playing Minecraft for a long time now and I've always enjoyed knowing the fact it is written in Java. Things became interesting when I started playing with a friend on a private server. We hang out on Skype and basically make our own fun.

The guy running the server felt a little out of his league and was struggling to keep up with updates. Always that frustrating balance of work and life.

So I offered a hand. I've ran a few servers and I love looking after Java stuff.

The first trick I needed to do was be able to set up a testing environment that wouldn't affect the people playing the game. Easy enough to use my little netbook. It took a little while to work out how to separate the server configuration from the server data but I managed to do it with a bukkit server. I think the main bit was moving the world data outside the home directory via world-container and launching the app with "-log-pattern ../minecraftData/server.log"

We were using the https://github.com/gamerx/Backup plugin to take snapshots of the world but this plugin didn't recognise the world-container configuration. Was super simple to fork it at https://github.com/pimaster/Backup, build and deploy.

I believe the changes have been pulled into gamerx's copy but a new version hasn't been released for such a minor change.

dynamap took a lot more fiddling around trying to understand what it setup and expected.
tilespath: ../../../minecraftData/dynmap/web/tiles
webpath: ../../../minecraftData/dynmap/web
I then copied some of the html that needed to be served into this directory so it knew how to server up the basic data. Fortunately it still looked in the plugins directory for some of the more dynamic resources.

With this set, I was able to symlink the data directory to a directory in Dropbox. It meant the same configuration I was testing inside Eclipse was also used on my netbook. When I was happy with my testing, I used a diff application to move new settings and plugins to another folder in Dropbox that was synced the hosted server.

I was in admin heaven :D

Then came a request to have multiple worlds hosted by the same process. The requirement was we wanted people to be creative in some areas without the hassle of mobs but still be able to have the challenge of fighting of mobs without access to the creative tools.

There were a couple of plugins that changed a players gamemode per world but none had the ability to remember a players state in a mixed world.
So I wrote https://github.com/pimaster/GameModeRememberer.
Forces players into a game mode on some worlds.
Remembers if a player has a certain game mode on others.
Also has some basic inventory management when switching worlds.
Need to work on enforcing certain rules in worlds. At the moment I believe a player in a survival world can be given resources from a player with operator status in creative worlds. Would be nice to stop this.