Plugin Tutorial
ServerForge Plugin Tutorial
Setting up the workspace
-
Create a new project with your IDE of choice
-
Add the ServerForge jar to the classpath using your tool if choice (ie. Maven)
Create the boilerplate of a ServerForge mod
-
Create the main class, this class should extend ServerForgePlugin and implement the methods onServerStart() and onServerStop(); For example:
package src.john01dav.testplugin; import src.john01dav.serverforge.api.ServerForgePlugin;
public class TestPlugin extends ServerForgePlugin{
public void onServerStart(){ //initialize the plugin here, including registering commands } public void onServerStop(){ //deinitialize the plugin here, there is no need to unregister commands }}
NOTE: For those of you coming from Bukkit development, there is no need to print out a message in onEnable and onDisable, ServerForge will do it for you.
Create a plugindata.txt in the root of the jar file (directly under src in IntelliJ, refer to you're IDE's documentation for other IDEs)
In this file you will have two things: the name of the plugin and the fully qualified name of the main class.
For example:
name=TestPlugin
mainClass=src.john01dav.testplugin.TestPlugin
What's next?
I recommend that you check out the tutorial here to learn how to add your own custom commands to the server.