From 3ac931e11b243a8803f5243478e3e2ef9eb295ad Mon Sep 17 00:00:00 2001 From: Tim203 Date: Sat, 7 Jan 2023 14:29:33 +0100 Subject: [PATCH] Moved the APIs to a dedicated repo They can now be found at https://github.com/GeyserMC/api --- 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/geyser/build.gradle.kts | 14 -- .../org/geysermc/geyser/api/GeyserApi.java | 119 ---------- .../geysermc/geyser/api/command/Command.java | 215 ------------------ .../geyser/api/command/CommandExecutor.java | 45 ---- .../geyser/api/command/CommandSource.java | 81 ------- .../api/connection/GeyserConnection.java | 35 --- .../geysermc/geyser/api/event/EventBus.java | 43 ---- .../geyser/api/event/EventRegistrar.java | 47 ---- .../geyser/api/event/EventSubscriber.java | 40 ---- .../geyser/api/event/ExtensionEventBus.java | 41 ---- .../api/event/ExtensionEventSubscriber.java | 32 --- .../api/event/connection/ConnectionEvent.java | 51 ----- .../downstream/ServerDefineCommandsEvent.java | 85 ------- .../lifecycle/GeyserDefineCommandsEvent.java | 57 ----- .../GeyserDefineCustomItemsEvent.java | 76 ------- .../GeyserLoadResourcePacksEvent.java | 40 ---- .../lifecycle/GeyserPostInitializeEvent.java | 41 ---- .../lifecycle/GeyserPreInitializeEvent.java | 41 ---- .../event/lifecycle/GeyserShutdownEvent.java | 38 ---- .../geyser/api/extension/Extension.java | 139 ----------- .../api/extension/ExtensionDescription.java | 106 --------- .../geyser/api/extension/ExtensionLoader.java | 105 --------- .../geyser/api/extension/ExtensionLogger.java | 94 -------- .../api/extension/ExtensionManager.java | 90 -------- .../InvalidDescriptionException.java | 43 ---- .../exception/InvalidExtensionException.java | 43 ---- .../api/item/custom/CustomItemData.java | 109 --------- .../api/item/custom/CustomItemOptions.java | 83 ------- .../api/item/custom/CustomRenderOffsets.java | 51 ----- .../item/custom/NonVanillaCustomItemData.java | 188 --------------- .../geysermc/geyser/api/network/AuthType.java | 61 ----- .../geyser/api/network/BedrockListener.java | 77 ------- .../geyser/api/network/RemoteServer.java | 70 ------ .../geysermc/geyser/api/util/TriState.java | 83 ------- build.gradle.kts | 18 +- core/build.gradle.kts | 2 +- .../protocol/java/JavaCommandsTranslator.java | 19 +- gradle/libs.versions.toml | 23 +- settings.gradle.kts | 4 - 46 files changed, 33 insertions(+), 3036 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 delete mode 100644 api/geyser/build.gradle.kts delete mode 100644 api/geyser/src/main/java/org/geysermc/geyser/api/GeyserApi.java delete mode 100644 api/geyser/src/main/java/org/geysermc/geyser/api/command/Command.java delete mode 100644 api/geyser/src/main/java/org/geysermc/geyser/api/command/CommandExecutor.java delete mode 100644 api/geyser/src/main/java/org/geysermc/geyser/api/command/CommandSource.java delete mode 100644 api/geyser/src/main/java/org/geysermc/geyser/api/connection/GeyserConnection.java delete mode 100644 api/geyser/src/main/java/org/geysermc/geyser/api/event/EventBus.java delete mode 100644 api/geyser/src/main/java/org/geysermc/geyser/api/event/EventRegistrar.java delete mode 100644 api/geyser/src/main/java/org/geysermc/geyser/api/event/EventSubscriber.java delete mode 100644 api/geyser/src/main/java/org/geysermc/geyser/api/event/ExtensionEventBus.java delete mode 100644 api/geyser/src/main/java/org/geysermc/geyser/api/event/ExtensionEventSubscriber.java delete mode 100644 api/geyser/src/main/java/org/geysermc/geyser/api/event/connection/ConnectionEvent.java delete mode 100644 api/geyser/src/main/java/org/geysermc/geyser/api/event/downstream/ServerDefineCommandsEvent.java delete mode 100644 api/geyser/src/main/java/org/geysermc/geyser/api/event/lifecycle/GeyserDefineCommandsEvent.java delete mode 100644 api/geyser/src/main/java/org/geysermc/geyser/api/event/lifecycle/GeyserDefineCustomItemsEvent.java delete mode 100644 api/geyser/src/main/java/org/geysermc/geyser/api/event/lifecycle/GeyserLoadResourcePacksEvent.java delete mode 100644 api/geyser/src/main/java/org/geysermc/geyser/api/event/lifecycle/GeyserPostInitializeEvent.java delete mode 100644 api/geyser/src/main/java/org/geysermc/geyser/api/event/lifecycle/GeyserPreInitializeEvent.java delete mode 100644 api/geyser/src/main/java/org/geysermc/geyser/api/event/lifecycle/GeyserShutdownEvent.java delete mode 100644 api/geyser/src/main/java/org/geysermc/geyser/api/extension/Extension.java delete mode 100644 api/geyser/src/main/java/org/geysermc/geyser/api/extension/ExtensionDescription.java delete mode 100644 api/geyser/src/main/java/org/geysermc/geyser/api/extension/ExtensionLoader.java delete mode 100644 api/geyser/src/main/java/org/geysermc/geyser/api/extension/ExtensionLogger.java delete mode 100644 api/geyser/src/main/java/org/geysermc/geyser/api/extension/ExtensionManager.java delete mode 100644 api/geyser/src/main/java/org/geysermc/geyser/api/extension/exception/InvalidDescriptionException.java delete mode 100644 api/geyser/src/main/java/org/geysermc/geyser/api/extension/exception/InvalidExtensionException.java delete mode 100644 api/geyser/src/main/java/org/geysermc/geyser/api/item/custom/CustomItemData.java delete mode 100644 api/geyser/src/main/java/org/geysermc/geyser/api/item/custom/CustomItemOptions.java delete mode 100644 api/geyser/src/main/java/org/geysermc/geyser/api/item/custom/CustomRenderOffsets.java delete mode 100644 api/geyser/src/main/java/org/geysermc/geyser/api/item/custom/NonVanillaCustomItemData.java delete mode 100644 api/geyser/src/main/java/org/geysermc/geyser/api/network/AuthType.java delete mode 100644 api/geyser/src/main/java/org/geysermc/geyser/api/network/BedrockListener.java delete mode 100644 api/geyser/src/main/java/org/geysermc/geyser/api/network/RemoteServer.java delete mode 100644 api/geyser/src/main/java/org/geysermc/geyser/api/util/TriState.java 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/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/geyser/src/main/java/org/geysermc/geyser/api/GeyserApi.java deleted file mode 100644 index f86206d36..000000000 --- a/api/geyser/src/main/java/org/geysermc/geyser/api/GeyserApi.java +++ /dev/null @@ -1,119 +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.geyser.api; - -import org.checkerframework.checker.nullness.qual.NonNull; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.geysermc.api.Geyser; -import org.geysermc.api.GeyserApiBase; -import org.geysermc.geyser.api.connection.GeyserConnection; -import org.geysermc.geyser.api.event.EventBus; -import org.geysermc.geyser.api.event.EventRegistrar; -import org.geysermc.geyser.api.extension.ExtensionManager; -import org.geysermc.geyser.api.network.BedrockListener; -import org.geysermc.geyser.api.network.RemoteServer; - -import java.util.List; -import java.util.UUID; - -/** - * Represents the API used in Geyser. - */ -public interface GeyserApi extends GeyserApiBase { - /** - * {@inheritDoc} - */ - @Override - @Nullable GeyserConnection connectionByUuid(@NonNull UUID uuid); - - /** - * {@inheritDoc} - */ - @Override - @Nullable GeyserConnection connectionByXuid(@NonNull String xuid); - - /** - * {@inheritDoc} - */ - @NonNull - List onlineConnections(); - - /** - * Gets the {@link ExtensionManager}. - * - * @return the extension manager - */ - @NonNull - ExtensionManager extensionManager(); - - /** - * Provides an implementation for the specified API type. - * - * @param apiClass the builder class - * @param the implementation type - * @param the API type - * @return the builder instance - */ - @NonNull - R provider(@NonNull Class apiClass, @Nullable Object... args); - - /** - * Gets the {@link EventBus} for handling - * Geyser events. - * - * @return the event bus - */ - @NonNull - EventBus eventBus(); - - /** - * Gets the default {@link RemoteServer} configured - * within the config file that is used by default. - * - * @return the default remote server used within Geyser - */ - @NonNull - RemoteServer defaultRemoteServer(); - - /** - * Gets the {@link BedrockListener} used for listening - * for Minecraft: Bedrock Edition client connections. - * - * @return the listener used for Bedrock client connectins - */ - @NonNull - BedrockListener bedrockListener(); - - /** - * Gets the current {@link GeyserApiBase} instance. - * - * @return the current geyser api instance - */ - @NonNull - static GeyserApi api() { - return Geyser.api(GeyserApi.class); - } -} diff --git a/api/geyser/src/main/java/org/geysermc/geyser/api/command/Command.java b/api/geyser/src/main/java/org/geysermc/geyser/api/command/Command.java deleted file mode 100644 index 2f1f2b24d..000000000 --- a/api/geyser/src/main/java/org/geysermc/geyser/api/command/Command.java +++ /dev/null @@ -1,215 +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.geyser.api.command; - -import org.checkerframework.checker.nullness.qual.NonNull; -import org.geysermc.geyser.api.GeyserApi; -import org.geysermc.geyser.api.connection.GeyserConnection; -import org.geysermc.geyser.api.extension.Extension; - -import java.util.Collections; -import java.util.List; - -/** - * Represents a command. - */ -public interface Command { - - /** - * Gets the command name. - * - * @return the command name - */ - @NonNull - String name(); - - /** - * Gets the command description. - * - * @return the command description - */ - @NonNull - String description(); - - /** - * Gets the permission node associated with - * this command. - * - * @return the permission node for this command - */ - @NonNull - String permission(); - - /** - * Gets the aliases for this command. - * - * @return the aliases for this command - */ - @NonNull - List aliases(); - - /** - * Gets if this command is designed to be used only by server operators. - * - * @return if this command is designated to be used only by server operators. - */ - boolean isSuggestedOpOnly(); - - /** - * Gets if this command is executable on console. - * - * @return if this command is executable on console - */ - boolean isExecutableOnConsole(); - - /** - * Gets the subcommands associated with this - * command. Mainly used within the Geyser Standalone - * GUI to know what subcommands are supported. - * - * @return the subcommands associated with this command - */ - @NonNull - default List subCommands() { - return Collections.emptyList(); - } - - /** - * Used to send a deny message to Java players if this command can only be used by Bedrock players. - * - * @return true if this command can only be used by Bedrock players. - */ - default boolean isBedrockOnly() { - return false; - } - - /** - * Creates a new {@link Command.Builder} used to construct commands. - * - * @param extension the extension - * @param the source type - * @return a new command builder used to construct commands - */ - static Command.Builder builder(@NonNull Extension extension) { - return GeyserApi.api().provider(Builder.class, extension); - } - - interface Builder { - - /** - * Defines the source type to use for this command. - *

- * Command source types can be anything that extend - * {@link CommandSource}, such as {@link GeyserConnection}. - * This will guarantee that the source used in the executor - * is an instance of this source. - * - * @param sourceType the source type - * @return the builder - */ - Builder source(@NonNull Class sourceType); - - /** - * Sets the command name. - * - * @param name the command name - * @return the builder - */ - Builder name(@NonNull String name); - - /** - * Sets the command description. - * - * @param description the command description - * @return the builder - */ - Builder description(@NonNull String description); - - /** - * Sets the permission node. - * - * @param permission the permission node - * @return the builder - */ - Builder permission(@NonNull String permission); - - /** - * Sets the aliases. - * - * @param aliases the aliases - * @return the builder - */ - Builder aliases(@NonNull List aliases); - - /** - * Sets if this command is designed to be used only by server operators. - * - * @param suggestedOpOnly if this command is designed to be used only by server operators - * @return the builder - */ - Builder suggestedOpOnly(boolean suggestedOpOnly); - - /** - * Sets if this command is executable on console. - * - * @param executableOnConsole if this command is executable on console - * @return the builder - */ - Builder executableOnConsole(boolean executableOnConsole); - - /** - * Sets the subcommands. - * - * @param subCommands the subcommands - * @return the builder - */ - Builder subCommands(@NonNull List subCommands); - - /** - * Sets if this command is bedrock only. - * - * @param bedrockOnly if this command is bedrock only - * @return the builder - */ - Builder bedrockOnly(boolean bedrockOnly); - - /** - * Sets the {@link CommandExecutor} for this command. - * - * @param executor the command executor - * @return the builder - */ - Builder executor(@NonNull CommandExecutor executor); - - /** - * Builds the command. - * - * @return the command - */ - @NonNull - Command build(); - } -} diff --git a/api/geyser/src/main/java/org/geysermc/geyser/api/command/CommandExecutor.java b/api/geyser/src/main/java/org/geysermc/geyser/api/command/CommandExecutor.java deleted file mode 100644 index 12a54ee90..000000000 --- a/api/geyser/src/main/java/org/geysermc/geyser/api/command/CommandExecutor.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.geyser.api.command; - -import org.checkerframework.checker.nullness.qual.NonNull; - -/** - * Handles executing a command. - * - * @param the command source - */ -public interface CommandExecutor { - /** - * Executes the given {@link Command} with the given - * {@link CommandSource}. - * - * @param source the command source - * @param command the command - * @param args the arguments - */ - void execute(@NonNull T source, @NonNull Command command, @NonNull String[] args); -} diff --git a/api/geyser/src/main/java/org/geysermc/geyser/api/command/CommandSource.java b/api/geyser/src/main/java/org/geysermc/geyser/api/command/CommandSource.java deleted file mode 100644 index 45276e2c4..000000000 --- a/api/geyser/src/main/java/org/geysermc/geyser/api/command/CommandSource.java +++ /dev/null @@ -1,81 +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.geyser.api.command; - -import org.checkerframework.checker.nullness.qual.NonNull; - -/** - * Represents an instance capable of sending commands. - */ -public interface CommandSource { - - /** - * The name of the command source. - * - * @return the name of the command source - */ - String name(); - - /** - * Sends the given message to the command source - * - * @param message the message to send - */ - void sendMessage(@NonNull String message); - - /** - * Sends the given messages to the command source - * - * @param messages the messages to send - */ - default void sendMessage(String[] messages) { - for (String message : messages) { - sendMessage(message); - } - } - - /** - * If this source is the console. - * - * @return true if this source is the console - */ - boolean isConsole(); - - /** - * Returns the locale of the command source. - * - * @return the locale of the command source. - */ - String locale(); - - /** - * Checks if this command source has the given permission - * - * @param permission The permission node to check - * @return true if this command source has a permission - */ - boolean hasPermission(String permission); -} diff --git a/api/geyser/src/main/java/org/geysermc/geyser/api/connection/GeyserConnection.java b/api/geyser/src/main/java/org/geysermc/geyser/api/connection/GeyserConnection.java deleted file mode 100644 index 13fd60407..000000000 --- a/api/geyser/src/main/java/org/geysermc/geyser/api/connection/GeyserConnection.java +++ /dev/null @@ -1,35 +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.geyser.api.connection; - -import org.geysermc.api.connection.Connection; -import org.geysermc.geyser.api.command.CommandSource; - -/** - * Represents a player connection used in Geyser. - */ -public interface GeyserConnection extends Connection, CommandSource { -} diff --git a/api/geyser/src/main/java/org/geysermc/geyser/api/event/EventBus.java b/api/geyser/src/main/java/org/geysermc/geyser/api/event/EventBus.java deleted file mode 100644 index 801bfa45f..000000000 --- a/api/geyser/src/main/java/org/geysermc/geyser/api/event/EventBus.java +++ /dev/null @@ -1,43 +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.geyser.api.event; - -import org.checkerframework.checker.nullness.qual.NonNull; -import org.geysermc.event.Event; -import org.geysermc.event.bus.OwnedEventBus; -import org.geysermc.geyser.api.extension.Extension; - -import java.util.Set; - -/** - * Represents a bus capable of subscribing - * or "listening" to events and firing them. - */ -public interface EventBus extends OwnedEventBus> { - @Override - @NonNull - Set> subscribers(@NonNull Class eventClass); -} diff --git a/api/geyser/src/main/java/org/geysermc/geyser/api/event/EventRegistrar.java b/api/geyser/src/main/java/org/geysermc/geyser/api/event/EventRegistrar.java deleted file mode 100644 index 064dd55f6..000000000 --- a/api/geyser/src/main/java/org/geysermc/geyser/api/event/EventRegistrar.java +++ /dev/null @@ -1,47 +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.geyser.api.event; - -import org.checkerframework.checker.nullness.qual.NonNull; -import org.geysermc.geyser.api.GeyserApi; - -/** - * Represents an owner for an event that allows it - * to be registered through an {@link EventBus}. - */ -public interface EventRegistrar { - - /** - * Creates an {@link EventRegistrar} instance. - * - * @param object the object to wrap around - * @return an event registrar instance - */ - @NonNull - static EventRegistrar of(@NonNull Object object) { - return GeyserApi.api().provider(EventRegistrar.class, object); - } -} diff --git a/api/geyser/src/main/java/org/geysermc/geyser/api/event/EventSubscriber.java b/api/geyser/src/main/java/org/geysermc/geyser/api/event/EventSubscriber.java deleted file mode 100644 index 7f91d09a3..000000000 --- a/api/geyser/src/main/java/org/geysermc/geyser/api/event/EventSubscriber.java +++ /dev/null @@ -1,40 +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.geyser.api.event; - -import org.geysermc.event.Event; -import org.geysermc.event.subscribe.OwnedSubscriber; -import org.geysermc.geyser.api.extension.Extension; - -/** - * Represents a subscribed listener to a {@link Event}. Wraps around - * the event and is capable of unsubscribing from the event or give - * information about it. - * - * @param the class of the event - */ -public interface EventSubscriber extends OwnedSubscriber { -} diff --git a/api/geyser/src/main/java/org/geysermc/geyser/api/event/ExtensionEventBus.java b/api/geyser/src/main/java/org/geysermc/geyser/api/event/ExtensionEventBus.java deleted file mode 100644 index a58d35891..000000000 --- a/api/geyser/src/main/java/org/geysermc/geyser/api/event/ExtensionEventBus.java +++ /dev/null @@ -1,41 +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.geyser.api.event; - -import org.checkerframework.checker.nullness.qual.NonNull; -import org.geysermc.event.Event; -import org.geysermc.geyser.api.extension.Extension; - -import java.util.Set; - -/** - * An {@link EventBus} with additional methods that implicitly - * set the extension instance. - */ -public interface ExtensionEventBus extends org.geysermc.event.bus.EventBus> { - @Override - @NonNull Set> subscribers(@NonNull Class eventClass); -} diff --git a/api/geyser/src/main/java/org/geysermc/geyser/api/event/ExtensionEventSubscriber.java b/api/geyser/src/main/java/org/geysermc/geyser/api/event/ExtensionEventSubscriber.java deleted file mode 100644 index 9c5fffa2f..000000000 --- a/api/geyser/src/main/java/org/geysermc/geyser/api/event/ExtensionEventSubscriber.java +++ /dev/null @@ -1,32 +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.geyser.api.event; - -import org.geysermc.event.Event; -import org.geysermc.event.subscribe.Subscriber; - -public interface ExtensionEventSubscriber extends Subscriber { -} diff --git a/api/geyser/src/main/java/org/geysermc/geyser/api/event/connection/ConnectionEvent.java b/api/geyser/src/main/java/org/geysermc/geyser/api/event/connection/ConnectionEvent.java deleted file mode 100644 index 158f14d53..000000000 --- a/api/geyser/src/main/java/org/geysermc/geyser/api/event/connection/ConnectionEvent.java +++ /dev/null @@ -1,51 +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.geyser.api.event.connection; - -import org.checkerframework.checker.nullness.qual.NonNull; -import org.geysermc.event.Event; -import org.geysermc.geyser.api.connection.GeyserConnection; - -/** - * An event that contains a {@link GeyserConnection}. - */ -public abstract class ConnectionEvent implements Event { - private final GeyserConnection connection; - - public ConnectionEvent(@NonNull GeyserConnection connection) { - this.connection = connection; - } - - /** - * Gets the {@link GeyserConnection}. - * - * @return the connection - */ - @NonNull - public GeyserConnection connection() { - return this.connection; - } -} diff --git a/api/geyser/src/main/java/org/geysermc/geyser/api/event/downstream/ServerDefineCommandsEvent.java b/api/geyser/src/main/java/org/geysermc/geyser/api/event/downstream/ServerDefineCommandsEvent.java deleted file mode 100644 index e46492b36..000000000 --- a/api/geyser/src/main/java/org/geysermc/geyser/api/event/downstream/ServerDefineCommandsEvent.java +++ /dev/null @@ -1,85 +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.geyser.api.event.downstream; - -import org.checkerframework.checker.nullness.qual.NonNull; -import org.geysermc.event.Cancellable; -import org.geysermc.geyser.api.connection.GeyserConnection; -import org.geysermc.geyser.api.event.connection.ConnectionEvent; - -import java.util.Set; - -/** - * Called when the Java server defines the commands available on the server. - *
- * This event is mapped to the existence of Brigadier on the server. - */ -public class ServerDefineCommandsEvent extends ConnectionEvent implements Cancellable { - private final Set commands; - private boolean cancelled; - - public ServerDefineCommandsEvent(@NonNull GeyserConnection connection, @NonNull Set commands) { - super(connection); - this.commands = commands; - } - - /** - * A collection of commands sent from the server. Any element in this collection can be removed, but no element can - * be added. - * - * @return a collection of the commands sent over - */ - @NonNull - public Set commands() { - return this.commands; - } - - @Override - public boolean isCancelled() { - return this.cancelled; - } - - @Override - public void setCancelled(boolean cancelled) { - this.cancelled = cancelled; - } - - public interface CommandInfo { - /** - * Gets the name of the command. - * - * @return the name of the command - */ - String name(); - - /** - * Gets the description of the command. - * - * @return the description of the command - */ - String description(); - } -} diff --git a/api/geyser/src/main/java/org/geysermc/geyser/api/event/lifecycle/GeyserDefineCommandsEvent.java b/api/geyser/src/main/java/org/geysermc/geyser/api/event/lifecycle/GeyserDefineCommandsEvent.java deleted file mode 100644 index 77d5efa65..000000000 --- a/api/geyser/src/main/java/org/geysermc/geyser/api/event/lifecycle/GeyserDefineCommandsEvent.java +++ /dev/null @@ -1,57 +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.geyser.api.event.lifecycle; - -import org.checkerframework.checker.nullness.qual.NonNull; -import org.geysermc.event.Event; -import org.geysermc.geyser.api.command.Command; - -import java.util.Map; - -/** - * Called when commands are defined within Geyser. - * - * This event allows you to register new commands using the {@link #register(Command)} - * method and retrieve the default commands defined. - */ -public interface GeyserDefineCommandsEvent extends Event { - - /** - * Registers the given {@link Command} into the Geyser - * command manager. - * - * @param command the command to register - */ - void register(@NonNull Command command); - - /** - * Gets all the registered built-in {@link Command}s. - * - * @return all the registered built-in commands - */ - @NonNull - Map commands(); -} diff --git a/api/geyser/src/main/java/org/geysermc/geyser/api/event/lifecycle/GeyserDefineCustomItemsEvent.java b/api/geyser/src/main/java/org/geysermc/geyser/api/event/lifecycle/GeyserDefineCustomItemsEvent.java deleted file mode 100644 index 0957b8551..000000000 --- a/api/geyser/src/main/java/org/geysermc/geyser/api/event/lifecycle/GeyserDefineCustomItemsEvent.java +++ /dev/null @@ -1,76 +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.geyser.api.event.lifecycle; - -import org.checkerframework.checker.nullness.qual.NonNull; -import org.geysermc.event.Event; -import org.geysermc.geyser.api.item.custom.CustomItemData; -import org.geysermc.geyser.api.item.custom.NonVanillaCustomItemData; - -import java.util.Collection; -import java.util.List; -import java.util.Map; - -/** - * Called on Geyser's startup when looking for custom items. Custom items must be registered through this event. - * - * This event will not be called if the "add non-Bedrock items" setting is disabled in the Geyser config. - */ -public interface GeyserDefineCustomItemsEvent extends Event { - /** - * Gets a multimap of all the already registered custom items indexed by the item's extended java item's identifier. - * - * @return a multimap of all the already registered custom items - */ - @NonNull - Map> getExistingCustomItems(); - - /** - * Gets the list of the already registered non-vanilla custom items. - * - * @return the list of the already registered non-vanilla custom items - */ - @NonNull - List getExistingNonVanillaCustomItems(); - - /** - * Registers a custom item with a base Java item. This is used to register items with custom textures and properties - * based on NBT data. - * - * @param identifier the base (java) item - * @param customItemData the custom item data to register - * @return if the item was registered - */ - boolean register(@NonNull String identifier, @NonNull CustomItemData customItemData); - - /** - * Registers a custom item with no base item. This is used for mods. - * - * @param customItemData the custom item data to register - * @return if the item was registered - */ - boolean register(@NonNull NonVanillaCustomItemData customItemData); -} \ No newline at end of file diff --git a/api/geyser/src/main/java/org/geysermc/geyser/api/event/lifecycle/GeyserLoadResourcePacksEvent.java b/api/geyser/src/main/java/org/geysermc/geyser/api/event/lifecycle/GeyserLoadResourcePacksEvent.java deleted file mode 100644 index e9b283ecb..000000000 --- a/api/geyser/src/main/java/org/geysermc/geyser/api/event/lifecycle/GeyserLoadResourcePacksEvent.java +++ /dev/null @@ -1,40 +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.geyser.api.event.lifecycle; - -import org.checkerframework.checker.nullness.qual.NonNull; -import org.geysermc.event.Event; - -import java.nio.file.Path; -import java.util.List; - -/** - * Called when resource packs are loaded within Geyser. - * - * @param resourcePacks a mutable list of the currently listed resource packs - */ -public record GeyserLoadResourcePacksEvent(@NonNull List resourcePacks) implements Event { -} diff --git a/api/geyser/src/main/java/org/geysermc/geyser/api/event/lifecycle/GeyserPostInitializeEvent.java b/api/geyser/src/main/java/org/geysermc/geyser/api/event/lifecycle/GeyserPostInitializeEvent.java deleted file mode 100644 index 8d145f615..000000000 --- a/api/geyser/src/main/java/org/geysermc/geyser/api/event/lifecycle/GeyserPostInitializeEvent.java +++ /dev/null @@ -1,41 +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.geyser.api.event.lifecycle; - -import org.checkerframework.checker.nullness.qual.NonNull; -import org.geysermc.event.Event; -import org.geysermc.geyser.api.event.EventBus; -import org.geysermc.geyser.api.event.EventRegistrar; -import org.geysermc.geyser.api.extension.ExtensionManager; - -/** - * Called when Geyser has completed initializing. - * - * @param extensionManager the extension manager - * @param eventBus the event bus - */ -public record GeyserPostInitializeEvent(@NonNull ExtensionManager extensionManager, @NonNull EventBus eventBus) implements Event { -} diff --git a/api/geyser/src/main/java/org/geysermc/geyser/api/event/lifecycle/GeyserPreInitializeEvent.java b/api/geyser/src/main/java/org/geysermc/geyser/api/event/lifecycle/GeyserPreInitializeEvent.java deleted file mode 100644 index 8be89dafd..000000000 --- a/api/geyser/src/main/java/org/geysermc/geyser/api/event/lifecycle/GeyserPreInitializeEvent.java +++ /dev/null @@ -1,41 +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.geyser.api.event.lifecycle; - -import org.checkerframework.checker.nullness.qual.NonNull; -import org.geysermc.event.Event; -import org.geysermc.geyser.api.event.EventBus; -import org.geysermc.geyser.api.event.EventRegistrar; -import org.geysermc.geyser.api.extension.ExtensionManager; - -/** - * Called when Geyser is starting to initialize. - * - * @param extensionManager the extension manager - * @param eventBus the event bus - */ -public record GeyserPreInitializeEvent(@NonNull ExtensionManager extensionManager, @NonNull EventBus eventBus) implements Event { -} diff --git a/api/geyser/src/main/java/org/geysermc/geyser/api/event/lifecycle/GeyserShutdownEvent.java b/api/geyser/src/main/java/org/geysermc/geyser/api/event/lifecycle/GeyserShutdownEvent.java deleted file mode 100644 index 7793ef997..000000000 --- a/api/geyser/src/main/java/org/geysermc/geyser/api/event/lifecycle/GeyserShutdownEvent.java +++ /dev/null @@ -1,38 +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.geyser.api.event.lifecycle; - -import org.checkerframework.checker.nullness.qual.NonNull; -import org.geysermc.event.Event; -import org.geysermc.geyser.api.event.EventBus; -import org.geysermc.geyser.api.event.EventRegistrar; -import org.geysermc.geyser.api.extension.ExtensionManager; - -/** - * Called when Geyser is shutting down. - */ -public record GeyserShutdownEvent(@NonNull ExtensionManager extensionManager, @NonNull EventBus eventBus) implements Event { -} diff --git a/api/geyser/src/main/java/org/geysermc/geyser/api/extension/Extension.java b/api/geyser/src/main/java/org/geysermc/geyser/api/extension/Extension.java deleted file mode 100644 index 33fc159de..000000000 --- a/api/geyser/src/main/java/org/geysermc/geyser/api/extension/Extension.java +++ /dev/null @@ -1,139 +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.geyser.api.extension; - -import org.checkerframework.checker.nullness.qual.NonNull; -import org.geysermc.api.GeyserApiBase; -import org.geysermc.geyser.api.GeyserApi; -import org.geysermc.geyser.api.event.EventRegistrar; -import org.geysermc.geyser.api.event.ExtensionEventBus; - -import java.nio.file.Path; -import java.util.Objects; - -/** - * Represents an extension within Geyser. - */ -public interface Extension extends EventRegistrar { - - /** - * Gets if the extension is enabled - * - * @return true if the extension is enabled - */ - default boolean isEnabled() { - return this.extensionLoader().isEnabled(this); - } - - /** - * Enables or disables the extension - * - * @param enabled if the extension should be enabled - */ - default void setEnabled(boolean enabled) { - this.extensionLoader().setEnabled(this, enabled); - } - - /** - * Gets the extension's data folder - * - * @return the extension's data folder - */ - @NonNull - default Path dataFolder() { - return this.extensionLoader().dataFolder(this); - } - - /** - * Gets the {@link ExtensionEventBus}. - * - * @return the extension event bus - */ - @NonNull - default ExtensionEventBus eventBus() { - return this.extensionLoader().eventBus(this); - } - - /** - * Gets the {@link ExtensionManager}. - * - * @return the extension manager - */ - @NonNull - default ExtensionManager extensionManager() { - return this.geyserApi().extensionManager(); - } - - /** - * Gets the extension's name - * - * @return the extension's name - */ - @NonNull - default String name() { - return this.description().name(); - } - - /** - * Gets this extension's {@link ExtensionDescription}. - * - * @return the extension's description - */ - @NonNull - default ExtensionDescription description() { - return this.extensionLoader().description(this); - } - - /** - * Gets the extension's logger - * - * @return the extension's logger - */ - @NonNull - default ExtensionLogger logger() { - return this.extensionLoader().logger(this); - } - - /** - * Gets the {@link ExtensionLoader}. - * - * @return the extension loader - */ - @NonNull - default ExtensionLoader extensionLoader() { - return Objects.requireNonNull(this.extensionManager().extensionLoader()); - } - - /** - * Gets the {@link GeyserApiBase} instance - * - * @return the geyser api instance - */ - @NonNull - default GeyserApi geyserApi() { - return GeyserApi.api(); - } -} diff --git a/api/geyser/src/main/java/org/geysermc/geyser/api/extension/ExtensionDescription.java b/api/geyser/src/main/java/org/geysermc/geyser/api/extension/ExtensionDescription.java deleted file mode 100644 index 2df3ee815..000000000 --- a/api/geyser/src/main/java/org/geysermc/geyser/api/extension/ExtensionDescription.java +++ /dev/null @@ -1,106 +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.geyser.api.extension; - -import org.checkerframework.checker.nullness.qual.NonNull; - -import java.util.List; - -/** - * Represents the description of an {@link Extension}. - */ -public interface ExtensionDescription { - - /** - * Gets the extension's id. - * - * @return the extension's id - */ - @NonNull - String id(); - - /** - * Gets the extension's name. - * - * @return the extension's name - */ - @NonNull - String name(); - - /** - * Gets the extension's main class. - * - * @return the extension's main class - */ - @NonNull - String main(); - - /** - * Gets the extension's major api version - * - * @return the extension's major api version - */ - int majorApiVersion(); - - /** - * Gets the extension's minor api version - * - * @return the extension's minor api version - */ - int minorApiVersion(); - - /** - * Gets the extension's patch api version - * - * @return the extension's patch api version - */ - int patchApiVersion(); - - /** - * Gets the extension's api version. - * - * @return the extension's api version - */ - default String apiVersion() { - return majorApiVersion() + "." + minorApiVersion() + "." + patchApiVersion(); - } - - /** - * Gets the extension's description. - * - * @return the extension's description - */ - @NonNull - String version(); - - /** - * Gets the extension's authors. - * - * @return the extension's authors - */ - @NonNull - List authors(); -} diff --git a/api/geyser/src/main/java/org/geysermc/geyser/api/extension/ExtensionLoader.java b/api/geyser/src/main/java/org/geysermc/geyser/api/extension/ExtensionLoader.java deleted file mode 100644 index 30414d500..000000000 --- a/api/geyser/src/main/java/org/geysermc/geyser/api/extension/ExtensionLoader.java +++ /dev/null @@ -1,105 +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.geyser.api.extension; - -import org.checkerframework.checker.nullness.qual.NonNull; -import org.geysermc.geyser.api.event.ExtensionEventBus; - -import java.nio.file.Path; - -/** - * The extension loader is responsible for loading, unloading, enabling and disabling extensions - */ -public abstract class ExtensionLoader { - /** - * Gets if the given {@link Extension} is enabled. - * - * @param extension the extension - * @return if the extension is enabled - */ - protected abstract boolean isEnabled(@NonNull Extension extension); - - /** - * Sets if the given {@link Extension} is enabled. - * - * @param extension the extension to enable - * @param enabled if the extension should be enabled - */ - protected abstract void setEnabled(@NonNull Extension extension, boolean enabled); - - /** - * Gets the given {@link Extension}'s data folder. - * - * @param extension the extension - * @return the data folder of the given extension - */ - @NonNull - protected abstract Path dataFolder(@NonNull Extension extension); - - /** - * Gets the given {@link Extension}'s {@link ExtensionDescription}. - * - * @param extension the extension - * @return the description of the given extension - */ - @NonNull - protected abstract ExtensionDescription description(@NonNull Extension extension); - - /** - * Gets the given {@link Extension}'s {@link ExtensionEventBus}. - * - * @param extension the extension - * @return the extension's event bus - */ - @NonNull - protected abstract ExtensionEventBus eventBus(@NonNull Extension extension); - - /** - * Gets the {@link ExtensionLogger} for the given {@link Extension}. - * - * @param extension the extension - * @return the extension logger for the given extension - */ - @NonNull - protected abstract ExtensionLogger logger(@NonNull Extension extension); - - /** - * Loads all extensions. - * - * @param extensionManager the extension manager - */ - protected abstract void loadAllExtensions(@NonNull ExtensionManager extensionManager); - - /** - * Registers the given {@link Extension} with the given {@link ExtensionManager}. - * - * @param extension the extension - * @param extensionManager the extension manager - */ - protected void register(@NonNull Extension extension, @NonNull ExtensionManager extensionManager) { - extensionManager.register(extension); - } -} \ No newline at end of file diff --git a/api/geyser/src/main/java/org/geysermc/geyser/api/extension/ExtensionLogger.java b/api/geyser/src/main/java/org/geysermc/geyser/api/extension/ExtensionLogger.java deleted file mode 100644 index 17e108455..000000000 --- a/api/geyser/src/main/java/org/geysermc/geyser/api/extension/ExtensionLogger.java +++ /dev/null @@ -1,94 +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.geyser.api.extension; - -/** - * This is the Geyser extension logger - */ -public interface ExtensionLogger { - /** - * Get the logger prefix - * - * @return the logger prefix - */ - String prefix(); - - /** - * Logs a severe message to console - * - * @param message the message to log - */ - void severe(String message); - - /** - * Logs a severe message and an exception to console - * - * @param message the message to log - * @param error the error to throw - */ - void severe(String message, Throwable error); - - /** - * Logs an error message to console - * - * @param message the message to log - */ - void error(String message); - - /** - * Logs an error message and an exception to console - * - * @param message the message to log - * @param error the error to throw - */ - void error(String message, Throwable error); - - /** - * Logs a warning message to console - * - * @param message the message to log - */ - void warning(String message); - - /** - * Logs an info message to console - * - * @param message the message to log - */ - void info(String message); - - /** - * Logs a debug message to console - * - * @param message the message to log - */ - void debug(String message); - - /** - * If debug is enabled for this logger - */ - boolean isDebug(); -} diff --git a/api/geyser/src/main/java/org/geysermc/geyser/api/extension/ExtensionManager.java b/api/geyser/src/main/java/org/geysermc/geyser/api/extension/ExtensionManager.java deleted file mode 100644 index a9d0d7376..000000000 --- a/api/geyser/src/main/java/org/geysermc/geyser/api/extension/ExtensionManager.java +++ /dev/null @@ -1,90 +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.geyser.api.extension; - -import org.checkerframework.checker.nullness.qual.NonNull; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Collection; - -/** - * Manages Geyser {@link Extension}s - */ -public abstract class ExtensionManager { - - /** - * Gets an extension with the given name. - * - * @param name the name of the extension - * @return an extension with the given name - */ - @Nullable - public abstract Extension extension(@NonNull String name); - - /** - * Enables the given {@link Extension}. - * - * @param extension the extension to enable - */ - public abstract void enable(@NonNull Extension extension); - - /** - * Disables the given {@link Extension}. - * - * @param extension the extension to disable - */ - public abstract void disable(@NonNull Extension extension); - - /** - * Gets all the {@link Extension}s currently loaded. - * - * @return all the extensions currently loaded - */ - @NonNull - public abstract Collection extensions(); - - /** - * Gets the {@link ExtensionLoader}. - * - * @return the extension loader - */ - @Nullable - public abstract ExtensionLoader extensionLoader(); - - /** - * Registers an {@link Extension} with the given {@link ExtensionLoader}. - * - * @param extension the extension - */ - public abstract void register(@NonNull Extension extension); - - /** - * Loads all extensions from the given {@link ExtensionLoader}. - */ - protected final void loadAllExtensions(@NonNull ExtensionLoader extensionLoader) { - extensionLoader.loadAllExtensions(this); - } -} diff --git a/api/geyser/src/main/java/org/geysermc/geyser/api/extension/exception/InvalidDescriptionException.java b/api/geyser/src/main/java/org/geysermc/geyser/api/extension/exception/InvalidDescriptionException.java deleted file mode 100644 index 1fe88e9e9..000000000 --- a/api/geyser/src/main/java/org/geysermc/geyser/api/extension/exception/InvalidDescriptionException.java +++ /dev/null @@ -1,43 +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.geyser.api.extension.exception; - -/** - * Thrown when an extension's description is invalid. - */ -public class InvalidDescriptionException extends Exception { - public InvalidDescriptionException(Throwable cause) { - super(cause); - } - - public InvalidDescriptionException(String message) { - super(message); - } - - public InvalidDescriptionException(String message, Throwable cause) { - super(message, cause); - } -} diff --git a/api/geyser/src/main/java/org/geysermc/geyser/api/extension/exception/InvalidExtensionException.java b/api/geyser/src/main/java/org/geysermc/geyser/api/extension/exception/InvalidExtensionException.java deleted file mode 100644 index 7fb6b6922..000000000 --- a/api/geyser/src/main/java/org/geysermc/geyser/api/extension/exception/InvalidExtensionException.java +++ /dev/null @@ -1,43 +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.geyser.api.extension.exception; - -/** - * Thrown when an extension is invalid. - */ -public class InvalidExtensionException extends Exception { - public InvalidExtensionException(Throwable cause) { - super(cause); - } - - public InvalidExtensionException(String message) { - super(message); - } - - public InvalidExtensionException(String message, Throwable cause) { - super(message, cause); - } -} diff --git a/api/geyser/src/main/java/org/geysermc/geyser/api/item/custom/CustomItemData.java b/api/geyser/src/main/java/org/geysermc/geyser/api/item/custom/CustomItemData.java deleted file mode 100644 index 17763fb77..000000000 --- a/api/geyser/src/main/java/org/geysermc/geyser/api/item/custom/CustomItemData.java +++ /dev/null @@ -1,109 +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.geyser.api.item.custom; - -import org.checkerframework.checker.nullness.qual.NonNull; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.geysermc.geyser.api.GeyserApi; - -/** - * This is used to store data for a custom item. - */ -public interface CustomItemData { - /** - * Gets the item's name. - * - * @return the item's name - */ - @NonNull String name(); - - /** - * Gets the custom item options of the item. - * - * @return the custom item options of the item. - */ - CustomItemOptions customItemOptions(); - - /** - * Gets the item's display name. By default, this is the item's name. - * - * @return the item's display name - */ - @NonNull String displayName(); - - /** - * Gets the item's icon. By default, this is the item's name. - * - * @return the item's icon - */ - @NonNull String icon(); - - /** - * Gets if the item is allowed to be put into the offhand. - * - * @return true if the item is allowed to be used in the offhand, false otherwise - */ - boolean allowOffhand(); - - /** - * Gets the item's texture size. This is to resize the item if the texture is not 16x16. - * - * @return the item's texture size - */ - int textureSize(); - - /** - * Gets the item's render offsets. If it is null, the item will be rendered normally, with no offsets. - * - * @return the item's render offsets - */ - @Nullable CustomRenderOffsets renderOffsets(); - - static CustomItemData.Builder builder() { - return GeyserApi.api().provider(CustomItemData.Builder.class); - } - - interface Builder { - /** - * Will also set the display name and icon to the provided parameter, if it is currently not set. - */ - Builder name(@NonNull String name); - - Builder customItemOptions(@NonNull CustomItemOptions customItemOptions); - - Builder displayName(@NonNull String displayName); - - Builder icon(@NonNull String icon); - - Builder allowOffhand(boolean allowOffhand); - - Builder textureSize(int textureSize); - - Builder renderOffsets(@Nullable CustomRenderOffsets renderOffsets); - - CustomItemData build(); - } -} diff --git a/api/geyser/src/main/java/org/geysermc/geyser/api/item/custom/CustomItemOptions.java b/api/geyser/src/main/java/org/geysermc/geyser/api/item/custom/CustomItemOptions.java deleted file mode 100644 index ec26a6e37..000000000 --- a/api/geyser/src/main/java/org/geysermc/geyser/api/item/custom/CustomItemOptions.java +++ /dev/null @@ -1,83 +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.geyser.api.item.custom; - -import org.checkerframework.checker.nullness.qual.NonNull; -import org.geysermc.geyser.api.GeyserApi; -import org.geysermc.geyser.api.util.TriState; - -import java.util.OptionalInt; - -/** - * This class represents the different ways you can register custom items - */ -public interface CustomItemOptions { - /** - * Gets if the item should be unbreakable. - * - * @return if the item should be unbreakable - */ - @NonNull TriState unbreakable(); - - /** - * Gets the item's custom model data predicate. - * - * @return the item's custom model data - */ - @NonNull OptionalInt customModelData(); - - /** - * Gets the item's damage predicate. - * - * @return the item's damage predicate - */ - @NonNull OptionalInt damagePredicate(); - - /** - * Checks if the item has at least one option set - * - * @return true if the item at least one options set - */ - default boolean hasCustomItemOptions() { - return this.unbreakable() != TriState.NOT_SET || - this.customModelData().isPresent() || - this.damagePredicate().isPresent(); - } - - static CustomItemOptions.Builder builder() { - return GeyserApi.api().provider(CustomItemOptions.Builder.class); - } - - interface Builder { - Builder unbreakable(boolean unbreakable); - - Builder customModelData(int customModelData); - - Builder damagePredicate(int damagePredicate); - - CustomItemOptions build(); - } -} diff --git a/api/geyser/src/main/java/org/geysermc/geyser/api/item/custom/CustomRenderOffsets.java b/api/geyser/src/main/java/org/geysermc/geyser/api/item/custom/CustomRenderOffsets.java deleted file mode 100644 index f81da0ae2..000000000 --- a/api/geyser/src/main/java/org/geysermc/geyser/api/item/custom/CustomRenderOffsets.java +++ /dev/null @@ -1,51 +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.geyser.api.item.custom; - -import org.checkerframework.checker.nullness.qual.Nullable; - -/** - * This class is used to store the render offsets of custom items. - */ -public record CustomRenderOffsets(@Nullable Hand mainHand, @Nullable Hand offhand) { - /** - * The hand that is used for the offset. - */ - public record Hand(@Nullable Offset firstPerson, @Nullable Offset thirdPerson) { - } - - /** - * The offset of the item. - */ - public record Offset(@Nullable OffsetXYZ position, @Nullable OffsetXYZ rotation, @Nullable OffsetXYZ scale) { - } - - /** - * X, Y and Z positions for the offset. - */ - public record OffsetXYZ(float x, float y, float z) { - } -} diff --git a/api/geyser/src/main/java/org/geysermc/geyser/api/item/custom/NonVanillaCustomItemData.java b/api/geyser/src/main/java/org/geysermc/geyser/api/item/custom/NonVanillaCustomItemData.java deleted file mode 100644 index d2cef637a..000000000 --- a/api/geyser/src/main/java/org/geysermc/geyser/api/item/custom/NonVanillaCustomItemData.java +++ /dev/null @@ -1,188 +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.geyser.api.item.custom; - -import org.checkerframework.checker.index.qual.NonNegative; -import org.checkerframework.checker.nullness.qual.NonNull; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.geysermc.geyser.api.GeyserApi; - -import java.util.OptionalInt; -import java.util.Set; - -/** - * Represents a completely custom item that is not based on an existing vanilla Minecraft item. - */ -public interface NonVanillaCustomItemData extends CustomItemData { - /** - * Gets the java identifier for this item. - * - * @return The java identifier for this item. - */ - @NonNull String identifier(); - - /** - * Gets the java item id of the item. - * - * @return the java item id of the item - */ - @NonNegative int javaId(); - - /** - * Gets the stack size of the item. - * - * @return the stack size of the item - */ - @NonNegative int stackSize(); - - /** - * Gets the max damage of the item. - * - * @return the max damage of the item - */ - int maxDamage(); - - /** - * Gets the tool type of the item. - * - * @return the tool type of the item - */ - @Nullable String toolType(); - - /** - * Gets the tool tier of the item. - * - * @return the tool tier of the item - */ - @Nullable String toolTier(); - - /** - * Gets the armor type of the item. - * - * @return the armor type of the item - */ - @Nullable String armorType(); - - /** - * Gets the armor protection value of the item. - * - * @return the armor protection value of the item - */ - int protectionValue(); - - /** - * Gets the item's translation string. - * - * @return the item's translation string - */ - @Nullable String translationString(); - - /** - * Gets the repair materials of the item. - * - * @return the repair materials of the item - */ - @Nullable Set repairMaterials(); - - /** - * Gets the item's creative category, or tab id. - * - * @return the item's creative category - */ - @NonNull OptionalInt creativeCategory(); - - /** - * Gets the item's creative group. - * - * @return the item's creative group - */ - @Nullable String creativeGroup(); - - /** - * Gets if the item is a hat. This is used to determine if the item should be rendered on the player's head, and - * normally allow the player to equip it. This is not meant for armor. - * - * @return if the item is a hat - */ - boolean isHat(); - - /** - * Gets if the item is a tool. This is used to set the render type of the item, if the item is handheld. - * - * @return if the item is a tool - */ - boolean isTool(); - - static NonVanillaCustomItemData.Builder builder() { - return GeyserApi.api().provider(NonVanillaCustomItemData.Builder.class); - } - - interface Builder extends CustomItemData.Builder { - Builder name(@NonNull String name); - - Builder identifier(@NonNull String identifier); - - Builder javaId(@NonNegative int javaId); - - Builder stackSize(@NonNegative int stackSize); - - Builder maxDamage(int maxDamage); - - Builder toolType(@Nullable String toolType); - - Builder toolTier(@Nullable String toolTier); - - Builder armorType(@Nullable String armorType); - - Builder protectionValue(int protectionValue); - - Builder translationString(@Nullable String translationString); - - Builder repairMaterials(@Nullable Set repairMaterials); - - Builder creativeCategory(int creativeCategory); - - Builder creativeGroup(@Nullable String creativeGroup); - - Builder hat(boolean isHat); - - Builder tool(boolean isTool); - - @Override - Builder displayName(@NonNull String displayName); - - @Override - Builder allowOffhand(boolean allowOffhand); - - @Override - Builder textureSize(int textureSize); - - @Override - Builder renderOffsets(@Nullable CustomRenderOffsets renderOffsets); - - NonVanillaCustomItemData build(); - } -} diff --git a/api/geyser/src/main/java/org/geysermc/geyser/api/network/AuthType.java b/api/geyser/src/main/java/org/geysermc/geyser/api/network/AuthType.java deleted file mode 100644 index 3176f3384..000000000 --- a/api/geyser/src/main/java/org/geysermc/geyser/api/network/AuthType.java +++ /dev/null @@ -1,61 +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.geyser.api.network; - -import java.util.Locale; - -/** - * The authentication types that a Java server can be on connection. - */ -public enum AuthType { - OFFLINE, - ONLINE, - /** - * The internal name for connecting to an online mode server without needing a Java account. The presence of this - * authentication type does not necessarily mean the Floodgate plugin is installed; it only means that this - * authentication type will be attempted. - */ - FLOODGATE; - - private static final AuthType[] VALUES = values(); - - /** - * Convert the AuthType string (from config) to the enum, ONLINE on fail - * - * @param name AuthType string - * - * @return The converted AuthType - */ - public static AuthType getByName(String name) { - String upperCase = name.toUpperCase(Locale.ROOT); - for (AuthType type : VALUES) { - if (type.name().equals(upperCase)) { - return type; - } - } - return ONLINE; - } -} \ No newline at end of file diff --git a/api/geyser/src/main/java/org/geysermc/geyser/api/network/BedrockListener.java b/api/geyser/src/main/java/org/geysermc/geyser/api/network/BedrockListener.java deleted file mode 100644 index 61fe286aa..000000000 --- a/api/geyser/src/main/java/org/geysermc/geyser/api/network/BedrockListener.java +++ /dev/null @@ -1,77 +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.geyser.api.network; - -import org.checkerframework.checker.nullness.qual.NonNull; - -/** - * The listener that handles connections from Minecraft: - * Bedrock Edition. - */ -public interface BedrockListener { - - /** - * Gets the address used for listening for Bedrock - * connections from. - * - * @return the listening address - */ - @NonNull - String address(); - - /** - * Gets the port used for listening for Bedrock - * connections from. - * - * @return the listening port - */ - int port(); - - /** - * Gets the primary MOTD shown to Bedrock players if a ping passthrough setting is not enabled. - *

- * This is the first line that will be displayed. - * - * @return the primary MOTD shown to Bedrock players. - */ - String primaryMotd(); - - /** - * Gets the secondary MOTD shown to Bedrock players if a ping passthrough setting is not enabled. - *

- * This is the second line that will be displayed. - * - * @return the secondary MOTD shown to Bedrock players. - */ - String secondaryMotd(); - - /** - * Gets the server name that is sent to Bedrock clients. - * - * @return the server sent to Bedrock clients - */ - String serverName(); -} diff --git a/api/geyser/src/main/java/org/geysermc/geyser/api/network/RemoteServer.java b/api/geyser/src/main/java/org/geysermc/geyser/api/network/RemoteServer.java deleted file mode 100644 index 8ac5d8a03..000000000 --- a/api/geyser/src/main/java/org/geysermc/geyser/api/network/RemoteServer.java +++ /dev/null @@ -1,70 +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.geyser.api.network; - -import org.checkerframework.checker.nullness.qual.NonNull; - -/** - * Represents the Java server that Geyser is connecting to. - */ -public interface RemoteServer { - - /** - * Gets the IP address of the remote server. - * - * @return the IP address of the remote server - */ - String address(); - - /** - * Gets the port of the remote server. - * - * @return the port of the remote server - */ - int port(); - - /** - * Gets the protocol version of the remote server. - * - * @return the protocol version of the remote server - */ - int protocolVersion(); - - /** - * Gets the Minecraft version of the remote server. - * - * @return the Minecraft version of the remote server - */ - String minecraftVersion(); - - /** - * Gets the {@link AuthType} required by the remote server. - * - * @return the auth type required by the remote server - */ - @NonNull - AuthType authType(); -} diff --git a/api/geyser/src/main/java/org/geysermc/geyser/api/util/TriState.java b/api/geyser/src/main/java/org/geysermc/geyser/api/util/TriState.java deleted file mode 100644 index 457a38e32..000000000 --- a/api/geyser/src/main/java/org/geysermc/geyser/api/util/TriState.java +++ /dev/null @@ -1,83 +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.geyser.api.util; - -import org.checkerframework.checker.nullness.qual.NonNull; -import org.checkerframework.checker.nullness.qual.Nullable; - -/** - * This is a way to represent a boolean, but with a non set value added. - * This class was inspired by adventure's version https://github.com/KyoriPowered/adventure/blob/main/4/api/src/main/java/net/kyori/adventure/util/TriState.java - */ -public enum TriState { - /** - * Describes a value that is not set, null, or not present. - */ - NOT_SET, - - /** - * Describes a true value. - */ - TRUE, - - /** - * Describes a false value. - */ - FALSE; - - /** - * Converts the TriState to a boolean. - * - * @return the boolean value of the TriState - */ - public @Nullable Boolean toBoolean() { - return switch (this) { - case TRUE -> true; - case FALSE -> false; - default -> null; - }; - } - - /** - * Creates a TriState from a boolean. - * - * @param value the Boolean value - * @return the created TriState - */ - public static @NonNull TriState fromBoolean(@Nullable Boolean value) { - return value == null ? NOT_SET : fromBoolean(value.booleanValue()); - } - - /** - * Creates a TriState from a primitive boolean. - * - * @param value the boolean value - * @return the created TriState - */ - public @NonNull static TriState fromBoolean(boolean value) { - return value ? TRUE : FALSE; - } -} 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..c9a929bcc 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -7,8 +7,8 @@ plugins { } dependencies { - api(projects.geyserApi) api(projects.common) + api(libs.geyser.api) // Jackson JSON and YAML serialization api(libs.bundles.jackson) diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaCommandsTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaCommandsTranslator.java index 11311b63c..8fd425df4 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaCommandsTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaCommandsTranslator.java @@ -46,7 +46,7 @@ import lombok.ToString; import net.kyori.adventure.text.format.NamedTextColor; import org.checkerframework.checker.nullness.qual.MonotonicNonNull; import org.geysermc.geyser.GeyserImpl; -import org.geysermc.geyser.api.event.downstream.ServerDefineCommandsEvent; +import org.geysermc.geyser.api.event.java.ServerDefineCommandsEvent; import org.geysermc.geyser.command.GeyserCommandManager; import org.geysermc.geyser.inventory.item.Enchantment; import org.geysermc.geyser.registry.BlockRegistries; @@ -150,12 +150,20 @@ public class JavaCommandsTranslator extends PacketTranslator new HashSet<>()).add(node.getName().toLowerCase()); } - ServerDefineCommandsEvent event = new ServerDefineCommandsEvent(session, commands.keySet()); - session.getGeyser().eventBus().fire(event); + var eventBus = session.getGeyser().eventBus(); + + var event = new ServerDefineCommandsEvent(session, commands.keySet()); + eventBus.fire(event); if (event.isCancelled()) { return; } + var oldEvent = new org.geysermc.geyser.api.event.downstream.ServerDefineCommandsEvent(session, commands.keySet()); + eventBus.fire(oldEvent); + if (oldEvent.isCancelled()) { + return; + } + // The command flags, not sure what these do apart from break things List flags = Collections.emptyList(); @@ -258,7 +266,10 @@ public class JavaCommandsTranslator extends PacketTranslator