Skip to content

Latest commit

 

History

History
307 lines (198 loc) · 8.15 KB

File metadata and controls

307 lines (198 loc) · 8.15 KB

Bungeecord Plugin

The Bungeecord plugin provides you to:

  • Generate 'plugin.yml' with less configuration.

  • Shortcuts for dependency and repository.

  • Tasks for run server with your plugins for debug.

Table of contents

Requirements

The plugin requires Gradle 5.4.2+, recommends the latest.

To update your gradle wrapper:

gradlew wrapper --gradle-version 6.6 --distribution-type all

Usage

Full Example Here

Groovy DSL

plugins {
    id 'kr.entree.spigradle.bungee' version '2.2.3'
}

Kotlin DSL

plugins {
    id("kr.entree.spigradle.bungee") version "2.2.3"
}
Groovy Legacy
buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'kr.entree:spigradle:2.2.3'
    }
}

apply plugin: 'kr.entree.spigradle.bungee'
Kotlin Legacy
buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath("kr.entree:spigradle:2.2.3")
    }
}

apply(plugin = "kr.entree.spigradle.bungee")

Description file generation

The bungee.yml file will be generated by task generateBungeeDescription based on the configuration of bungee, included into output jars automatically.

Basically the properties 'main', 'name' and 'version' defaults to auto-detected main, project.name, project.version respectively. So if we create a simple plugin that just needs those properties, we don't need any configuration. Only pay attention to your unique implementation.

You can configure all properties of plugin.yml in bungee {} block.

Main class detection

The plugin automatically finds the main class extends Plugin, and set the 'main' property to the class found.

You may present the main class using @BungeePlugin or @PluginMain:

import kr.entree.spigradle.annotations.BungeePlugin;

@BungeePlugin
public class SamplePlugin extends Plugin { }

Debug your plugin

Run your plugin with just execute single gradle task.

The debugBungee performs to download Bungeecord, copy it with your plugins into the default path debug/bungee, and run Bungeecord.

These tasks copy your plugin and its dependency plugins.

You can pass (jvm)arguments:

bungeecord {
    debug {
        args '--nojline', '--max-players', '100'
        jvmArgs '-Xmx16G'
    }
}

This affects to debugBungee, also RunBungee IDEA RunConfiguration.

More information: Tasks

Configuration

bungee - [BungeeExtension](TODO Javadoc)

The description of your plugin for a 'bungee.yml'.

About the bungee.yml, See Here

Groovy Example
bungee {
    description 'A Bungeecord plugin.'
    author 'Me'
    depends 'foo', 'bar'
    softDepends 'soft'
}
Kotlin Example
bungee {
    description = "A Bungeecord plugin."
    author = "Me"
    depends = listOf("SomePlugin")
    softDepends = listOf("SomeSoftPlugin")
}

Without type-safe accessors:

configure<BungeeExtension> {
    description = "A Bungeecord plugin."
}

Tasks

All tasks supports UP-TO-DATE checks.

Configuration Guide

Groovy:

runBungee {
    jvmArgs('-Xmx8G')
}

Kotlin with type-safe accessors:

tasks {
    runBungee {
        jvmArgs("-Xmx8G")
    }
}

Kotlin without type-safe accessors:

tasks {
    named<JavaExec>("runBungee") {
        jvmArgs("-Xmx8G")
    }
}

Kotlin with property delegation

tasks {
    val runBungee by existing(JavaExec::clas) {
        jvmArgs("-Xmx8G")
    }
    // Do something with 'runBungee'
}

detectBungeeMain - SubclassDetection

Finds the main class extends net.md_5.bungee.api.plugin.Plugin.

generateBungeeDescription - YamlGenerate

Depends on: detectBungeeMain

Generates the description file 'bungee.yml'.

debugBungee

Depends on: prepareBungeePlugins, downloadBungee, runBungee

Downloads Bungeecord and runs it with your plugin and dependency plugins.

prepareBungeePlugins - Copy

Depends on: build

Copies project plugin jar and its dependency plugins into the server plugins directory.

downloadBungee - Download

Downloads Bungeecord.

runBungee - JavaExec

Just runs the Bungeecord jar at configured path even there's no executable file.

NOTE: Use debugBungee instead of runBungee if you need prepare process like download Bungeecord jar, copy plugins.

cleanDebug

Deletes all server files.

See also