From 9713a965ed58b30ce4c7a7b87a0058b13c92cebf Mon Sep 17 00:00:00 2001
From: Jason Penilla <11360596+jpenilla@users.noreply.github.com>
Date: Fri, 18 Jun 2021 16:38:26 -0700
Subject: [PATCH] Add task to print Minecraft version, add snapshots repo for
 publishing

---
 build.gradle.kts | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/build.gradle.kts b/build.gradle.kts
index 888179b916..d86913a4aa 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -6,6 +6,7 @@ plugins {
 
 subprojects {
     apply(plugin = "java")
+    apply(plugin = "maven-publish")
 
     java {
         toolchain {
@@ -18,6 +19,16 @@ subprojects {
         options.release.set(16)
     }
 
+    configure<PublishingExtension> {
+        repositories {
+            maven {
+                name = "paperSnapshots"
+                url = uri("https://papermc.io/repo/repository/maven-snapshots/")
+                credentials(PasswordCredentials::class)
+            }
+        }
+    }
+
     if (name == "Paper-MojangAPI") {
         return@subprojects
     }
@@ -74,3 +85,9 @@ paperweight {
         craftBukkitPatchPatchesDir.set(file("build-data/craftbukkit-patch-patches"))
     }
 }
+
+tasks.register("printMinecraftVersion") {
+    doLast {
+        println(providers.gradleProperty("mcVersion").forUseAtConfigurationTime().get().trim())
+    }
+}