apply plugin: 'java' apply plugin: 'maven-publish' apply plugin: 'idea' apply plugin: 'eclipse' group = 'com.sekwah.advancedportals' version = getPluginData("version") + '-snapshot' description = "" sourceCompatibility = 1.8 targetCompatibility = 1.8 tasks.withType(JavaCompile) { options.encoding = 'UTF-8' } String getPluginData(String tag) { File file = file("src/main/resources/plugin.yml") String version = "notfound" file.readLines("UTF-8").each {String line -> line = line.trim() if(line.startsWith(tag)) { version = line.substring(tag.length() + 2, line.length()) } } println "Advanced Portals v" + version return version } configurations { // configuration that holds jars to copy into lib includeLibs } repositories { maven { url "https://repo.maven.apache.org/maven2" } maven { url "https://hub.spigotmc.org/nexus/content/repositories/snapshots/" } maven { url "https://oss.sonatype.org/content/repositories/snapshots/" } } // includeLibs just says to include the library in the final jar dependencies { //implementation "org.bukkit:bukkit:1.16.1-R0.1-SNAPSHOT" implementation "org.spigotmc:spigot-api:1.16.1-R0.1-SNAPSHOT" implementation "net.md-5:bungeecord-api:1.15-SNAPSHOT" implementation "io.netty:netty-all:4.0.4.Final" //compile fileTree(dir: 'libs', include: ['*.jar']) } task copyPlugin { doLast { copy { if(System.env.MC_SERVER_LOC == null) { throw new Exception('You must set the server location and jar to use') } println "$buildDir/libs/Advanced-Portals-${version}.jar" println "${System.env.MC_SERVER_LOC}/plugins/Advanced-Portals-${version}.jar" try { delete fileTree("${System.env.MC_SERVER_LOC}/plugins/") { include "*.jar" } } catch(RuntimeException e) { println e.getLocalizedMessage() } from file("$buildDir/libs/Advanced-Portals-${version}.jar") into file("${System.env.MC_SERVER_LOC}/plugins/") } } } // Set SPIGOT_LOC to the location of your server and SPIGOT_JAR as the name of the jar file in the server you want to run // DIReallyKnowWhatIAmDoingISwear is to remove the stupid pause spigot has at the start task runJar() { doLast { if(System.env.MC_SERVER_LOC == null || System.env.MC_SERVER_JAR == null) { throw new Exception('You must set the server location and jar to use MC_SERVER_LOC and MC_SERVER_JAR') } javaexec { main "-jar" args "${System.env.MC_SERVER_LOC}\\${System.env.MC_SERVER_JAR}.jar" jvmArgs = ["-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005", "-DIReallyKnowWhatIAmDoingISwear=true"] workingDir "${System.env.MC_SERVER_LOC}" } } }