diff --git a/api/build.gradle.kts b/api/build.gradle.kts index bd54a9ce4..e52dbb37a 100644 --- a/api/build.gradle.kts +++ b/api/build.gradle.kts @@ -1,8 +1,21 @@ plugins { id("geyser.publish-conventions") + alias(libs.plugins.blossom) apply true } dependencies { api(libs.base.api) api(libs.math) -} \ No newline at end of file +} + +version = property("version")!! + +sourceSets { + main { + blossom { + javaSources { + property("version", version as String) + } + } + } +} diff --git a/api/src/main/java-templates/org.geysermc.geyser.api.util/BuildData.java b/api/src/main/java-templates/org.geysermc.geyser.api.util/BuildData.java new file mode 100644 index 000000000..cc1ca710e --- /dev/null +++ b/api/src/main/java-templates/org.geysermc.geyser.api.util/BuildData.java @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2024 GeyserMC. http://geysermc.org + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * @author GeyserMC + * @link https://github.com/GeyserMC/Geyser + */ + +package org.geysermc.api.util; + +// This class is auto-generated. +public class BuildData { + public static final String VERSION = "{{ version }}"; +} diff --git a/api/src/main/java/org/geysermc/geyser/api/GeyserApi.java b/api/src/main/java/org/geysermc/geyser/api/GeyserApi.java index d16262bfc..93b276b02 100644 --- a/api/src/main/java/org/geysermc/geyser/api/GeyserApi.java +++ b/api/src/main/java/org/geysermc/geyser/api/GeyserApi.java @@ -172,11 +172,12 @@ public interface GeyserApi extends GeyserApiBase { } /** - * Gets the {@link ApiVersion} representing the current Geyser api version + * Returns the {@link ApiVersion} representing the current Geyser api version. + * See the Geyser version outline) * * @return the current geyser api version */ default ApiVersion geyserApiVersion() { - return new ApiVersion(2, 4, 1); + return new ApiVersion(BuildData.VERSION); } } diff --git a/api/src/main/java/org/geysermc/geyser/api/extension/ExtensionDescription.java b/api/src/main/java/org/geysermc/geyser/api/extension/ExtensionDescription.java index 9889aa483..25daf450f 100644 --- a/api/src/main/java/org/geysermc/geyser/api/extension/ExtensionDescription.java +++ b/api/src/main/java/org/geysermc/geyser/api/extension/ExtensionDescription.java @@ -59,29 +59,35 @@ public interface ExtensionDescription { String main(); /** - * Gets the extension's human api version + * Represents the human api version that the extension requires. + * See the Geyser version outline) + * for more details on the Geyser API version. * - * @return the extension's human api version + * @return the extension's requested human api version */ int humanApiVersion(); /** - * Gets the extension's major api version + * Represents the major api version that the extension requires. + * See the Geyser version outline) + * for more details on the Geyser API version. * - * @return the extension's major api version + * @return the extension's requested major api version */ int majorApiVersion(); /** - * Gets the extension's minor api version + * Represents the minor api version that the extension requires. + * See the Geyser version outline) + * for more details on the Geyser API version. * - * @return the extension's minor api version + * @return the extension's requested minor api version */ int minorApiVersion(); /** * No longer in use. Geyser is now using an adaption of the romantic versioning scheme. - * See here for details. + * See here for details. */ @Deprecated(forRemoval = true) default int patchApiVersion() { @@ -89,9 +95,7 @@ public interface ExtensionDescription { } /** - * Gets the extension's api version. - * - * @return the extension's api version + * Returns the extension's requested Geyser Api version. */ default String apiVersion() { return humanApiVersion() + "." + majorApiVersion() + "." + minorApiVersion();