Lately I’ve begun with writing parts of Stats for Sponge. For those of you who don’t know, Sponge is an API where developers can interact with all things minecraft, just like Bukkit or Spigot. The main difference is that it does not use minecraft code, and is therefore 100% legal and not in some gray area.
So anyway, I started using their API. The first thing I noticed is that it heavily uses annotations, such as @Plugin, @Inject and @defaultConfig(docRoot = false). Furthermore, no more plugin.yml. All commands etc are now defined using CommandSpecs, and onEnable/onDisable have been replaced by events. This is great, since instead of just having onLoad, onEnable and a scheduler for the first tick, you have much more precision on what happens when. My Stats API, for example, doesn’t depend on anything externally and should be launched as soon as possible. My StorageEngine, however, could be modified by other plugins, so it should be loaded as late as possible (but still before players start to join!). It gives me a lot of room to work with.
I’m also making a new plugin, called (for now) Blueprint. The idea is simple, you build something, select the edges and place a chest. That saves the design of the house. When someone places a chest and marks the chest as a blueprint builder, all items that are put into the chest are automatically put on the correct place. This allows you to make 1:1 replica’s of buildings easily and share them with the world. What I ran into, however, was something interesting. I tried to instantiate a Location object, but found out it requires a non-null Extent (e.g. a World). Of course, when writing test cases, I don’t have access to such data, so I was faced with an issue. I could either mock an Extent, or figure out another way to do this. In the end, I found out that Bukkit’s Location is the same as Sponge’s Vector3i or Vector3d (integer versus double). Since I’m working with blocks I can just use Vector3i instead, as it is world-independant. Suddenly, all my test cases are passing and I’m well underway to writing my first Sponge plugin. It still needs a lot of work (only one module is done) but it’s fun to find out how Sponge works.
I’ll be writing some more blog posts about my adventures regarding Sponge Plugin development soon. Hope you had a good read!