Java knowledge is required for this tutorial.
Note: If you are impatient and just want to start quickly, you can get a skeleton project using this tool, import it with File -> Import Project in IntelliJ IDEA or File -> Import -> Maven -> Existing Maven Projects in Eclipse (repeatedly clicking Next), and continue to read the other documentation on the wiki. You should also read this tutorial, particularly the compiling section.
Setting up your Project(top)
This tutorial only covers IntelliJ IDEA, but other IDEs should have similar steps.
First, open your IDE and create a new project, and then select Maven. You should have a screen similar to this:
![[IMG]](http://proxy.spigotmc.org/f278a9645d7ca7162c9933b93b72a926dce48819?url=https%3A%2F%2Fi.imgur.com%2FVNlOYyI.png)
Click next, then you will get this screen:
![[IMG]](http://proxy.spigotmc.org/2ebfa243923ca963dfd4df579c2555d83ab76ad6?url=https%3A%2F%2Fi.imgur.com%2FXGep8Im.png)
For GroupId, type in your Java package name (like me.username). For ArtifactId, type in the name of your plugin (in our case, it will be TestPlugin). Leave the version alone for now, and click next. Change the name of your project to the name of your plugin, and then click "Finish".
The IDE will open and show you a file called pom.xml. We will now add some content to this file. Add the following lines to it, before </project>:
Code (XML):
<repositories>
<repository>
<id>bungeecord-repo</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</repository>
</repositories>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>net.md-5</groupId>
<artifactId>bungeecord-api</artifactId>
<version>1.7-SNAPSHOT</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
</dependencies>
<repository>
<id>bungeecord-repo</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</repository>
</repositories>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>net.md-5</groupId>
<artifactId>bungeecord-api</artifactId>
<version>1.7-SNAPSHOT</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
</dependencies>
Creating your main class(top)
Next, expand TestPlugin, then src, then main. It should look like this:![[IMG]](http://proxy.spigotmc.org/628bf9e283ba91a4febeeaaf26cf3dc2953480de?url=https%3A%2F%2Fi.imgur.com%2Funly9vk.png)
Right click java, then make a new package. Call it me.username.testplugin. Next, right-click the package you just created and make a new class. Call it TestPlugin. The IDE should have opened the file for you; if it did not do so, open it now.
Now, we can create our basic plugin. This page will only focus on making a plugin that does nothing except display a message when enabled; other pages on the wiki can detail all the other things you can do with your new plugin.
Add extends Plugin after the TestPlugin and before the {. The file should look something like this:
Code (Java):
package me.username.testplugin;
import net.md_5.bungee.api.plugin.Plugin;
public class TestPlugin extends Plugin {
@Override
public void onEnable() {
// You should not put an enable message in your plugin.
// BungeeCord already does so
getLogger().info("Yay! It loads!");
}
}
import net.md_5.bungee.api.plugin.Plugin;
public class TestPlugin extends Plugin {
@Override
public void onEnable() {
// You should not put an enable message in your plugin.
// BungeeCord already does so
getLogger().info("Yay! It loads!");
}
}
Making it load(top)
Now we can create the plugin.yml file, so that BungeeCord recognizes that this is a plugin and tell it how to load it. Right click resources, and create a new file called plugin.yml. In this file, add the following:Code (yml (Unknown Language)):
name: TestPlugin
main: me.username.testplugin.TestPlugin
version: 1.0
author: username
main: me.username.testplugin.TestPlugin
version: 1.0
author: username