So, this is a very WIP Plugin resource I’ve been working on. Basically, I’m developing a plugin that allows the developer to produce quick and easy GUIs. It’s going to support persistent, and/or serializable menus, with chat, book-view, and inventory variations.
#Source
#Download
(WARNING: versions beginning with ‘0’ are WIP, and any methods/classes/fields/etc. are subject to change!)
I went with a “dependent” builder design, meaning that each page builder has a reference to it’s parent menu builder, and each button builder has a reference to it’s parent page builder. This makes the code a lot cleaner (and reminiscent of ASM), as you’d otherwise have to provide page ids, button ids, and/or plugin objects to virtually every method. If anyone has any suggestions on how to improve this, I’d be open to them!
Old Demo Video (Still possible in update, but the code has changed, henced I removed that code from this post):
Below is the GridFinalizer class. Basically, everything is abstracted away for as long as possible, and Finalizers are responsible for taking that abstraction and displaying it to the player. GridFinalizer takes an InventoryButtonPage, which has been formatted to a PageTarget, in this case, GridTarget, and displays an inventory to the player. CustomInventoryBuilder just wraps Inventory.Builder and handles property keys (“inventorytitle”, “inventorycapacity”, etc).
Edit:
though, at the moment, offsets don’t seem to want to work
Will you also have saving of custom inventories in there? That would really sell me on using this as there’s no built-in method of saving inventories to disk using the api currently.
Probably not explicitly… menus and all their icons and information will be saved so they can be reconstructed at a later time, but I don’t see a need to save custom inventories. Besides, saving custom inventories is easy, since every ItemStack is a DataHolder (and thus a DataView), all you really need to do is create a map of SlotPoss to ItemStacks and save that. If you need help saving inventories, I’d suggest creating a new thread and asking about it, but I don’t think my MenuAPI is going to directly include a feature to save custom inventories…
Well, it’s not nearly done yet… there’s still a lot I have to write, code-wise and documentation-wise… If you want to, you can run the gradle build task to compile the project, but at the moment there aren’t any .jar files that I’ve compiled.
This project looks pretty awesome. If you can get this up and running my server would find it super useful! Will it allow for customizable GUIs using configs or will we set them in game? Just curious. Either way looks like a great project and one I know a lot of people have been looking for. Do you have an estimate on time for the project?
This project is going to be solely a resource for plugin developers, and will not allow customizing GUIs with configs, however, I do plan on creating a plugin that uses this resource to allow for customizable GUIs. The biggest constraint on time at the moment is school, this week is midterms week, so it may take me longer than expected. I am still trying to work on it when I have a couple minutes, and today is a snow day, so I might have some time. But, I’m not really sure when it’ll be finished. Technically speaking, it could be used right now, but I wouldn’t suggest it, since I’ll probably change many many things before the release.
###WIP Release
This is the very first “release” of MenuAPI, it is still heavily WIP, but creation of menus, builder syntax, and all that is implemented. The two major parts remaining are documentation and builders. Although there are already builders in the API, I’d like feedback from the community on their design (see the main post for a description of the builder design). I also need to do JavaDocs, as well as a wiki/tutorial thing, and those will be done Soontm. Another interesting feature added for this release is “trackers.” Basically, button or page specific listeners that handle events (see example code in the main post). Also, this release is more or less untested, so it’s likely very buggy, sorry about that ;).
Potentially… the thing is, the menus are not animated… so you’d have to swap pages every time your GUI changed, and you’ll never be able to take items out of the menu… but I took a (really) quick peek at your plugin and it might work.