From 21885949c7c000534e3fa47ce3e36ee5b7a5a7f1 Mon Sep 17 00:00:00 2001 From: Tim203 Date: Thu, 9 Feb 2023 17:31:00 +0100 Subject: [PATCH] Moved the base api to a separate repo --- api/base/build.gradle.kts | 7 - .../main/java/org/geysermc/api/Geyser.java | 95 ------------- .../java/org/geysermc/api/GeyserApiBase.java | 130 ------------------ .../geysermc/api/connection/Connection.java | 121 ---------------- .../geysermc/api/util/BedrockPlatform.java | 73 ---------- .../java/org/geysermc/api/util/InputMode.java | 49 ------- .../java/org/geysermc/api/util/UiProfile.java | 45 ------ api/build.gradle.kts | 7 + api/geyser/build.gradle.kts | 14 -- .../org/geysermc/geyser/api/GeyserApi.java | 0 .../geysermc/geyser/api/command/Command.java | 0 .../geyser/api/command/CommandExecutor.java | 0 .../geyser/api/command/CommandSource.java | 0 .../api/connection/GeyserConnection.java | 0 .../geysermc/geyser/api/event/EventBus.java | 0 .../geyser/api/event/EventRegistrar.java | 0 .../geyser/api/event/EventSubscriber.java | 0 .../geyser/api/event/ExtensionEventBus.java | 0 .../api/event/ExtensionEventSubscriber.java | 0 .../api/event/connection/ConnectionEvent.java | 0 .../downstream/ServerDefineCommandsEvent.java | 0 .../lifecycle/GeyserDefineCommandsEvent.java | 0 .../GeyserDefineCustomItemsEvent.java | 0 .../GeyserLoadResourcePacksEvent.java | 0 .../lifecycle/GeyserPostInitializeEvent.java | 0 .../lifecycle/GeyserPreInitializeEvent.java | 0 .../event/lifecycle/GeyserShutdownEvent.java | 0 .../geyser/api/extension/Extension.java | 0 .../api/extension/ExtensionDescription.java | 0 .../geyser/api/extension/ExtensionLoader.java | 0 .../geyser/api/extension/ExtensionLogger.java | 0 .../api/extension/ExtensionManager.java | 0 .../InvalidDescriptionException.java | 0 .../exception/InvalidExtensionException.java | 0 .../api/item/custom/CustomItemData.java | 0 .../api/item/custom/CustomItemOptions.java | 0 .../api/item/custom/CustomRenderOffsets.java | 0 .../item/custom/NonVanillaCustomItemData.java | 0 .../geysermc/geyser/api/network/AuthType.java | 0 .../geyser/api/network/BedrockListener.java | 0 .../geyser/api/network/RemoteServer.java | 0 .../geysermc/geyser/api/util/TriState.java | 0 .../kotlin/geyser.api-conventions.gradle.kts | 9 -- build.gradle.kts | 18 +-- core/build.gradle.kts | 2 +- gradle/libs.versions.toml | 11 +- settings.gradle.kts | 3 - 47 files changed, 19 insertions(+), 565 deletions(-) delete mode 100644 api/base/build.gradle.kts delete mode 100644 api/base/src/main/java/org/geysermc/api/Geyser.java delete mode 100644 api/base/src/main/java/org/geysermc/api/GeyserApiBase.java delete mode 100644 api/base/src/main/java/org/geysermc/api/connection/Connection.java delete mode 100644 api/base/src/main/java/org/geysermc/api/util/BedrockPlatform.java delete mode 100644 api/base/src/main/java/org/geysermc/api/util/InputMode.java delete mode 100644 api/base/src/main/java/org/geysermc/api/util/UiProfile.java create mode 100644 api/build.gradle.kts delete mode 100644 api/geyser/build.gradle.kts rename api/{geyser => }/src/main/java/org/geysermc/geyser/api/GeyserApi.java (100%) rename api/{geyser => }/src/main/java/org/geysermc/geyser/api/command/Command.java (100%) rename api/{geyser => }/src/main/java/org/geysermc/geyser/api/command/CommandExecutor.java (100%) rename api/{geyser => }/src/main/java/org/geysermc/geyser/api/command/CommandSource.java (100%) rename api/{geyser => }/src/main/java/org/geysermc/geyser/api/connection/GeyserConnection.java (100%) rename api/{geyser => }/src/main/java/org/geysermc/geyser/api/event/EventBus.java (100%) rename api/{geyser => }/src/main/java/org/geysermc/geyser/api/event/EventRegistrar.java (100%) rename api/{geyser => }/src/main/java/org/geysermc/geyser/api/event/EventSubscriber.java (100%) rename api/{geyser => }/src/main/java/org/geysermc/geyser/api/event/ExtensionEventBus.java (100%) rename api/{geyser => }/src/main/java/org/geysermc/geyser/api/event/ExtensionEventSubscriber.java (100%) rename api/{geyser => }/src/main/java/org/geysermc/geyser/api/event/connection/ConnectionEvent.java (100%) rename api/{geyser => }/src/main/java/org/geysermc/geyser/api/event/downstream/ServerDefineCommandsEvent.java (100%) rename api/{geyser => }/src/main/java/org/geysermc/geyser/api/event/lifecycle/GeyserDefineCommandsEvent.java (100%) rename api/{geyser => }/src/main/java/org/geysermc/geyser/api/event/lifecycle/GeyserDefineCustomItemsEvent.java (100%) rename api/{geyser => }/src/main/java/org/geysermc/geyser/api/event/lifecycle/GeyserLoadResourcePacksEvent.java (100%) rename api/{geyser => }/src/main/java/org/geysermc/geyser/api/event/lifecycle/GeyserPostInitializeEvent.java (100%) rename api/{geyser => }/src/main/java/org/geysermc/geyser/api/event/lifecycle/GeyserPreInitializeEvent.java (100%) rename api/{geyser => }/src/main/java/org/geysermc/geyser/api/event/lifecycle/GeyserShutdownEvent.java (100%) rename api/{geyser => }/src/main/java/org/geysermc/geyser/api/extension/Extension.java (100%) rename api/{geyser => }/src/main/java/org/geysermc/geyser/api/extension/ExtensionDescription.java (100%) rename api/{geyser => }/src/main/java/org/geysermc/geyser/api/extension/ExtensionLoader.java (100%) rename api/{geyser => }/src/main/java/org/geysermc/geyser/api/extension/ExtensionLogger.java (100%) rename api/{geyser => }/src/main/java/org/geysermc/geyser/api/extension/ExtensionManager.java (100%) rename api/{geyser => }/src/main/java/org/geysermc/geyser/api/extension/exception/InvalidDescriptionException.java (100%) rename api/{geyser => }/src/main/java/org/geysermc/geyser/api/extension/exception/InvalidExtensionException.java (100%) rename api/{geyser => }/src/main/java/org/geysermc/geyser/api/item/custom/CustomItemData.java (100%) rename api/{geyser => }/src/main/java/org/geysermc/geyser/api/item/custom/CustomItemOptions.java (100%) rename api/{geyser => }/src/main/java/org/geysermc/geyser/api/item/custom/CustomRenderOffsets.java (100%) rename api/{geyser => }/src/main/java/org/geysermc/geyser/api/item/custom/NonVanillaCustomItemData.java (100%) rename api/{geyser => }/src/main/java/org/geysermc/geyser/api/network/AuthType.java (100%) rename api/{geyser => }/src/main/java/org/geysermc/geyser/api/network/BedrockListener.java (100%) rename api/{geyser => }/src/main/java/org/geysermc/geyser/api/network/RemoteServer.java (100%) rename api/{geyser => }/src/main/java/org/geysermc/geyser/api/util/TriState.java (100%) delete mode 100644 build-logic/src/main/kotlin/geyser.api-conventions.gradle.kts diff --git a/api/base/build.gradle.kts b/api/base/build.gradle.kts deleted file mode 100644 index 6b6fb8f46..000000000 --- a/api/base/build.gradle.kts +++ /dev/null @@ -1,7 +0,0 @@ -dependencies { - api(libs.cumulus) - api(libs.events) { - exclude(group = "com.google.guava", module = "guava") - exclude(group = "org.lanternpowered", module = "lmbda") - } -} \ No newline at end of file diff --git a/api/base/src/main/java/org/geysermc/api/Geyser.java b/api/base/src/main/java/org/geysermc/api/Geyser.java deleted file mode 100644 index 7543d1661..000000000 --- a/api/base/src/main/java/org/geysermc/api/Geyser.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright (c) 2019-2022 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; - -import org.checkerframework.checker.nullness.qual.NonNull; - -/** - * General API class for Geyser. - */ -@NonNull -public class Geyser { - private static GeyserApiBase api; - - /** - * Returns the base api. - * - * @return the base api - */ - @NonNull - public static GeyserApiBase api() { - if (api == null) { - throw new RuntimeException("Api has not been registered yet!"); - } - - return api; - } - - /** - * Returns the api of the given type. - * - * @param apiClass the api class - * @param the type - * @return the api of the given type - */ - @SuppressWarnings("unchecked") - public static T api(@NonNull Class apiClass) { - if (apiClass.isInstance(api)) { - return (T) api; - } - - if (api == null) { - throw new RuntimeException("Api has not been registered yet!"); - } else { - throw new RuntimeException("Api was not an instance of " + apiClass + "! Was " + api.getClass().getCanonicalName()); - } - } - - /** - * Registers the given api type. The api cannot be - * registered if {@link #isRegistered()} is true as - * an api has already been specified. - * - * @param api the api - */ - public static void set(@NonNull GeyserApiBase api) { - if (Geyser.api != null) { - throw new RuntimeException("Cannot redefine already registered api!"); - } - - Geyser.api = api; - } - - /** - * Gets if the api has been registered and - * is ready for usage. - * - * @return if the api has been registered - */ - public static boolean isRegistered() { - return api != null; - } -} diff --git a/api/base/src/main/java/org/geysermc/api/GeyserApiBase.java b/api/base/src/main/java/org/geysermc/api/GeyserApiBase.java deleted file mode 100644 index a845e37fd..000000000 --- a/api/base/src/main/java/org/geysermc/api/GeyserApiBase.java +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright (c) 2019-2022 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; - -import org.checkerframework.checker.nullness.qual.MonotonicNonNull; -import org.checkerframework.checker.nullness.qual.NonNull; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.checkerframework.common.value.qual.IntRange; -import org.geysermc.api.connection.Connection; -import org.geysermc.cumulus.form.Form; -import org.geysermc.cumulus.form.util.FormBuilder; - -import java.util.List; -import java.util.UUID; - -/** - * The base API class. - */ -public interface GeyserApiBase { - /** - * Gets the connection from the given UUID, if applicable. The player must be logged in to the Java server - * for this to return a non-null value. - * - * @param uuid the UUID of the connection - * @return the connection from the given UUID, if applicable - */ - @Nullable - Connection connectionByUuid(@NonNull UUID uuid); - - /** - * Gets the connection from the given XUID, if applicable. This method only works for online connections. - * - * @param xuid the XUID of the session - * @return the connection from the given UUID, if applicable - */ - @Nullable - Connection connectionByXuid(@NonNull String xuid); - - /** - * Method to determine if the given online player is a Bedrock player. - * - * @param uuid the uuid of the online player - * @return true if the given online player is a Bedrock player - */ - boolean isBedrockPlayer(@NonNull UUID uuid); - - /** - * Sends a form to the given connection and opens it. - * - * @param uuid the uuid of the connection to open it on - * @param form the form to send - * @return whether the form was successfully sent - */ - boolean sendForm(@NonNull UUID uuid, @NonNull Form form); - - /** - * Sends a form to the given connection and opens it. - * - * @param uuid the uuid of the connection to open it on - * @param formBuilder the formBuilder to send - * @return whether the form was successfully sent - */ - boolean sendForm(@NonNull UUID uuid, @NonNull FormBuilder formBuilder); - - /** - * Transfer the given connection to a server. A Bedrock player can successfully transfer to the same server they are - * currently playing on. - * - * @param uuid the uuid of the connection - * @param address the address of the server - * @param port the port of the server - * @return true if the transfer was a success - */ - boolean transfer(@NonNull UUID uuid, @NonNull String address, @IntRange(from = 0, to = 65535) int port); - - - /** - * Returns all the online connections. - */ - @NonNull - List onlineConnections(); - - /** - * Returns the amount of online connections. - */ - int onlineConnectionsCount(); - - /** - * Returns the prefix used by Floodgate. Will be null when the auth-type isn't Floodgate. - */ - @MonotonicNonNull - String usernamePrefix(); - - /** - * Returns the major API version. Bumped whenever a significant breaking change or feature addition is added. - */ - default int majorApiVersion() { - return 1; - } - - /** - * Returns the minor API version. May be bumped for new API additions. - */ - default int minorApiVersion() { - return 0; - } -} diff --git a/api/base/src/main/java/org/geysermc/api/connection/Connection.java b/api/base/src/main/java/org/geysermc/api/connection/Connection.java deleted file mode 100644 index 1cd7a9d13..000000000 --- a/api/base/src/main/java/org/geysermc/api/connection/Connection.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright (c) 2019-2022 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.connection; - -import org.checkerframework.checker.nullness.qual.MonotonicNonNull; -import org.checkerframework.checker.nullness.qual.NonNull; -import org.checkerframework.common.value.qual.IntRange; -import org.geysermc.api.util.BedrockPlatform; -import org.geysermc.api.util.InputMode; -import org.geysermc.api.util.UiProfile; -import org.geysermc.cumulus.form.Form; -import org.geysermc.cumulus.form.util.FormBuilder; - -import java.util.UUID; - -/** - * Represents a player connection. - */ -public interface Connection { - /** - * Returns the bedrock name of the connection. - */ - @NonNull String bedrockUsername(); - - /** - * Returns the java name of the connection. - */ - @MonotonicNonNull - String javaUsername(); - - /** - * Returns the UUID of the connection. - */ - @MonotonicNonNull - UUID javaUuid(); - - /** - * Returns the XUID of the connection. - */ - @NonNull String xuid(); - - /** - * Returns the version of the Bedrock client. - */ - @NonNull String version(); - - /** - * Returns the platform that the connection is playing on. - */ - @NonNull BedrockPlatform platform(); - - /** - * Returns the language code of the connection. - */ - @NonNull String languageCode(); - - /** - * Returns the User Interface Profile of the connection. - */ - @NonNull UiProfile uiProfile(); - - /** - * Returns the Input Mode of the Bedrock client. - */ - @NonNull InputMode inputMode(); - - /** - * Returns whether the connection is linked. - * This will always return false when the auth-type isn't Floodgate. - */ - boolean isLinked(); - - /** - * Sends a form to the connection and opens it. - * - * @param form the form to send - * @return whether the form was successfully sent - */ - boolean sendForm(@NonNull Form form); - - /** - * Sends a form to the connection and opens it. - * - * @param formBuilder the formBuilder to send - * @return whether the form was successfully sent - */ - boolean sendForm(@NonNull FormBuilder formBuilder); - - /** - * Transfer the connection to a server. A Bedrock player can successfully transfer to the same server they are - * currently playing on. - * - * @param address the address of the server - * @param port the port of the server - * @return true if the transfer was a success - */ - boolean transfer(@NonNull String address, @IntRange(from = 0, to = 65535) int port); -} diff --git a/api/base/src/main/java/org/geysermc/api/util/BedrockPlatform.java b/api/base/src/main/java/org/geysermc/api/util/BedrockPlatform.java deleted file mode 100644 index 15d0da027..000000000 --- a/api/base/src/main/java/org/geysermc/api/util/BedrockPlatform.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2019-2022 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; - -import org.checkerframework.checker.nullness.qual.NonNull; - -public enum BedrockPlatform { - UNKNOWN("Unknown"), - GOOGLE("Android"), - IOS("iOS"), - OSX("macOS"), - AMAZON("Amazon"), - GEARVR("Gear VR"), - HOLOLENS("Hololens"), - UWP("Windows"), - WIN32("Windows x86"), - DEDICATED("Dedicated"), - TVOS("Apple TV"), - PS4("PS4"), - NX("Switch"), - XBOX("Xbox One"), - WINDOWS_PHONE("Windows Phone"); - - private static final BedrockPlatform[] VALUES = values(); - - private final String displayName; - - BedrockPlatform(String displayName) { - this.displayName = displayName; - } - - /** - * Get the BedrockPlatform from the identifier. - * - * @param id the BedrockPlatform identifier - * @return The BedrockPlatform or {@link #UNKNOWN} if the platform wasn't found - */ - @NonNull - public static BedrockPlatform fromId(int id) { - return id < VALUES.length ? VALUES[id] : VALUES[0]; - } - - /** - * @return friendly display name of platform. - */ - @Override - public String toString() { - return displayName; - } -} diff --git a/api/base/src/main/java/org/geysermc/api/util/InputMode.java b/api/base/src/main/java/org/geysermc/api/util/InputMode.java deleted file mode 100644 index 70346ffa5..000000000 --- a/api/base/src/main/java/org/geysermc/api/util/InputMode.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2019-2022 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; - -import org.checkerframework.checker.nullness.qual.NonNull; - -public enum InputMode { - UNKNOWN, - KEYBOARD_MOUSE, - TOUCH, - CONTROLLER, - VR; - - private static final InputMode[] VALUES = values(); - - /** - * Get the InputMode from the identifier. - * - * @param id the InputMode identifier - * @return The InputMode or {@link #UNKNOWN} if the mode wasn't found - */ - @NonNull - public static InputMode fromId(int id) { - return VALUES.length > id ? VALUES[id] : VALUES[0]; - } -} \ No newline at end of file diff --git a/api/base/src/main/java/org/geysermc/api/util/UiProfile.java b/api/base/src/main/java/org/geysermc/api/util/UiProfile.java deleted file mode 100644 index cddb97260..000000000 --- a/api/base/src/main/java/org/geysermc/api/util/UiProfile.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2019-2022 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; - -import org.checkerframework.checker.nullness.qual.NonNull; - -public enum UiProfile { - CLASSIC, POCKET; - - private static final UiProfile[] VALUES = values(); - - /** - * Get the UiProfile from the identifier. - * - * @param id the UiProfile identifier - * @return The UiProfile or {@link #CLASSIC} if the profile wasn't found - */ - @NonNull - public static UiProfile fromId(int id) { - return VALUES.length > id ? VALUES[id] : VALUES[0]; - } -} diff --git a/api/build.gradle.kts b/api/build.gradle.kts new file mode 100644 index 000000000..c0ed242b6 --- /dev/null +++ b/api/build.gradle.kts @@ -0,0 +1,7 @@ +plugins { + id("geyser.publish-conventions") +} + +dependencies { + api(libs.base.api) +} \ No newline at end of file diff --git a/api/geyser/build.gradle.kts b/api/geyser/build.gradle.kts deleted file mode 100644 index dcde85337..000000000 --- a/api/geyser/build.gradle.kts +++ /dev/null @@ -1,14 +0,0 @@ -plugins { - id("geyser.api-conventions") -} - -dependencies { - api(projects.api) -} - -publishing { - publications.named("mavenJava") { - groupId = rootProject.group as String + ".geyser" - artifactId = "api" - } -} \ No newline at end of file diff --git a/api/geyser/src/main/java/org/geysermc/geyser/api/GeyserApi.java b/api/src/main/java/org/geysermc/geyser/api/GeyserApi.java similarity index 100% rename from api/geyser/src/main/java/org/geysermc/geyser/api/GeyserApi.java rename to api/src/main/java/org/geysermc/geyser/api/GeyserApi.java diff --git a/api/geyser/src/main/java/org/geysermc/geyser/api/command/Command.java b/api/src/main/java/org/geysermc/geyser/api/command/Command.java similarity index 100% rename from api/geyser/src/main/java/org/geysermc/geyser/api/command/Command.java rename to api/src/main/java/org/geysermc/geyser/api/command/Command.java diff --git a/api/geyser/src/main/java/org/geysermc/geyser/api/command/CommandExecutor.java b/api/src/main/java/org/geysermc/geyser/api/command/CommandExecutor.java similarity index 100% rename from api/geyser/src/main/java/org/geysermc/geyser/api/command/CommandExecutor.java rename to api/src/main/java/org/geysermc/geyser/api/command/CommandExecutor.java diff --git a/api/geyser/src/main/java/org/geysermc/geyser/api/command/CommandSource.java b/api/src/main/java/org/geysermc/geyser/api/command/CommandSource.java similarity index 100% rename from api/geyser/src/main/java/org/geysermc/geyser/api/command/CommandSource.java rename to api/src/main/java/org/geysermc/geyser/api/command/CommandSource.java diff --git a/api/geyser/src/main/java/org/geysermc/geyser/api/connection/GeyserConnection.java b/api/src/main/java/org/geysermc/geyser/api/connection/GeyserConnection.java similarity index 100% rename from api/geyser/src/main/java/org/geysermc/geyser/api/connection/GeyserConnection.java rename to api/src/main/java/org/geysermc/geyser/api/connection/GeyserConnection.java diff --git a/api/geyser/src/main/java/org/geysermc/geyser/api/event/EventBus.java b/api/src/main/java/org/geysermc/geyser/api/event/EventBus.java similarity index 100% rename from api/geyser/src/main/java/org/geysermc/geyser/api/event/EventBus.java rename to api/src/main/java/org/geysermc/geyser/api/event/EventBus.java diff --git a/api/geyser/src/main/java/org/geysermc/geyser/api/event/EventRegistrar.java b/api/src/main/java/org/geysermc/geyser/api/event/EventRegistrar.java similarity index 100% rename from api/geyser/src/main/java/org/geysermc/geyser/api/event/EventRegistrar.java rename to api/src/main/java/org/geysermc/geyser/api/event/EventRegistrar.java diff --git a/api/geyser/src/main/java/org/geysermc/geyser/api/event/EventSubscriber.java b/api/src/main/java/org/geysermc/geyser/api/event/EventSubscriber.java similarity index 100% rename from api/geyser/src/main/java/org/geysermc/geyser/api/event/EventSubscriber.java rename to api/src/main/java/org/geysermc/geyser/api/event/EventSubscriber.java diff --git a/api/geyser/src/main/java/org/geysermc/geyser/api/event/ExtensionEventBus.java b/api/src/main/java/org/geysermc/geyser/api/event/ExtensionEventBus.java similarity index 100% rename from api/geyser/src/main/java/org/geysermc/geyser/api/event/ExtensionEventBus.java rename to api/src/main/java/org/geysermc/geyser/api/event/ExtensionEventBus.java diff --git a/api/geyser/src/main/java/org/geysermc/geyser/api/event/ExtensionEventSubscriber.java b/api/src/main/java/org/geysermc/geyser/api/event/ExtensionEventSubscriber.java similarity index 100% rename from api/geyser/src/main/java/org/geysermc/geyser/api/event/ExtensionEventSubscriber.java rename to api/src/main/java/org/geysermc/geyser/api/event/ExtensionEventSubscriber.java diff --git a/api/geyser/src/main/java/org/geysermc/geyser/api/event/connection/ConnectionEvent.java b/api/src/main/java/org/geysermc/geyser/api/event/connection/ConnectionEvent.java similarity index 100% rename from api/geyser/src/main/java/org/geysermc/geyser/api/event/connection/ConnectionEvent.java rename to api/src/main/java/org/geysermc/geyser/api/event/connection/ConnectionEvent.java diff --git a/api/geyser/src/main/java/org/geysermc/geyser/api/event/downstream/ServerDefineCommandsEvent.java b/api/src/main/java/org/geysermc/geyser/api/event/downstream/ServerDefineCommandsEvent.java similarity index 100% rename from api/geyser/src/main/java/org/geysermc/geyser/api/event/downstream/ServerDefineCommandsEvent.java rename to api/src/main/java/org/geysermc/geyser/api/event/downstream/ServerDefineCommandsEvent.java diff --git a/api/geyser/src/main/java/org/geysermc/geyser/api/event/lifecycle/GeyserDefineCommandsEvent.java b/api/src/main/java/org/geysermc/geyser/api/event/lifecycle/GeyserDefineCommandsEvent.java similarity index 100% rename from api/geyser/src/main/java/org/geysermc/geyser/api/event/lifecycle/GeyserDefineCommandsEvent.java rename to api/src/main/java/org/geysermc/geyser/api/event/lifecycle/GeyserDefineCommandsEvent.java diff --git a/api/geyser/src/main/java/org/geysermc/geyser/api/event/lifecycle/GeyserDefineCustomItemsEvent.java b/api/src/main/java/org/geysermc/geyser/api/event/lifecycle/GeyserDefineCustomItemsEvent.java similarity index 100% rename from api/geyser/src/main/java/org/geysermc/geyser/api/event/lifecycle/GeyserDefineCustomItemsEvent.java rename to api/src/main/java/org/geysermc/geyser/api/event/lifecycle/GeyserDefineCustomItemsEvent.java diff --git a/api/geyser/src/main/java/org/geysermc/geyser/api/event/lifecycle/GeyserLoadResourcePacksEvent.java b/api/src/main/java/org/geysermc/geyser/api/event/lifecycle/GeyserLoadResourcePacksEvent.java similarity index 100% rename from api/geyser/src/main/java/org/geysermc/geyser/api/event/lifecycle/GeyserLoadResourcePacksEvent.java rename to api/src/main/java/org/geysermc/geyser/api/event/lifecycle/GeyserLoadResourcePacksEvent.java diff --git a/api/geyser/src/main/java/org/geysermc/geyser/api/event/lifecycle/GeyserPostInitializeEvent.java b/api/src/main/java/org/geysermc/geyser/api/event/lifecycle/GeyserPostInitializeEvent.java similarity index 100% rename from api/geyser/src/main/java/org/geysermc/geyser/api/event/lifecycle/GeyserPostInitializeEvent.java rename to api/src/main/java/org/geysermc/geyser/api/event/lifecycle/GeyserPostInitializeEvent.java diff --git a/api/geyser/src/main/java/org/geysermc/geyser/api/event/lifecycle/GeyserPreInitializeEvent.java b/api/src/main/java/org/geysermc/geyser/api/event/lifecycle/GeyserPreInitializeEvent.java similarity index 100% rename from api/geyser/src/main/java/org/geysermc/geyser/api/event/lifecycle/GeyserPreInitializeEvent.java rename to api/src/main/java/org/geysermc/geyser/api/event/lifecycle/GeyserPreInitializeEvent.java diff --git a/api/geyser/src/main/java/org/geysermc/geyser/api/event/lifecycle/GeyserShutdownEvent.java b/api/src/main/java/org/geysermc/geyser/api/event/lifecycle/GeyserShutdownEvent.java similarity index 100% rename from api/geyser/src/main/java/org/geysermc/geyser/api/event/lifecycle/GeyserShutdownEvent.java rename to api/src/main/java/org/geysermc/geyser/api/event/lifecycle/GeyserShutdownEvent.java diff --git a/api/geyser/src/main/java/org/geysermc/geyser/api/extension/Extension.java b/api/src/main/java/org/geysermc/geyser/api/extension/Extension.java similarity index 100% rename from api/geyser/src/main/java/org/geysermc/geyser/api/extension/Extension.java rename to api/src/main/java/org/geysermc/geyser/api/extension/Extension.java diff --git a/api/geyser/src/main/java/org/geysermc/geyser/api/extension/ExtensionDescription.java b/api/src/main/java/org/geysermc/geyser/api/extension/ExtensionDescription.java similarity index 100% rename from api/geyser/src/main/java/org/geysermc/geyser/api/extension/ExtensionDescription.java rename to api/src/main/java/org/geysermc/geyser/api/extension/ExtensionDescription.java diff --git a/api/geyser/src/main/java/org/geysermc/geyser/api/extension/ExtensionLoader.java b/api/src/main/java/org/geysermc/geyser/api/extension/ExtensionLoader.java similarity index 100% rename from api/geyser/src/main/java/org/geysermc/geyser/api/extension/ExtensionLoader.java rename to api/src/main/java/org/geysermc/geyser/api/extension/ExtensionLoader.java diff --git a/api/geyser/src/main/java/org/geysermc/geyser/api/extension/ExtensionLogger.java b/api/src/main/java/org/geysermc/geyser/api/extension/ExtensionLogger.java similarity index 100% rename from api/geyser/src/main/java/org/geysermc/geyser/api/extension/ExtensionLogger.java rename to api/src/main/java/org/geysermc/geyser/api/extension/ExtensionLogger.java diff --git a/api/geyser/src/main/java/org/geysermc/geyser/api/extension/ExtensionManager.java b/api/src/main/java/org/geysermc/geyser/api/extension/ExtensionManager.java similarity index 100% rename from api/geyser/src/main/java/org/geysermc/geyser/api/extension/ExtensionManager.java rename to api/src/main/java/org/geysermc/geyser/api/extension/ExtensionManager.java diff --git a/api/geyser/src/main/java/org/geysermc/geyser/api/extension/exception/InvalidDescriptionException.java b/api/src/main/java/org/geysermc/geyser/api/extension/exception/InvalidDescriptionException.java similarity index 100% rename from api/geyser/src/main/java/org/geysermc/geyser/api/extension/exception/InvalidDescriptionException.java rename to api/src/main/java/org/geysermc/geyser/api/extension/exception/InvalidDescriptionException.java diff --git a/api/geyser/src/main/java/org/geysermc/geyser/api/extension/exception/InvalidExtensionException.java b/api/src/main/java/org/geysermc/geyser/api/extension/exception/InvalidExtensionException.java similarity index 100% rename from api/geyser/src/main/java/org/geysermc/geyser/api/extension/exception/InvalidExtensionException.java rename to api/src/main/java/org/geysermc/geyser/api/extension/exception/InvalidExtensionException.java diff --git a/api/geyser/src/main/java/org/geysermc/geyser/api/item/custom/CustomItemData.java b/api/src/main/java/org/geysermc/geyser/api/item/custom/CustomItemData.java similarity index 100% rename from api/geyser/src/main/java/org/geysermc/geyser/api/item/custom/CustomItemData.java rename to api/src/main/java/org/geysermc/geyser/api/item/custom/CustomItemData.java diff --git a/api/geyser/src/main/java/org/geysermc/geyser/api/item/custom/CustomItemOptions.java b/api/src/main/java/org/geysermc/geyser/api/item/custom/CustomItemOptions.java similarity index 100% rename from api/geyser/src/main/java/org/geysermc/geyser/api/item/custom/CustomItemOptions.java rename to api/src/main/java/org/geysermc/geyser/api/item/custom/CustomItemOptions.java diff --git a/api/geyser/src/main/java/org/geysermc/geyser/api/item/custom/CustomRenderOffsets.java b/api/src/main/java/org/geysermc/geyser/api/item/custom/CustomRenderOffsets.java similarity index 100% rename from api/geyser/src/main/java/org/geysermc/geyser/api/item/custom/CustomRenderOffsets.java rename to api/src/main/java/org/geysermc/geyser/api/item/custom/CustomRenderOffsets.java diff --git a/api/geyser/src/main/java/org/geysermc/geyser/api/item/custom/NonVanillaCustomItemData.java b/api/src/main/java/org/geysermc/geyser/api/item/custom/NonVanillaCustomItemData.java similarity index 100% rename from api/geyser/src/main/java/org/geysermc/geyser/api/item/custom/NonVanillaCustomItemData.java rename to api/src/main/java/org/geysermc/geyser/api/item/custom/NonVanillaCustomItemData.java diff --git a/api/geyser/src/main/java/org/geysermc/geyser/api/network/AuthType.java b/api/src/main/java/org/geysermc/geyser/api/network/AuthType.java similarity index 100% rename from api/geyser/src/main/java/org/geysermc/geyser/api/network/AuthType.java rename to api/src/main/java/org/geysermc/geyser/api/network/AuthType.java diff --git a/api/geyser/src/main/java/org/geysermc/geyser/api/network/BedrockListener.java b/api/src/main/java/org/geysermc/geyser/api/network/BedrockListener.java similarity index 100% rename from api/geyser/src/main/java/org/geysermc/geyser/api/network/BedrockListener.java rename to api/src/main/java/org/geysermc/geyser/api/network/BedrockListener.java diff --git a/api/geyser/src/main/java/org/geysermc/geyser/api/network/RemoteServer.java b/api/src/main/java/org/geysermc/geyser/api/network/RemoteServer.java similarity index 100% rename from api/geyser/src/main/java/org/geysermc/geyser/api/network/RemoteServer.java rename to api/src/main/java/org/geysermc/geyser/api/network/RemoteServer.java diff --git a/api/geyser/src/main/java/org/geysermc/geyser/api/util/TriState.java b/api/src/main/java/org/geysermc/geyser/api/util/TriState.java similarity index 100% rename from api/geyser/src/main/java/org/geysermc/geyser/api/util/TriState.java rename to api/src/main/java/org/geysermc/geyser/api/util/TriState.java diff --git a/build-logic/src/main/kotlin/geyser.api-conventions.gradle.kts b/build-logic/src/main/kotlin/geyser.api-conventions.gradle.kts deleted file mode 100644 index 7c8f9a3d7..000000000 --- a/build-logic/src/main/kotlin/geyser.api-conventions.gradle.kts +++ /dev/null @@ -1,9 +0,0 @@ -plugins { - id("geyser.publish-conventions") -} - -tasks { - shadowJar { - archiveBaseName.set(archiveBaseName.get() + "-api") - } -} \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index 06c2e987b..4304811ff 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -5,7 +5,7 @@ plugins { } allprojects { - group = "org.geysermc" + group = "org.geysermc.geyser" version = "2.1.0-SNAPSHOT" description = "Allows for players from Minecraft: Bedrock Edition to join Minecraft: Java Edition servers." @@ -23,8 +23,6 @@ val platforms = setOf( projects.velocity ).map { it.dependencyProject } -val api: Project = projects.api.dependencyProject - subprojects { apply { plugin("java-library") @@ -32,16 +30,8 @@ subprojects { plugin("geyser.build-logic") } - val relativePath = projectDir.relativeTo(rootProject.projectDir).path - - if (relativePath.contains("api")) { - plugins.apply("geyser.api-conventions") - } else { - group = rootProject.group as String + ".geyser" - when (this) { - in platforms -> plugins.apply("geyser.platform-conventions") - api -> plugins.apply("geyser.publish-conventions") - else -> plugins.apply("geyser.base-conventions") - } + when (this) { + in platforms -> plugins.apply("geyser.platform-conventions") + else -> plugins.apply("geyser.base-conventions") } } \ No newline at end of file diff --git a/core/build.gradle.kts b/core/build.gradle.kts index 994325ea0..e5e64ca69 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -7,7 +7,7 @@ plugins { } dependencies { - api(projects.geyserApi) + api(projects.api) api(projects.common) // Jackson JSON and YAML serialization diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index b4f14d7b0..7339cdffd 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,4 +1,7 @@ [versions] +base-api = "1.0.0-SNAPSHOT" +cumulus = "1.1.1" +events = "1.0-SNAPSHOT" jackson = "2.14.0" fastutil = "8.5.2" netty = "4.1.80.Final" @@ -14,8 +17,6 @@ adventure = "4.12.0-20220629.025215-9" adventure-platform = "4.1.2" junit = "4.13.1" checkerframework = "3.19.0" -cumulus = "1.1.1" -events = "1.0-SNAPSHOT" log4j = "2.17.1" jline = "3.21.0" terminalconsoleappender = "1.2.0" @@ -31,6 +32,10 @@ fabric-loader = "0.14.8" fabric-api = "0.58.5+1.19.1" [libraries] +base-api = { group = "org.geysermc.api", name = "base-api", version.ref = "base-api" } +cumulus = { group = "org.geysermc.cumulus", name = "cumulus", version.ref = "cumulus" } +events = { group = "org.geysermc.event", name = "events", version.ref = "events" } + jackson-annotations = { group = "com.fasterxml.jackson.core", name = "jackson-annotations", version.ref = "jackson" } jackson-core = { group = "com.fasterxml.jackson.core", name = "jackson-databind", version.ref = "jackson" } jackson-dataformat-yaml = { group = "com.fasterxml.jackson.dataformat", name = "jackson-dataformat-yaml", version.ref = "jackson" } @@ -74,8 +79,6 @@ adapters-spigot = { group = "org.geysermc.geyser.adapters", name = "spigot-all", bungeecord-proxy = { group = "com.github.SpigotMC.BungeeCord", name = "bungeecord-proxy", version.ref = "bungeecord" } checker-qual = { group = "org.checkerframework", name = "checker-qual", version.ref = "checkerframework" } commodore = { group = "me.lucko", name = "commodore", version.ref = "commodore" } -cumulus = { group = "org.geysermc.cumulus", name = "cumulus", version.ref = "cumulus" } -events = { group = "org.geysermc.event", name = "events", version.ref = "events" } guava = { group = "com.google.guava", name = "guava", version.ref = "guava" } gson = { group = "com.google.code.gson", name = "gson", version.ref = "gson" } junit = { group = "junit", name = "junit", version.ref = "junit" } diff --git a/settings.gradle.kts b/settings.gradle.kts index 6f212d3ac..e9c7641e4 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -62,7 +62,6 @@ rootProject.name = "geyser-parent" include(":ap") include(":api") -include(":geyser-api") include(":bungeecord") include(":fabric") include(":spigot") @@ -73,8 +72,6 @@ include(":common") include(":core") // Specify project dirs -project(":api").projectDir = file("api/base") -project(":geyser-api").projectDir = file("api/geyser") project(":bungeecord").projectDir = file("bootstrap/bungeecord") project(":fabric").projectDir = file("bootstrap/fabric") project(":spigot").projectDir = file("bootstrap/spigot")