diff --git a/api/src/main/java/net/momirealms/customcrops/api/CustomCropsAPI.java b/api/src/main/java/net/momirealms/customcrops/api/CustomCropsAPI.java index 8e132af..d94810f 100644 --- a/api/src/main/java/net/momirealms/customcrops/api/CustomCropsAPI.java +++ b/api/src/main/java/net/momirealms/customcrops/api/CustomCropsAPI.java @@ -130,10 +130,6 @@ public interface CustomCropsAPI { */ @Nullable static CustomCropsAPI getInstance() { - Plugin plugin = Bukkit.getPluginManager().getPlugin("CustomCrops"); - if (plugin instanceof CustomCropsPlugin cc) { - return cc.getAPI(); - } - return null; + return CustomCropsPlugin.getInstance().getAPI(); } } diff --git a/api/src/main/java/net/momirealms/customcrops/api/CustomCropsPlugin.java b/api/src/main/java/net/momirealms/customcrops/api/CustomCropsPlugin.java index b32109a..1998c16 100644 --- a/api/src/main/java/net/momirealms/customcrops/api/CustomCropsPlugin.java +++ b/api/src/main/java/net/momirealms/customcrops/api/CustomCropsPlugin.java @@ -21,9 +21,15 @@ import org.bukkit.plugin.java.JavaPlugin; public abstract class CustomCropsPlugin extends JavaPlugin { + protected static CustomCropsPlugin instance; + protected CustomCropsAPI customCropsAPI; public CustomCropsAPI getAPI() { return customCropsAPI; } + + public static CustomCropsPlugin getInstance() { + return instance; + } } diff --git a/build.gradle.kts b/build.gradle.kts index 31458ba..78c337d 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -57,9 +57,18 @@ allprojects { } subprojects { + tasks.processResources { + val props = mapOf("version" to version) + inputs.properties(props) + filteringCharset = "UTF-8" + filesMatching("*plugin.yml") { + expand(props) + } + } tasks.withType { options.encoding = "UTF-8" + options.release.set(17) } tasks.shadowJar { @@ -68,8 +77,17 @@ subprojects { archiveFileName.set("CustomCrops-" + project.name + "-" + project.version + ".jar") } - tasks.javadoc.configure { - options.quiet() + if ("api" == project.name) { + publishing { + publications { + create("mavenJava") { + groupId = "net.momirealms" + artifactId = "CustomCrops" + version = rootProject.version.toString() + artifact(tasks.shadowJar) + } + } + } } } diff --git a/gradle.properties b/gradle.properties index 16d5100..d508eeb 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,8 +1,8 @@ #systemProp.socks.proxyHost=127.0.0.1 #systemProp.socks.proxyPort=7890 - +# #systemProp.http.proxyHost=127.0.0.1 #systemProp.http.proxyPort=7890 - +# #systemProp.https.proxyHost=127.0.0.1 #systemProp.https.proxyPort=7890 diff --git a/jitpack.yml b/jitpack.yml new file mode 100644 index 0000000..1e41e00 --- /dev/null +++ b/jitpack.yml @@ -0,0 +1,2 @@ +jdk: + - openjdk17 \ No newline at end of file diff --git a/plugin/src/main/java/net/momirealms/customcrops/CustomCrops.java b/plugin/src/main/java/net/momirealms/customcrops/CustomCrops.java index f784fdc..793c37e 100644 --- a/plugin/src/main/java/net/momirealms/customcrops/CustomCrops.java +++ b/plugin/src/main/java/net/momirealms/customcrops/CustomCrops.java @@ -80,6 +80,7 @@ public final class CustomCrops extends CustomCropsPlugin { @Override public void onLoad(){ plugin = this; + instance = this; this.loadLibs(); ProtectionLib.initialize(this); }