Java knowledge is required for this tutorial.
Setting up your Project(top)
This tutorial only covers IntelliJ IDEA, but other IDEs should have similar steps.
Edit by kodalee: Added screenshots from the "Eclipse" IDE.
First, open your IDE and create a new project, and then select Maven. You should have a screen similar to this:
Creating a new project:
![[IMG]](//proxy.spigotmc.org/17d5f246518295ce7ed2fe7ab2a9df44e959b496?url=https%3A%2F%2Fi.imgur.com%2FN8kw0Qb.png)
Selecting Maven:
![[IMG]](//proxy.spigotmc.org/8d8a0f827b743faed8e575ec9614b59543f43702?url=https%3A%2F%2Fi.imgur.com%2FgtcfpsJ.png)
![[IMG]](http://proxy.spigotmc.org/17d5f246518295ce7ed2fe7ab2a9df44e959b496?url=https%3A%2F%2Fi.imgur.com%2FN8kw0Qb.png)
Selecting Maven:
![[IMG]](http://proxy.spigotmc.org/8d8a0f827b743faed8e575ec9614b59543f43702?url=https%3A%2F%2Fi.imgur.com%2FgtcfpsJ.png)
![[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)
![[IMG]](http://proxy.spigotmc.org/363fa06c417c7acc8fe6d524ab106dc9a56608b1?url=https%3A%2F%2Fi.imgur.com%2Ff8gKqtv.png)
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>:
You will need to put the dependency from <dependencies> from the given code below into the <dependencies> area that is in your pom.xml.
![[IMG]](//proxy.spigotmc.org/e6c1a0b7f5dfd7dcf05d82fe00293fb98a1a20f7?url=https%3A%2F%2Fi.imgur.com%2F3jkoDux.png)
No idea why it does that but it might be required to edit on Eclipse.
![[IMG]](http://proxy.spigotmc.org/e6c1a0b7f5dfd7dcf05d82fe00293fb98a1a20f7?url=https%3A%2F%2Fi.imgur.com%2F3jkoDux.png)
No idea why it does that but it might be required to edit on Eclipse.
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.6.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>net.md-5</groupId>
<artifactId>bungeecord-api</artifactId>
<version>1.16-R0.5-SNAPSHOT</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.md-5</groupId>
<artifactId>bungeecord-api</artifactId>
<version>1.16-R0.5-SNAPSHOT</version>
<type>javadoc</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.6.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>net.md-5</groupId>
<artifactId>bungeecord-api</artifactId>
<version>1.16-R0.5-SNAPSHOT</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.md-5</groupId>
<artifactId>bungeecord-api</artifactId>
<version>1.16-R0.5-SNAPSHOT</version>
<type>javadoc</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 (YAML):
name: TestPlugin
main: me.username.testplugin.TestPlugin
version: 1.0
author: username
main: me.username.testplugin.TestPlugin
version: 1.0
author: username