Skip to content

Latest commit

 

History

History
262 lines (191 loc) · 6.53 KB

File metadata and controls

262 lines (191 loc) · 6.53 KB

Bungeecord Plugin

The Bungeecord plugin allows you to:

  • Generate 'bungee.yml' with less configuration.

  • Shortcuts for dependency and repository.

Table of contents

Requirements

The plugin requires Gradle 9.0+, the latest version is recommended.

To update your gradle wrapper:

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

Usage

Full Example Here

Using Version Catalog (Recommended)

settings.gradle.kts

dependencyResolutionManagement {
    repositories {
        mavenCentral()
    }
    versionCatalogs {
        create("bungees") {
            from("io.typst:bungee-catalog:1.0.0")
        }
    }
}

build.gradle.kts

plugins {
    java
    alias(bungees.plugins.bungee)
}

repositories {
    mavenCentral()
    bungeeRepos {
        bungeecord()
    }
}

dependencies {
    compileOnly(bungees.bungeecord.api)
}
Groovy (settings.gradle)
dependencyResolutionManagement {
    repositories {
        mavenCentral()
    }
    versionCatalogs {
        create('bungees') {
            from('io.typst:bungee-catalog:1.0.0')
        }
    }
}
Groovy (build.gradle)
plugins {
    id 'java'
    alias bungees.plugins.bungee
}

repositories {
    mavenCentral()
    bungeeRepos {
        bungeecord()
    }
}

dependencies {
    compileOnly bungees.bungeecord.api
}

Without Version Catalog

Groovy DSL

plugins {
    id 'io.typst.spigradle.bungee' version '4.0.2'
}

Kotlin DSL

plugins {
    id("io.typst.spigradle.bungee") version "4.0.2"
}

Description file generation

The bungee.yml file will be generated by task generateBungeePluginDescription 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 detects your main plugin class using bytecode analysis (ASM). It scans compiled .class files to find classes that extend Plugin.

How it works:

  • Scans compiled bytecode (not source code) for faster and more reliable detection
  • Finds non-abstract, public classes extending net.md_5.bungee.api.plugin.Plugin
  • Supports complex inheritance hierarchies
  • Incremental: only scans changed files for faster builds
  • Automatically sets the main property in bungee.yml

Manual override: If you need to manually specify the main class:

bungee {
    main.set("com.example.MyCustomMain")
}

For more details, see the Main Class Detection section.

Configuration

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

About the bungee.yml, See Here

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

Without type-safe accessors:

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

Repository shortcuts

Repository shortcuts are available via bungeeRepos {} block inside repositories {}:

Shortcut URL
bungeecord() https://oss.sonatype.org/content/repositories/snapshots/
sonatype() https://oss.sonatype.org/content/repositories/snapshots/
minecraftLibraries() https://libraries.minecraft.net/
jitpack() https://jitpack.io/

Example:

Groovy:

repositories {
    mavenCentral()
    bungeeRepos {
        bungeecord()
        minecraftLibraries()
    }
}

Kotlin:

repositories {
    mavenCentral()
    bungeeRepos {
        bungeecord()
        minecraftLibraries()
    }
}

Tasks

All tasks support UP-TO-DATE checks.

Note: Debug tasks (server download and run) are currently Spigot-only. For BungeeCord, you'll need to set up your own development server.

detectBungeeEntrypoints - SubclassDetection

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

generateBungeePluginDescription - YamlGenerate

Depends on: detectBungeeEntrypoints

Generates the description file 'bungee.yml'.

See also