Skip to content

Tutorial for bring Spigot & Bungee together in one project!

License

Notifications You must be signed in to change notification settings

FlyUltra/TutorialMulPlat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

TutorialMulPlat

badge badge badge badge badge

Do you want to have 1 plugin for two and more platforms?
This is tutorial how to do it!

Table of contents

Getting started

  1. Create your file Important file
  2. Add Dependencies
  3. Add Main class for Spigot, and Bungee
  4. Look at Resources files to add remaining .yml files
  5. Have fun!

Important file

We need to create new File.
File directory like pom.xml, but with name <plugin name>.iml

The File
<?xml version="1.0" encoding="UTF-8"?>
<module version="4">
    <component name="FacetManager">
        <facet type="minecraft" name="Minecraft">
            <configuration>
                <autoDetectTypes>
                    // Here we can type our platforms, that we want to register
                    // Here we want to register Spigot and Bungee platform
                    <platformType>SPIGOT</platformType>
                    <platformType>BUNGEECORD</platformType>
                </autoDetectTypes>
            </configuration>
        </facet>
    </component>
</module>

Dependencies

Maven
<repository>
    <id>spigot-repo</id>
    <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
    <id>bungeecord-repo</id>
    <url>https://oss.sonatype.org/content/repositories/snapshots</url>
</repository>

<dependency>
    <groupId>net.md-5</groupId>
    <artifactId>bungeecord-api</artifactId>
    <version>VERSION</version>
    <type>jar</type>
    <scope>provided</scope>
</dependency>
<dependency>
    <groupId>org.spigotmc</groupId>
    <artifactId>spigot-api</artifactId>
    <version>VERSION</version>
    <scope>provided</scope>
</dependency>
Gradle
allprojects {
    repositories {
        ...
        maven { url = 'https://oss.sonatype.org/content/repositories/snapshots' }
        maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
    }
}


dependencies {
    compileOnly 'net.md-5:bungeecord-api:VERSION'
    compileOnly  'org.spigotmc:spigot-api:VERSION'
}

Main classes

Spigot
// Normal main class for Spigot plugin
public class Spigot extends JavaPlugin {

    @Override
    public void onEnable() {

        Bukkit.getLogger().log(Level.INFO, "Cool plugin from Spigot!");
    }

    @Override
    public void onDisable() {

    }

}
Bungee
// Normal main class for Spigot plugin
public class Bungee extends Plugin {

    @Override
    public void onEnable() {

        getProxy().getLogger().log(Level.INFO, "Cool plugin from Bungee!");
    }

    @Override
    public void onDisable() {

    }

}

Resources files

Spigot
name: <Plugin name>
author: <Author>
version: VERSION
main: <Path to main><Main class name>
database: <true|false> (can be skipped)

commands:
  yourcmd:
Bungee
name: <Plugin name>
author: <Author>
version: VERSION
main: <Path to main><Main class name>
database: <true|false> (can be skipped)

commands:
  yourcmd:

License

ForestChannelAPI is licensed under the permissive MIT license. Please see LICENSE.txt for more information.