Skip to content

Commit 55f33fe

Browse files
author
david
committed
added more nullability information
1 parent 0cb1d8f commit 55f33fe

File tree

4 files changed

+18
-14
lines changed

4 files changed

+18
-14
lines changed

src/main/java/net/onelitefeather/bettergopaint/BetterGoPaint.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
import org.incendo.cloud.execution.ExecutionCoordinator;
4040
import org.incendo.cloud.paper.LegacyPaperCommandManager;
4141
import org.incendo.serverlib.ServerLib;
42+
import org.jetbrains.annotations.NotNull;
4243
import org.jetbrains.annotations.Nullable;
4344

4445
import java.io.File;
@@ -47,8 +48,8 @@
4748

4849
public class BetterGoPaint extends JavaPlugin implements Listener {
4950

50-
private final PlayerBrushManager brushManager = new PlayerBrushManager();
51-
private final Metrics metrics = new Metrics(this, 18734);
51+
private final @NotNull PlayerBrushManager brushManager = new PlayerBrushManager();
52+
private final @NotNull Metrics metrics = new Metrics(this, 18734);
5253

5354
@Override
5455
public void onLoad() {
@@ -131,7 +132,7 @@ private boolean hasOriginalGoPaint() {
131132
}
132133
}
133134

134-
public PlayerBrushManager getBrushManager() {
135+
public @NotNull PlayerBrushManager getBrushManager() {
135136
return brushManager;
136137
}
137138

src/main/java/net/onelitefeather/bettergopaint/utils/Height.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,15 @@
1919
package net.onelitefeather.bettergopaint.utils;
2020

2121
import org.bukkit.Location;
22+
import org.jetbrains.annotations.NotNull;
2223

2324
public class Height {
2425

25-
public static int getHeight(Location location) {
26+
public static int getHeight(@NotNull Location location) {
2627
return location.getWorld().getHighestBlockYAt(location);
2728
}
2829

29-
public static double getAverageHeightDiffFracture(Location location, int height, int distance) {
30+
public static double getAverageHeightDiffFracture(@NotNull Location location, int height, int distance) {
3031
double totalHeight = 0;
3132
totalHeight += Math.abs(getHeight(location.clone().add(distance, 0, -distance))) - height;
3233
totalHeight += Math.abs(getHeight(location.clone().add(distance, 0, distance))) - height;
@@ -39,7 +40,7 @@ public static double getAverageHeightDiffFracture(Location location, int height,
3940
return (totalHeight / 8d) / distance;
4041
}
4142

42-
public static double getAverageHeightDiffAngle(Location location, int distance) {
43+
public static double getAverageHeightDiffAngle(@NotNull Location location, int distance) {
4344
double maxHeightDiff = 0;
4445
double maxHeightDiff2 = 0;
4546
double diff = Math.abs(getHeight(location.clone().add(distance, 0, -distance)) - getHeight(location.clone()

src/main/java/net/onelitefeather/bettergopaint/utils/Sphere.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import org.bukkit.Axis;
2222
import org.bukkit.Location;
2323
import org.bukkit.block.Block;
24+
import org.jetbrains.annotations.NotNull;
2425
import org.jetbrains.annotations.Nullable;
2526

2627
import java.util.ArrayList;
@@ -38,7 +39,7 @@ public class Sphere {
3839
* @param air Whether air blocks should be included.
3940
* @return A stream of blocks within the specified radius.
4041
*/
41-
public static Stream<Block> getBlocksInRadius(Location middlePoint, int radius, @Nullable Axis axis, boolean air) {
42+
public static Stream<Block> getBlocksInRadius(@NotNull Location middlePoint, int radius, @Nullable Axis axis, boolean air) {
4243
List<Block> blocks = new ArrayList<>();
4344
Location loc1 = middlePoint.clone().add(-radius / 2d, -radius / 2d, -radius / 2d).getBlock().getLocation();
4445
Location loc2 = middlePoint.clone().add(radius / 2d, radius / 2d, radius / 2d).getBlock().getLocation();
@@ -91,7 +92,7 @@ public static Stream<Block> getBlocksInRadius(Location middlePoint, int radius,
9192
return blocks.stream().filter(block -> !block.isEmpty());
9293
}
9394

94-
private static boolean passesDefaultChecks(Location location, Location middlePoint, int radius) {
95+
private static boolean passesDefaultChecks(@NotNull Location location, @NotNull Location middlePoint, int radius) {
9596
return location.distance(middlePoint) < radius / 2d;
9697
}
9798

src/main/java/net/onelitefeather/bettergopaint/utils/Surface.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import org.bukkit.Location;
2323
import org.bukkit.block.Block;
2424
import org.bukkit.block.BlockFace;
25+
import org.jetbrains.annotations.NotNull;
2526

2627
public class Surface {
2728

@@ -31,7 +32,7 @@ public class Surface {
3132
* @param block the block to check
3233
* @return true if the block is on the surface, false otherwise
3334
*/
34-
public static boolean isDirectlyOnSurface(Block block) {
35+
public static boolean isDirectlyOnSurface(@NotNull Block block) {
3536
return block.isSolid() && !block.getRelative(BlockFace.UP).isSolid();
3637
}
3738

@@ -42,7 +43,7 @@ public static boolean isDirectlyOnSurface(Block block) {
4243
* @param playerLoc the player's location
4344
* @return true if the block is on the surface from the player's location, false otherwise
4445
*/
45-
public static boolean isRelativelyOnSurface(Block block, Location playerLoc) {
46+
public static boolean isRelativelyOnSurface(@NotNull Block block, @NotNull Location playerLoc) {
4647
Location location = block.getLocation();
4748

4849
playerLoc.add(0, 1.5, 0);
@@ -81,12 +82,12 @@ public static boolean isRelativelyOnSurface(Block block, Location playerLoc) {
8182
/**
8283
* Checks if a given block is on the surface based on the specified surface mode and location.
8384
*
84-
* @param block the block to check
85-
* @param surfaceMode the surface mode to use for the check
86-
* @param location the location to use for the check
85+
* @param block the block to check
86+
* @param surfaceMode the surface mode to use for the check
87+
* @param location the location to use for the check
8788
* @return true if the block is on the surface based on the surface mode and location, false otherwise
8889
*/
89-
public static boolean isOnSurface(Block block, SurfaceMode surfaceMode, Location location) {
90+
public static boolean isOnSurface(@NotNull Block block, @NotNull SurfaceMode surfaceMode, @NotNull Location location) {
9091
return switch (surfaceMode) {
9192
case RELATIVE -> isRelativelyOnSurface(block, location);
9293
case DIRECT -> isDirectlyOnSurface(block);

0 commit comments

Comments
 (0)