1+ buildscript {
2+ repositories {
3+ mavenCentral()
4+ }
5+ dependencies {
6+ classpath ' com.guardsquare:proguard-gradle:7.1.0'
7+ }
8+ }
9+
110plugins {
11+ id ' com.github.johnrengelman.shadow' version ' 7.1.0'
212 id ' java'
3- id " org.jetbrains.kotlin.jvm" version " 1.5.21"
4- id ' idea'
13+ id " org.jetbrains.kotlin.jvm" version " 1.5.31"
514}
615sourceCompatibility = JavaVersion . VERSION_1_8
716targetCompatibility = JavaVersion . VERSION_1_8
817
918group = ' io.github.mdsimmo'
10- version = ' 0.5.0 -1.12.2-R1'
19+ version = ' 0.6.4 -1.12.2-R1'
1120
1221repositories {
1322 mavenCentral()
@@ -20,11 +29,23 @@ repositories {
2029 // world edit repo
2130 url " https://maven.enginehub.org/repo"
2231 }
32+ maven {
33+ // PlaceholderAPI
34+ url = ' https://repo.extendedclip.com/content/repositories/placeholderapi/'
35+ }
36+ maven {
37+ name = " sonatype-oss-snapshots"
38+ url = " https://oss.sonatype.org/content/repositories/snapshots/"
39+ }
40+ maven {
41+ url ' https://libraries.minecraft.net/'
42+ }
2343}
2444
2545dependencies {
26- implementation ' org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.5.21 '
46+ implementation ' org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.5.31 '
2747 implementation " net.objecthunter:exp4j:0.4.8"
48+ // implementation "me.lucko:commodore:1.10"
2849
2950 compileOnly " org.bukkit:bukkit:1.12.2-R0.1-SNAPSHOT"
3051 testImplementation " org.bukkit:bukkit:1.12.2-R0.1-SNAPSHOT"
@@ -33,23 +54,45 @@ dependencies {
3354 compileOnly " com.sk89q.worldedit:worldedit-bukkit:6.1.5"
3455 testImplementation " com.sk89q.worldedit:worldedit-bukkit:6.1.5"
3556
57+ compileOnly ' me.clip:placeholderapi:2.10+'
58+ testImplementation ' me.clip:placeholderapi:2.10+'
59+
3660 testImplementation " junit:junit:4.13.+"
3761 testImplementation " org.mockito:mockito-core:3.3.+"
3862}
39-
63+ shadowJar {
64+ relocate ' net.objecthunter' , ' io.github.mdsimmo.bomberman.lib.net.objecthunter'
65+ // relocate 'me.lucko', 'io.github.mdsimmo.bomberman.lib.me.lucko'
66+ relocate ' com.mojang' , ' io.github.mdsimmo.bomberman.lib.com.mojang'
67+ relocate ' kotlin' , ' io.github.mdsimmo.bomberman.lib.kotlin'
68+ relocate ' org.jetbrains' , ' io.github.mdsimmo.bomberman.lib.org.jetbrains'
69+ relocate ' org.intellij' , ' io.github.mdsimmo.bomberman.lib.org.intellij'
70+ }
4071
4172processResources {
4273 // auto assign values in the plugin.yml
43- // Do not filter schematics as they get corrupted when trying to be read as text
44- filesNotMatching([" **.schematic" ]) {
74+ filesMatching(" plugin.yml" ) {
4575 filter {
46- line ->
47- line
48- .replace(' ${version}' , version)
76+ line -> line. replace(' ${version}' , version)
4977 }
5078 }
5179}
5280
81+ task minify (type : proguard.gradle.ProGuardTask , dependsOn : shadowJar) {
82+ injars shadowJar. outputs. files
83+ outjars " build/libs/Bomberman-${ version} -min.jar"
84+
85+ libraryjars " ${ System.getProperty('java.home')} /jmods/java.base.jmod"
86+ libraryjars " ${ System.getProperty('java.home')} /jmods/java.logging.jmod"
87+ libraryjars configurations. findByName(' compileOnly' ). getFiles()
88+
89+ // only remove unused library code (mostly kotlin)
90+ keep " public class !io.github.mdsimmo.bomberman.lib.** { *; }"
91+
92+ // Don't rename anything
93+ dontobfuscate
94+ }
95+
5396task clearOldPluginJar ( type : Delete ) {
5497 description ' Deletes any old bomberman plugins from the server'
5598 if ( project. hasProperty(" serverLocation" ) ) {
@@ -62,23 +105,15 @@ task clearOldPluginJar( type: Delete ) {
62105task copyToServer (type : Copy , dependsOn : clearOldPluginJar ) {
63106 description ' Copies the plugin to the server'
64107 if ( project. hasProperty(" serverLocation" ) ) {
65- from jar
108+ from minify
66109 into " $serverLocation /plugins/update"
67110 }
68111}
69112
70- task install ( dependsOn : [build , copyToServer] ) {
113+ task install ( dependsOn : [minify , copyToServer] ) {
71114 description ' Compiles, tests and copies the code to the server'
72115}
73116
74- jar {
75- from {
76- configurations. runtimeClasspath. collect {
77- it. isDirectory() ? it : zipTree(it)
78- }
79- }
80- }
81-
82117tasks. withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile ). configureEach {
83118 sourceCompatibility = JavaVersion . VERSION_1_8
84119 targetCompatibility = JavaVersion . VERSION_1_8
0 commit comments