Start coding your own WetSponge plugin

You can see some WetSponge plugins on our Samples Git but here you have the basic knowledge you need to start using WetSponge

Main Class - Hello World Plugin

public class HelloWorld extends WSPlugin {
    // This will be our main plugin class
    private static HelloWorld instance;

    @Override
    public void onEnable() {
        instance = this;

        // Show a text in console in yellow
        WetSponge.getServer().getConsole().sendMessage(WSText.builder("Hello, I'm a yellow text in your server console.").color(EnumTextColor.YELLOW).build());
        // Add our MainListener class to the WetSponge Event Manager
        WetSponge.getEventManager().registerListener(new MainListener(), this);
    }

    public static HelloWorld getInstance() {
        return instance;
    }
}

public class MainListener {
    // This will be our Listener class, here we will register all our listeners

    @WSListener
    public void onPlayerJoin(WSPlayerJoinEvent event) {
        // Send a "Hello world!" message to the joined player
        event.getPlayer().sendMessage("Hello world!");
    }
}

Plugin.yml - Yes, it’s required too

Node Required? Description Example
main Yes Points to the class that extends WSPlugin your.package.HelloWorld
name Yes The name of your plugin HelloWorld
description Yes A human friendly description of the functionality your plugin provides Send a “Hello world!” message to joining targets
version Yes The version of this plugin. 1.0
authors No Allows you to list one or multiple authors authors: [You, YourFriend]
website No The plugin’s or author’s website. website: https://yoursite.com
depend No A list of plugins that your plugin requires to load depend: [Plugin1]
softdepend No A list of plugins that are required for your plugin to have full functionality softdepend: [Plugin2, Plugin3]

Example

main: your.package.HelloWorld
name: HelloWorld
description: Send a "Hello world!" message to joining targets
version: '1.0'
authors: [You]
website: https://yoursite.com
depend: []
softdepend: []

Showcase of this information on the WetSponge Plugins List

/wetSponge plugin list

/wetSponge plugin list