diff --git a/build.gradle b/build.gradle index 0015fe7..c9ffa05 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,6 @@ plugins { - id "java" + id "java-library" + id "idea" } base { @@ -71,3 +72,31 @@ jar { rename { "${it}_${project.name ?: rootProject.name}" } } } + +idea { + module { + ["run"].each { + excludeDirs << file("$it") + } + } +} + +tasks.register("runViaProxy", JavaExec) { + dependsOn tasks.jar + + mainClass = "net.raphimc.viaproxy.ViaProxy" + classpath = sourceSets.main.compileClasspath + workingDir = file("run") + jvmArgs = ["-DskipUpdateCheck"] + + doFirst { + def pluginsDir = file("$workingDir/plugins") + pluginsDir.mkdirs() + file("$pluginsDir/${project.name}.jar").bytes = tasks.jar.archiveFile.get().asFile.bytes + } + + doLast { + file("$workingDir/plugins/${project.name}.jar").delete() + file("$workingDir/logs").deleteDir() + } +}