Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
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
10 changes: 4 additions & 6 deletions base/src/main/java/org/geysermc/api/Geyser.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
18 changes: 7 additions & 11 deletions base/src/main/java/org/geysermc/api/GeyserApiBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
21 changes: 10 additions & 11 deletions base/src/main/java/org/geysermc/api/connection/Connection.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@NullMarked
package org.geysermc.api.connection;

import org.jspecify.annotations.NullMarked;
4 changes: 4 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,4 @@
@NullMarked
package org.geysermc.api;

import org.jspecify.annotations.NullMarked;
3 changes: 0 additions & 3 deletions base/src/main/java/org/geysermc/api/util/BedrockPlatform.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 0 additions & 3 deletions base/src/main/java/org/geysermc/api/util/InputMode.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 0 additions & 3 deletions base/src/main/java/org/geysermc/api/util/UiProfile.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@

package org.geysermc.api.util;

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

public enum UiProfile {
CLASSIC, POCKET;

Expand All @@ -38,7 +36,6 @@ public enum UiProfile {
* @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];
}
Expand Down
4 changes: 4 additions & 0 deletions base/src/main/java/org/geysermc/api/util/package-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@NullMarked
package org.geysermc.api.util;

import org.jspecify.annotations.NullMarked;
2 changes: 1 addition & 1 deletion geyser-versioning.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Romantic Versions incorporates the following version scheme: HUMAN.MAJOR.MINOR
- The **MINOR** version represents any additional functionality added in a backward-compatible manner or fix with backward-compatible bug fixes. This could also include deprecations. Minor versions will **always** be backwards compatible with each other.

## API Versions
As Geyser has 2 separate APIs, a core project module, and often sees changes due to both Minecraft Java and Bedrock's own updates which don't necessarily follow a specific versioning sceheme, simply using Semantic Versioning is unrealistic.
As Geyser has 2 separate APIs, a core project module, and often sees changes due to both Minecraft Java and Bedrock's own updates which don't necessarily follow a specific versioning scheme, simply using Semantic Versioning is unrealistic.

To dig a bit deeper into the APIs Geyser has:
- **Base API** is an API that is shaded into both Geyser and Floodgate. It is a shared API that developers can use when they want to create a Geyser project that may only have access to one or the other
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version=1.0.2
version=1.0.3

org.gradle.caching=true
org.gradle.parallel=true
2 changes: 2 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
[versions]
checkerframework = "3.19.0"
jspecify = "1.0.0"
cumulus = "1.1.2"
events = "1.1-SNAPSHOT"
blossom = "2.1.0"
indra = "3.0.1"

[libraries]
checker-qual = { group = "org.checkerframework", name = "checker-qual", version.ref = "checkerframework" }
jspecify = { group = "org.jspecify", name = "jspecify", version.ref = "jspecify" }
cumulus = { group = "org.geysermc.cumulus", name = "cumulus", version.ref = "cumulus" }
events = { group = "org.geysermc.event", name = "events", version.ref = "events" }

Expand Down