mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-06 23:22:10 -07:00
Finish converting most of the undeprecated api to jspecify
This commit is contained in:
@@ -12,11 +12,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
@@ -0,0 +0,0 @@
|
||||
+package io.papermc.paper.world;
|
||||
+
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+import java.util.HashMap;
|
||||
+import java.util.Map;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+@NullMarked
|
||||
+public enum MoonPhase {
|
||||
+ FULL_MOON(0L),
|
||||
+ WANING_GIBBOUS(1L),
|
||||
@@ -29,20 +29,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+
|
||||
+ private final long day;
|
||||
+
|
||||
+ MoonPhase(long day) {
|
||||
+ MoonPhase(final long day) {
|
||||
+ this.day = day;
|
||||
+ }
|
||||
+
|
||||
+ private static final Map<Long, MoonPhase> BY_DAY = new HashMap<>();
|
||||
+
|
||||
+ static {
|
||||
+ for (MoonPhase phase : values()) {
|
||||
+ for (final MoonPhase phase : values()) {
|
||||
+ BY_DAY.put(phase.day, phase);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static MoonPhase getPhase(long day) {
|
||||
+ public static MoonPhase getPhase(final long day) {
|
||||
+ return BY_DAY.get(day % 8L);
|
||||
+ }
|
||||
+}
|
||||
|
Reference in New Issue
Block a user