· 6 years ago · Oct 31, 2019, 03:26 PM
1#Creating an Addon
2
3// Example Addon
4package test;
5
6import eu.mcdb.spicord.api.addon.SimpleAddon;
7import eu.mcdb.spicord.bot.DiscordBot;
8
9public class ExampleAddon extends SimpleAddon {
10
11 public ExampleAddon() {
12 super(
13 "Example Addon", // Addon name
14 "my_example_addon", // Addon key
15 "OopsieWoopsie" // Addon author
16 );
17 }
18
19 @Override
20 public void onLoad(DiscordBot bot) {
21 // You don't need to put a command like "!example" or "-example", because the command prefix is configured apart.
22 bot.onCommand("example", example -> {
23 example.getMessage().getChannel()
24 .sendMessage("Hello world!")
25 .queue();
26 });
27 }
28}
29
30
31#Registering the Addon
32
33// Example using the BungeeCord plugin API, you can use the Bukkit API if you want ^^
34package test;
35
36import eu.mcdb.spicord.Spicord;
37import net.md_5.bungee.api.plugin.Plugin;
38
39public class ExamplePlugin extends Plugin {
40
41 @Override
42 public void onEnable() {
43 Spicord.getInstance().getAddonManager().registerAddon(new ExampleAddon()); // Register the addon
44 }
45}