Skip to content

Commit

Permalink
Merge pull request #64 from TheNextLvl-net/jspecify
Browse files Browse the repository at this point in the history
Remove package-info.java files and add @NullMarked annotations
  • Loading branch information
NonSwag authored Nov 27, 2024
2 parents 1c27fe2 + 4cfbe0d commit 018197c
Show file tree
Hide file tree
Showing 67 changed files with 105 additions and 171 deletions.
1 change: 0 additions & 1 deletion api/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ repositories {

dependencies {
compileOnly("org.projectlombok:lombok:1.18.36")
compileOnly("net.thenextlvl.core:annotations:2.0.1")
compileOnly("io.papermc.paper:paper-api:1.21.3-R0.1-SNAPSHOT")

compileOnlyApi(platform("com.intellectualsites.bom:bom-newest:1.51"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.jspecify.annotations.NullMarked;

import java.util.Optional;

/**
* This interface controls the brush settings for each player.
*/
@NullMarked
public interface BrushController {
/**
* Retrieves the brush settings for a specific player.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package net.thenextlvl.gopaint.api.brush;

import net.kyori.adventure.key.Key;
import org.jspecify.annotations.NullMarked;

import java.util.Optional;
import java.util.stream.Stream;
Expand All @@ -9,6 +10,7 @@
* The BrushRegistry interface represents a registry for brushes.
* It provides methods to access, register, and unregister brushes.
*/
@NullMarked
public interface BrushRegistry {
/**
* Returns a stream of registered brushes.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,15 @@
import net.kyori.adventure.key.Keyed;
import net.kyori.adventure.text.Component;
import net.thenextlvl.gopaint.api.brush.setting.BrushSettings;
import org.jetbrains.annotations.NotNull;
import org.jspecify.annotations.NonNull;
import org.jspecify.annotations.NullMarked;

/**
* This interface represents a brush used for painting blocks in a world.
*/
@Getter
@ToString
@NullMarked
@EqualsAndHashCode
@RequiredArgsConstructor
public abstract class PatternBrush implements Comparable<PatternBrush>, Keyed, Brush {
Expand Down Expand Up @@ -75,7 +77,7 @@ public abstract class PatternBrush implements Comparable<PatternBrush>, Keyed, B
public abstract void build(EditSession session, BlockVector3 position, Pattern pattern, double size) throws MaxChangedBlocksException;

@Override
public int compareTo(@NotNull PatternBrush brush) {
public int compareTo(@NonNull PatternBrush brush) {
return key().compareTo(brush.key());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.math.BlockVector3;
import net.kyori.adventure.key.Key;
import org.jspecify.annotations.NullMarked;

@NullMarked
public abstract class SpherePatternBrush extends PatternBrush {
public SpherePatternBrush(String headValue, Key key) {
super(headValue, key);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
import com.sk89q.worldedit.function.mask.Mask;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.Vector3;
import org.jspecify.annotations.NullMarked;

@NullMarked
public record VisibleMask(Extent extent, Vector3 viewPoint) implements Mask {

@Override
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@
import com.sk89q.worldedit.world.block.BlockState;
import net.thenextlvl.gopaint.api.brush.setting.BrushSettings;
import org.bukkit.Material;
import org.jspecify.annotations.NullMarked;

import java.util.Objects;

@NullMarked
public interface BuildPattern extends Pattern {
BlockVector3 position();

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
import net.thenextlvl.gopaint.api.model.SurfaceMode;
import org.bukkit.Axis;
import org.bukkit.Material;
import org.jetbrains.annotations.Nullable;
import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.Nullable;

import java.util.List;
import java.util.Optional;
Expand All @@ -24,6 +25,7 @@
* about the brush's axis, brush type, list of blocks, mask material, enabled status, surface mode, angle-height
* difference, angle distance, chance, falloff strength, fracture distance, mixing strength, size and thickness.
*/
@NullMarked
public interface BrushSettings {
/**
* Returns the axis used by the brush settings.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,17 @@
import org.bukkit.Axis;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.Range;
import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.Nullable;

import java.util.List;

/**
* The PlayerBrushSettings interface extends the BrushSettings interface and the InventoryHolder interface.
* It represents the configuration settings for a brush specifically used by a player.
*/
@NullMarked
public interface PlayerBrushSettings extends BrushSettings {
/**
* Checks whether the brush is enabled.
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.math.BlockVector3;
import org.bukkit.block.BlockFace;
import org.jspecify.annotations.NullMarked;

import java.util.Arrays;
import java.util.HashSet;
Expand All @@ -29,6 +30,7 @@
import java.util.stream.Collectors;
import java.util.stream.Stream;

@NullMarked
public class ConnectedBlocks {

private static final BlockFace[] faces = new BlockFace[]{
Expand Down
2 changes: 2 additions & 0 deletions api/src/main/java/net/thenextlvl/gopaint/api/math/Height.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
package net.thenextlvl.gopaint.api.math;

import net.thenextlvl.gopaint.api.model.Block;
import org.jspecify.annotations.NullMarked;

@NullMarked
public class Height {

/**
Expand Down
2 changes: 2 additions & 0 deletions api/src/main/java/net/thenextlvl/gopaint/api/math/Sphere.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@
package net.thenextlvl.gopaint.api.math;

import com.sk89q.worldedit.math.BlockVector3;
import org.jspecify.annotations.NullMarked;

import java.util.HashSet;
import java.util.Set;

@NullMarked
public class Sphere {

public static Set<BlockVector3> getBlocksInRadius(BlockVector3 position, double radius) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,14 @@
import com.sk89q.worldedit.math.BlockVector3;
import lombok.Getter;
import org.jetbrains.annotations.Contract;
import org.jspecify.annotations.NullMarked;

import java.util.Arrays;
import java.util.List;
import java.util.OptionalDouble;

@Getter
@NullMarked
public class BezierSpline {

private final MutableBlockVector3[] knots;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,14 @@
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.Nullable;
import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.Nullable;

import java.util.Objects;

@Getter
@Setter
@NullMarked
@RequiredArgsConstructor
public class BezierSplineSegment {

Expand Down

This file was deleted.

This file was deleted.

2 changes: 2 additions & 0 deletions api/src/main/java/net/thenextlvl/gopaint/api/model/Block.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.registry.BlockMaterial;
import org.jspecify.annotations.NullMarked;

@NullMarked
public record Block(BaseBlock base, BlockVector3 vector, Extent world) {

public BlockMaterial material() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
import net.thenextlvl.gopaint.api.brush.BrushController;
import net.thenextlvl.gopaint.api.brush.BrushRegistry;
import org.bukkit.plugin.Plugin;
import org.jspecify.annotations.NullMarked;

@NullMarked
public interface GoPaintProvider extends Plugin {
String USE_PERMISSION = "gopaint.use";
String ADMIN_PERMISSION = "gopaint.admin";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@
import net.kyori.adventure.key.Key;
import org.bukkit.Axis;
import org.bukkit.Material;
import org.jspecify.annotations.NullMarked;

import java.util.List;
import java.util.Set;

@NullMarked
public record PluginConfig(
@SerializedName("brush") BrushConfig brushConfig,
@SerializedName("thickness") ThicknessConfig thicknessConfig,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
import lombok.experimental.Accessors;
import net.kyori.adventure.translation.Translatable;
import net.thenextlvl.gopaint.api.brush.mask.VisibleMask;
import org.jspecify.annotations.NullMarked;

@Getter
@NullMarked
@RequiredArgsConstructor
@Accessors(fluent = true)
public enum SurfaceMode implements Translatable {
Expand Down

This file was deleted.

1 change: 0 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ repositories {

dependencies {
compileOnly("org.projectlombok:lombok:1.18.36")
compileOnly("net.thenextlvl.core:annotations:2.0.1")
compileOnly("io.papermc.paper:paper-api:1.21.3-R0.1-SNAPSHOT")

implementation("org.bstats:bstats-bukkit:3.1.0")
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/net/thenextlvl/gopaint/GoPaintPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,14 @@
import org.bukkit.entity.Player;
import org.bukkit.plugin.ServicePriority;
import org.bukkit.plugin.java.JavaPlugin;
import org.jspecify.annotations.NullMarked;

import java.io.File;
import java.util.List;
import java.util.Locale;
import java.util.Set;

@NullMarked
@Accessors(fluent = true)
public class GoPaintPlugin extends JavaPlugin implements GoPaintProvider {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,11 @@
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.persistence.PersistentDataType;
import org.jspecify.annotations.NullMarked;

import java.util.*;

@NullMarked
@RequiredArgsConstructor
public class CraftBrushController implements BrushController {
private final Map<UUID, PlayerBrushSettings> playerBrushes = new HashMap<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@
import net.thenextlvl.gopaint.api.brush.PatternBrush;
import net.thenextlvl.gopaint.api.brush.BrushRegistry;
import net.thenextlvl.gopaint.brush.standard.*;
import org.jspecify.annotations.NullMarked;

import java.util.LinkedList;
import java.util.List;
import java.util.Optional;
import java.util.stream.Stream;

@NullMarked
public class CraftBrushRegistry implements BrushRegistry {
private final List<PatternBrush> brushes = new LinkedList<>();

Expand Down
10 changes: 0 additions & 10 deletions src/main/java/net/thenextlvl/gopaint/brush/package-info.java

This file was deleted.

Loading

0 comments on commit 018197c

Please sign in to comment.