Page 1 of 1

Multiverse-Inventories YAML -> JSON converter

PostPosted: Mon Jan 28, 2013 1:28 am
by Zancarius
The topic says it all.

The attached file contains sources to the quick and dirty conversion script I wrote to convert Multiverse-Inventories YAML-formatted data to their new JSON format. It isn't fully tested, but it appears to work and will at least recover most of the inventory contents, armor, and player stats. I've tested it with stacks of just about everything, including item enchantments. It hasn't been tested with potions, however, and will probably break.

The best option to get it working is to install omnijson and pyaml (they're required) and run the script directly with its first argument as the file you intend to convert. Preferably, you should do this under a virtualenv, e.g.:

Code: Select all
$ cd ~/python
$ tar zxvf multiverse-inventories-converter.tar.gz
$ cd multiverse-inventories-converter
$ virtualenv2 .python
$ source .python/bin/activate
$ pip omnijson pyaml
$ cd ~/minecraft-server/plugins/Multiverse-Inventories/groups/default
$ for i in *.yml ; do python ~/python/multiverse-inventories-converter/converter.py $i ; done
$ cd ~/minecraft-server/plugins/Multiverse-Inventories/worlds/world
$ for i in *.yml ; do python ~/python/multiverse-inventories-converter/converter.py $i ; done


There's almost nothing to the sources, and they should be considered in the public domain. I also disclaim any warranty, fitness for a particular purpose, etc. You should back up your install before touching this. In fact, you should back up your Minecraft server installation regularly, especially prior to a major update that might break things.

Also, it's worth noting that if you're using Windows and cannot open tarballs, you should be using 7-zip instead. If you're using Linux, *BSD, or Mac OS X and cannot open tarballs, then there isn't much hope for you (protip: There's a cheat sheet, but I can't tell you where--that'd be cheating!).

Cheers.