Project wide syntax/annotation cleanup (#4238)

Co-authored-by: Konicai <71294714+Konicai@users.noreply.github.com>
This commit is contained in:
chris 2023-12-06 00:54:42 +01:00 committed by GitHub
parent 998caee156
commit 95d65350e4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
270 changed files with 891 additions and 977 deletions

View file

@ -77,6 +77,7 @@ public interface GeyserApi extends GeyserApiBase {
* @param apiClass the builder class
* @param <R> the implementation type
* @param <T> the API type
* @throws IllegalArgumentException if there is no provider for the specified API class
* @return the builder instance
*/
@NonNull

View file

@ -27,5 +27,5 @@ package org.geysermc.geyser.api.bedrock.camera;
public enum CameraShake {
POSITIONAL,
ROTATIONAL;
ROTATIONAL
}

View file

@ -25,11 +25,11 @@
package org.geysermc.geyser.api.block.custom.component;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.LinkedHashMap;
import java.util.Set;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* This class is used to store conditions for a placement filter for a custom block.
*
@ -43,7 +43,7 @@ public record PlacementConditions(@NonNull Set<Face> allowedFaces, @NonNull Link
NORTH,
SOUTH,
WEST,
EAST;
EAST
}
public enum BlockFilterType {

View file

@ -39,7 +39,7 @@ public interface JavaBlockState {
*
* @return whether the block state is waterlogged
*/
@NonNull boolean waterlogged();
boolean waterlogged();
/**
* Gets the collision of the block state
@ -53,7 +53,7 @@ public interface JavaBlockState {
*
* @return whether the block state can be broken with hand
*/
@NonNull boolean canBreakWithHand();
boolean canBreakWithHand();
/**
* Gets the pick item of the block state
@ -74,7 +74,7 @@ public interface JavaBlockState {
*
* @return whether the block state has block entity
*/
@Nullable boolean hasBlockEntity();
boolean hasBlockEntity();
/**
* Creates a new {@link JavaBlockState.Builder} instance
@ -94,17 +94,17 @@ public interface JavaBlockState {
Builder blockHardness(@NonNegative float blockHardness);
Builder waterlogged(@NonNull boolean waterlogged);
Builder waterlogged(boolean waterlogged);
Builder collision(@NonNull JavaBoundingBox[] collision);
Builder canBreakWithHand(@NonNull boolean canBreakWithHand);
Builder canBreakWithHand(boolean canBreakWithHand);
Builder pickItem(@Nullable String pickItem);
Builder pistonBehavior(@Nullable String pistonBehavior);
Builder hasBlockEntity(@Nullable boolean hasBlockEntity);
Builder hasBlockEntity(boolean hasBlockEntity);
JavaBlockState build();
}

View file

@ -1,6 +1,4 @@
package org.geysermc.geyser.api.block.custom.nonvanilla;
import org.checkerframework.checker.nullness.qual.NonNull;
public record JavaBoundingBox(@NonNull double middleX, @NonNull double middleY, @NonNull double middleZ, @NonNull double sizeX, @NonNull double sizeY, @NonNull double sizeZ) {
public record JavaBoundingBox(double middleX, double middleY, double middleZ, double sizeX, double sizeY, double sizeZ) {
}

View file

@ -28,7 +28,6 @@ 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;

View file

@ -27,7 +27,6 @@ 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

View file

@ -34,7 +34,7 @@ import java.net.InetSocketAddress;
/**
* Called whenever Geyser gets pinged
*
* <p>
* This event allows you to modify/obtain the MOTD, maximum player count, and current number of players online,
* Geyser will reply to the client with what was given.
*/

View file

@ -33,7 +33,7 @@ import java.util.Map;
/**
* Called when commands are defined within Geyser.
*
* <p>
* This event allows you to register new commands using the {@link #register(Command)}
* method and retrieve the default commands defined.
*/

View file

@ -28,13 +28,12 @@ package org.geysermc.geyser.api.event.lifecycle;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.geysermc.geyser.api.block.custom.CustomBlockData;
import org.geysermc.geyser.api.block.custom.CustomBlockState;
import org.geysermc.geyser.api.block.custom.nonvanilla.JavaBlockItem;
import org.geysermc.geyser.api.block.custom.nonvanilla.JavaBlockState;
import org.geysermc.event.Event;
/**
* Called on Geyser's startup when looking for custom blocks. Custom blocks must be registered through this event.
*
* <p>
* This event will not be called if the "add-non-bedrock-items" setting is disabled in the Geyser config.
*/
public abstract class GeyserDefineCustomBlocksEvent implements Event {
@ -48,8 +47,8 @@ public abstract class GeyserDefineCustomBlocksEvent implements Event {
/**
* Registers the given {@link CustomBlockState} as an override for the
* given java state identifier
* Java state identifiers are listed in
* https://raw.githubusercontent.com/GeyserMC/mappings/master/blocks.json
* Java state identifiers are listed
* <a href="https://raw.githubusercontent.com/GeyserMC/mappings/master/blocks.json">here</a>
*
* @param javaIdentifier the java state identifier to override
* @param customBlockState the custom block state with which to override java state identifier

View file

@ -36,7 +36,7 @@ import java.util.Map;
/**
* Called on Geyser's startup when looking for custom items. Custom items must be registered through this event.
*
* <p>
* This event will not be called if the "add non-Bedrock items" setting is disabled in the Geyser config.
*/
public interface GeyserDefineCustomItemsEvent extends Event {

View file

@ -5,7 +5,7 @@ import org.geysermc.event.Event;
/**
* Called on Geyser's startup when looking for custom skulls. Custom skulls must be registered through this event.
*
* <p>
* This event will not be called if the "add-non-bedrock-items" setting is disabled in the Geyser config.
*/
public abstract class GeyserDefineCustomSkullsEvent implements Event {

View file

@ -25,10 +25,16 @@
package org.geysermc.geyser.api.extension.exception;
import java.io.Serial;
/**
* Thrown when an extension's description is invalid.
*/
public class InvalidDescriptionException extends Exception {
@Serial
private static final long serialVersionUID = 1L;
public InvalidDescriptionException(Throwable cause) {
super(cause);
}

View file

@ -25,10 +25,16 @@
package org.geysermc.geyser.api.extension.exception;
import java.io.Serial;
/**
* Thrown when an extension is invalid.
*/
public class InvalidExtensionException extends Exception {
@Serial
private static final long serialVersionUID = 1L;
public InvalidExtensionException(Throwable cause) {
super(cause);
}

View file

@ -51,7 +51,7 @@ public enum CreativeCategory {
*
* @return the name of the category
*/
@NonNull public String internalName() {
public @NonNull String internalName() {
return internalName;
}

View file

@ -30,7 +30,7 @@ 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
* This class was inspired by adventure's <a href="https://github.com/KyoriPowered/adventure/blob/main/4/api/src/main/java/net/kyori/adventure/util/TriState.java">TriState</a>
*/
public enum TriState {
/**