File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -39,6 +39,15 @@ Copy the `.jar` file to the `plugins` directory of your allay server.
3939Start the allay server and check the logs to ensure your plugin loads and operates
4040as expected.
4141
42+ 5 . ** Test Your Plugin in Gradle**
43+
44+ ``` bash
45+ gradlew runServer
46+ ```
47+
48+ This command will start an allay server with your plugin loaded.
49+ Then close allay server by clicking ` X ` in the dashboard window.
50+
4251## Documentation
4352
4453For a deeper dive into the Allay API and its functionalities, please refer to our [ documentation] ( https://docs.allaymc.org ) (WIP).
Original file line number Diff line number Diff line change 1+ import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
2+
13plugins {
24 id(" java-library" )
35 id(" com.github.johnrengelman.shadow" ) version " 8.1.1"
@@ -30,4 +32,27 @@ dependencies {
3032
3133tasks.shadowJar {
3234 archiveClassifier = " shaded"
33- }
35+ }
36+
37+ tasks.register<Copy >(" runServer" ) {
38+ outputs.upToDateWhen { false }
39+ dependsOn(" shadowJar" )
40+ val launcherRepo = " https://raw.githubusercontent.com/AllayMC/AllayLauncher/refs/heads/main/scripts"
41+ val cmdWin = " Invoke-Expression (Invoke-WebRequest -Uri \" ${launcherRepo} /install_windows.ps1\" ).Content"
42+ val cmdLinux = " wget -qO- ${launcherRepo} /install_linux.sh | bash"
43+ val cwd = layout.buildDirectory.file(" launcher" ).get().asFile.apply { mkdirs() }
44+
45+ val shadowJar = tasks.named(" shadowJar" , ShadowJar ::class ).get()
46+ from(shadowJar.archiveFile.get().asFile)
47+ into(cwd.resolve(" plugins" ).apply { mkdirs() })
48+
49+ val isWindows = System .getProperty(" os.name" ).startsWith(" Windows" )
50+ fun launch () = exec {
51+ workingDir = cwd
52+ if (isWindows) commandLine(" powershell" , " -Command" , cmdWin)
53+ else commandLine(" sh" , " -c" , cmdLinux)
54+ }
55+
56+ // https://github.com/gradle/gradle/issues/18716 // kill it manually by click X...
57+ doLast { launch() }
58+ }
You can’t perform that action at this time.
0 commit comments