summaryrefslogtreecommitdiff
path: root/build.gradle.kts
blob: 6d075c8ae39ac19d722aae6da738bdf3cba31dfa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import net.minecrell.pluginyml.bukkit.BukkitPluginDescription
import net.minecrell.pluginyml.paper.PaperPluginDescription

plugins {
    alias(libs.plugins.kotlin.jvm)
    alias(libs.plugins.plugin.yml.paper)
    alias(libs.plugins.run.paper)
    alias(libs.plugins.spotless)
}

group = "dev.mikka.cortex.help"

version = "1.0-SNAPSHOT"

repositories {
    mavenCentral()
    maven("https://repo.papermc.io/repository/maven-public/")
    maven("https://repo.codemc.io/repository/maven-releases/")
}

dependencies {
    compileOnly(libs.paper.api)
    paperLibrary(libs.kotlin.stdlib)

    compileOnly(
        libs.luckperms.api
    ) // Bukkit SPI - It would be actually safer to include the API on the server, however we can't for this demonstration
    compileOnly(libs.protocollib) // Direct Ref
    paperLibrary(libs.packetevents.spigot) // Library with initializer
}

kotlin { jvmToolchain(17) }

paper {
    name = "TestPlugin"
    version = "0.1.0"
    description = "Accessing other plugins"
    author = "devmikka"
    main = "dev.mikka.cortex.help.TestPlugin"
    loader = "dev.mikka.cortex.help.loader.TestPluginLoader"
    generateLibrariesJson = true
    apiVersion = "1.20"
    load = BukkitPluginDescription.PluginLoadOrder.STARTUP

    serverDependencies {
        register("LuckPerms") {
            load = PaperPluginDescription.RelativeLoadOrder.BEFORE
            required = false
        }
        register("ProtocolLib") {
            load = PaperPluginDescription.RelativeLoadOrder.BEFORE
            required = true
            joinClasspath = true
        }
    }
}

spotless {
    kotlin { ktfmt().kotlinlangStyle().configure { it.setMaxWidth(120) } }
    kotlinGradle { ktfmt().kotlinlangStyle().configure { it.setMaxWidth(140) } }
    java {
        removeUnusedImports()
        importOrder()
        formatAnnotations()
        palantirJavaFormat()
    }
}

tasks.generatePaperPluginDescription { useDefaultCentralProxy() }

tasks.runServer { minecraftVersion("1.20.1") }