It is currently Thu Nov 21, 2024 5:42 am

Multiverse-Inventories YAML -> JSON converter

Minecraft isn't just a chip off the ol' block. It's an addictive and deceptively complicated construction sandbox game. Play in survival mode (multiplayer, too!) while building fortifications to protect against zombie hordes--and other baddies that appear during the night--or try your hand at massive projects in creative mode. We run a local Minecraft server instance for guild members and others on an invite-only basis. See the sticky posts in this forum for details!
Forum rules
This forum is specifically intended for Minecraft-related discussions.

Multiverse-Inventories YAML -> JSON converter

Postby Zancarius » Mon Jan 28, 2013 1:28 am

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.
Attachments
multiverse-inventories-converter.tar.gz
(3.46 KiB) Downloaded 255 times
I gave that lich a phylactery shard. Liches love phylactery shards.
User avatar
Zancarius
Site Admin
 
Posts: 3907
Joined: Wed Jul 05, 2006 3:06 pm
Location: New Mexico
Gender: Male

Return to Minecraft

Who is online

Users browsing this forum: No registered users and 3 guests

cron