MGLib
Forenote
MGLib is currently deprecated and has been superseded by Flint, a much nicer and better thought-out engine. I do not recommend creating plugins using MGLib at this point in time; rather, please use Flint as it will save both you and your users many headaches.
What is MGLib?
MGLib is a library designed with ease-of-use in mind, and made to assist plugin developers in creating minigame plugins. Generally speaking, almost all minigame plugins have the same basic functionality built into them. However, this basic functionality (e.g. round management) takes a lot of time to create. If all the core code is effectively the same, why not just use the same exact code instead of rewriting it every time? This is where MGLib comes into play. MGLib provides an API for minigame plugins to use, so that they don't need to write it themselves. This can drastically reduce the size and time investment of individual plugins. MGLib boasts an easy-to-use and understand API, paired with a large featureset, with more functionality being planned and implemented every day.
Features
For Developers
- A central API instance to call most methods
- Easy round/player management via discrete object types (Round and MGPlayer)
- Plenty of redundancy! For example, you could use either of the aforementioned classes to add a player to a round
- Easy arena creation
- Simple but flexible player management
- Issues are passed onto your plugin via easy-to-understand exceptions so you can handle them yourself
- Automatic round timing system
- Automatic rollback system
- Automatic but configurable lobby sign system
- Discrete and easy-to-use class for configuration of your minigame's variables
- Maven support
- More to come!
For Server Owners
- Simple install, just drag and drop the JAR file
- All plugins using MGLib will automatically hook it if it's installed
- Silent auto-updater to ensure you're getting access to the latest plugins and features
Want to suggest a feature? Create an issue or create a pull request!
How to Use
Developers
Click here for a complete tutorial on using MGLib to create a minigame of your own!
Server Owners
Drag and drop! Once you install a plugin which uses MGLib, it will automatically hook in and you'll be good to go.
Planned Features
Changelogs
Plugins using MGLib
If you'd like your plugin listed here, shoot me a PM!
We also have a banner for plugins utilizing MGLib to use. Feel free to add it to your project page if you wish. (Alternative banner)
Donations
I've spent hundreds of hours developing MGLib. I do it for free because it's my passion, but I greatly appreciate donations if you can offer them. :)
Click the Donate button at the top right of the page to say thanks!
External Links
Development builds of this project can be acquired at the provided continuous integration server. These builds have not been approved by the BukkitDev staff. Use them at your own risk. Additionally, these builds often undergo little to no testing, so there is no guarantee they will function properly.
MCStats
This plugin collects anonymous usage statistics. Here's a list detailing data collected, and here's a graph of and link to them:
Sponsor
Special thanks to HostHorde for supporting MGLib! Make sure to check them out!
Note: This plugin utilizes Mojang's UUID API to enable certain features.
Please refrain from reporting bugs in the comments. Instead, create an issue. :)
@BigAl512
There's rudimentary support, but to be completely honest, I'd advise against using this library. v0.4.1 is meant to be the last public update, as I intend to succeed it with Flint which will (hopefully) be a bit better thought-out than MGLib. It's still in its early stages, but you can keep an eye on its development in the meantime.
Is there any team compatibility included with this API? Looking forward to using this!
@PixelyDan
What is the output of `/ttt` without any arguments?
Edit: In advance, this issue may occur after use of the `/reload` command.
Hey, i'm having a problem but I wouldn't really consider it a bug, so, yeah... Everytime I try to use the /ttt command, it says, "/ttt [subcommand]". I downloaded MGLib, is there anything i'm missing?
@caseif
Here is the Error:
http://pastebin.com/e7NKx1vY
@DaVinci1337
It should work fine in theory, but if you're experiencing errors, feel free to create an issue on Github or PM me. :)
can u make your mglib 0.40 working on 1.7.10?
@therealspoljo
The best I can offer at the moment is a basic version of Spleef, though I'm not even sure it compiles against the latest MGLib version. But, it may give you an idea of how it works. I could also point you to this repo, which is a much more complex plugin built off of the library. It might be a little hard to understand, though.
@LacianaServer
If your aim is to set the spawn upon exiting an arena, you can do so with ConfigManager#setDefaultExitLocation(Location). I believe the method also exists in the Round class, though it only sets it for that particular round.
how can i create the location spawn?
@Bars96
UUIDs are only necessary for saving inventories, in which case they're already implemented. MGLib handles rollbacks by logging every change made to an arena by its players, then reverting them when the round ends. I've found that having each arena in a separate worlds is annoying to pretty much everyone, so I've used a definition approach at the expense of a bit of convenience when rolling back.
Does it works on 1.7.2 (I'm about nicknames instead of UUID's)? I think every round must be as separated world and rollback by it's deleting and re-extracting from ZIP archive.
@caseif
Ok, thanks
@muukrls
You can call ConfigurationManager#setPlayerClass(<? extends MGPlayer>) to make MGLib use your custom class for keeping track of players. However, it will still return MGPlayer objects when a method such as Round#getPlayer(String) is called. You can just cast this returned object to your custom class.
How do you use your custom player class from e.g. the round events? I have set it in the configmanager
@SilentThiefNC
Sorry for the late reply. Try putting "MGLib" in square brackets.
@caseif
I have MGLib in my plugins folder, and my own plugin, I have added the "depend: MGLib" text into my plugin.yml file. When I start my test server, it says that it failed to load my plugin because the depend is of the wrong type.
@SilentThiefNC
What do you mean by that? It should work as long as you have the dependency in your plugin.yml and MGLib.jar installed on the server.
When setting this as a dependency in my Plugin, it says it's the wrong type of dependency.
Do I need to have the plugin in my plugins folder also? If so, that didn't work either sadly.