Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .idea/copyright/Geyser.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/copyright/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions base/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ plugins {

dependencies {
api(libs.checker.qual)
api(libs.jspecify)
api(libs.cumulus)
api(libs.events) {
exclude(group = "com.google.guava", module = "guava")
Expand Down
12 changes: 5 additions & 7 deletions base/src/main/java/org/geysermc/api/Geyser.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
* Copyright (c) 2019-2026 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
Expand All @@ -25,21 +25,19 @@

package org.geysermc.api;

import org.checkerframework.checker.nullness.qual.NonNull;
import org.jspecify.annotations.Nullable;

/**
* General API class for Geyser.
*/
@NonNull
public class Geyser {
private static GeyserApiBase api;
private static @Nullable 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!");
Expand All @@ -56,7 +54,7 @@ public static GeyserApiBase api() {
* @return the api of the given type
*/
@SuppressWarnings("unchecked")
public static <T extends GeyserApiBase> T api(@NonNull Class<T> apiClass) {
public static <T extends GeyserApiBase> T api(Class<T> apiClass) {
if (apiClass.isInstance(api)) {
return (T) api;
}
Expand All @@ -75,7 +73,7 @@ public static <T extends GeyserApiBase> T api(@NonNull Class<T> apiClass) {
*
* @param api the api
*/
public static void set(@NonNull GeyserApiBase api) {
public static void set(GeyserApiBase api) {
if (Geyser.api != null) {
throw new RuntimeException("Cannot redefine already registered api!");
}
Expand Down
20 changes: 8 additions & 12 deletions base/src/main/java/org/geysermc/api/GeyserApiBase.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
* Copyright (c) 2019-2026 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
Expand All @@ -26,13 +26,12 @@
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.api.util.ApiVersion;
import org.geysermc.cumulus.form.Form;
import org.geysermc.cumulus.form.util.FormBuilder;
import org.jspecify.annotations.Nullable;

import java.util.List;
import java.util.UUID;
Expand All @@ -48,25 +47,23 @@ public interface GeyserApiBase {
* @param uuid the UUID of the connection
* @return the connection from the given UUID, if applicable
*/
@Nullable
Connection connectionByUuid(@NonNull UUID uuid);
@Nullable Connection connectionByUuid(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);
@Nullable Connection connectionByXuid(String xuid);

/**
* Method to determine if the given <b>online</b> 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);
boolean isBedrockPlayer(UUID uuid);

/**
* Sends a form to the given connection and opens it.
Expand All @@ -75,7 +72,7 @@ public interface GeyserApiBase {
* @param form the form to send
* @return whether the form was successfully sent
*/
boolean sendForm(@NonNull UUID uuid, @NonNull Form form);
boolean sendForm(UUID uuid, Form form);

/**
* Sends a form to the given connection and opens it.
Expand All @@ -84,7 +81,7 @@ public interface GeyserApiBase {
* @param formBuilder the formBuilder to send
* @return whether the form was successfully sent
*/
boolean sendForm(@NonNull UUID uuid, @NonNull FormBuilder<?, ?, ?> formBuilder);
boolean sendForm(UUID uuid, FormBuilder<?, ?, ?> formBuilder);

/**
* Transfer the given connection to a server. A Bedrock player can successfully transfer to the same server they are
Expand All @@ -95,12 +92,11 @@ public interface GeyserApiBase {
* @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);
boolean transfer(UUID uuid, String address, @IntRange(from = 0, to = 65535) int port);

/**
* Returns all the online connections.
*/
@NonNull
List<? extends Connection> onlineConnections();

/**
Expand Down
23 changes: 11 additions & 12 deletions base/src/main/java/org/geysermc/api/connection/Connection.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
* Copyright (c) 2019-2026 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
Expand All @@ -26,7 +26,6 @@
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;
Expand All @@ -43,7 +42,7 @@ public interface Connection {
/**
* Returns the bedrock name of the connection.
*/
@NonNull String bedrockUsername();
String bedrockUsername();

/**
* Returns the java name of the connection.
Expand All @@ -60,32 +59,32 @@ public interface Connection {
/**
* Returns the XUID of the connection.
*/
@NonNull String xuid();
String xuid();

/**
* Returns the version of the Bedrock client.
*/
@NonNull String version();
String version();

/**
* Returns the platform that the connection is playing on.
*/
@NonNull BedrockPlatform platform();
BedrockPlatform platform();

/**
* Returns the language code of the connection.
*/
@NonNull String languageCode();
String languageCode();

/**
* Returns the User Interface Profile of the connection.
*/
@NonNull UiProfile uiProfile();
UiProfile uiProfile();

/**
* Returns the Input Mode of the Bedrock client.
*/
@NonNull InputMode inputMode();
InputMode inputMode();

/**
* Returns whether the connection is linked.
Expand All @@ -99,15 +98,15 @@ public interface Connection {
* @param form the form to send
* @return whether the form was successfully sent
*/
boolean sendForm(@NonNull Form form);
boolean sendForm(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);
boolean sendForm(FormBuilder<?, ?, ?> formBuilder);

/**
* Transfer the connection to a server. A Bedrock player can successfully transfer to the same server they are
Expand All @@ -117,5 +116,5 @@ public interface Connection {
* @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);
boolean transfer(String address, @IntRange(from = 0, to = 65535) int port);
}
29 changes: 29 additions & 0 deletions base/src/main/java/org/geysermc/api/connection/package-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Copyright (c) 2026 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
*/

@NullMarked
package org.geysermc.api.connection;

import org.jspecify.annotations.NullMarked;
29 changes: 29 additions & 0 deletions base/src/main/java/org/geysermc/api/package-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Copyright (c) 2026 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
*/

@NullMarked
package org.geysermc.api;

import org.jspecify.annotations.NullMarked;
25 changes: 25 additions & 0 deletions base/src/main/java/org/geysermc/api/util/ApiVersion.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
/*
* Copyright (c) 2026 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;

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
* Copyright (c) 2019-2026 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
Expand All @@ -25,8 +25,6 @@

package org.geysermc.api.util;

import org.checkerframework.checker.nullness.qual.NonNull;

public enum BedrockPlatform {
UNKNOWN("Unknown"),
GOOGLE("Android"),
Expand Down Expand Up @@ -62,7 +60,6 @@ public enum BedrockPlatform {
* @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];
}
Expand Down
5 changes: 1 addition & 4 deletions base/src/main/java/org/geysermc/api/util/InputMode.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
* Copyright (c) 2019-2026 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
Expand All @@ -25,8 +25,6 @@

package org.geysermc.api.util;

import org.checkerframework.checker.nullness.qual.NonNull;

public enum InputMode {
UNKNOWN,
KEYBOARD_MOUSE,
Expand All @@ -42,7 +40,6 @@ public enum InputMode {
* @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];
}
Expand Down
Loading