Mineserver
A rewrite of Minecraft 1.8.9 in C++ !
|
You can make custom plugins for your server in Lua. We chose Lua because it is fast, lightweight, easy to learn and more importantly easy to use on top of C++.
First of all, you need to name your plugin and give it a version. The filename of your file doesn't matter, the name that will be displayed inside the game will be retrieved from the Lua file. You can access the current plugin running metadata as such :
You can listen to all the events listed in the events directory. Go click on the individual files, look for the events you want to listen, and you should be able to see in their documentation how to listen for the event. Generally to listen for an event a class called SimpleBasicEvent
, you do as follows :
You can normally access all the classes of the server. It is still at a development stage so not everything is well-connected and not everything will have a lua equivalent. There are still few things you can do though.
If it is not specified in the class documentation, you can access a class fields like they are written. For exemple, for the Handshake Packet class, you can access its Next State field like this, after for exemple registering for the Client Handshake Event :
You can access any fields of the config using the following manner. If you want to access the max players field for exemple, refer to the Config Documentation and get the category of the field and its name so that if you want to access it, you do :
For exemple, for the max players field in the server category :
All default libraries are opened on the lua file. So beware of what files you install because they can use libraries like os
that can modify files on your computer.