Finish converting most of the undeprecated api to jspecify
This commit is contained in:
parent
ba3c29b92e
commit
e7e1ab56ca
45 changed files with 1046 additions and 982 deletions
|
@ -7,23 +7,24 @@ Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
|
|||
|
||||
diff --git a/src/main/java/io/papermc/paper/datapack/Datapack.java b/src/main/java/io/papermc/paper/datapack/Datapack.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..233a31afa9673c9cb8d9eb52551425ff15f79661
|
||||
index 0000000000000000000000000000000000000000..95039ec90f81993cb2e36f82b7d13e9e7a30220e
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/datapack/Datapack.java
|
||||
@@ -0,0 +1,98 @@
|
||||
@@ -0,0 +1,99 @@
|
||||
+package io.papermc.paper.datapack;
|
||||
+
|
||||
+import java.util.Set;
|
||||
+import net.kyori.adventure.text.Component;
|
||||
+import org.bukkit.FeatureFlag;
|
||||
+import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
+import org.jetbrains.annotations.Contract;
|
||||
+import org.jetbrains.annotations.Unmodifiable;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+/**
|
||||
+ * This is a snapshot of a datapack on the server. It
|
||||
+ * won't be updated as datapacks are updated.
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public interface Datapack {
|
||||
+
|
||||
+ /**
|
||||
|
@ -32,21 +33,21 @@ index 0000000000000000000000000000000000000000..233a31afa9673c9cb8d9eb52551425ff
|
|||
+ * @return the name of the pack
|
||||
+ */
|
||||
+ @Contract(pure = true)
|
||||
+ @NonNull String getName();
|
||||
+ String getName();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the title component of this datapack.
|
||||
+ *
|
||||
+ * @return the title
|
||||
+ */
|
||||
+ @NonNull Component getTitle();
|
||||
+ Component getTitle();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the description component of this datapack.
|
||||
+ *
|
||||
+ * @return the description
|
||||
+ */
|
||||
+ @NonNull Component getDescription();
|
||||
+ Component getDescription();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets if this datapack is required to be enabled.
|
||||
|
@ -60,14 +61,14 @@ index 0000000000000000000000000000000000000000..233a31afa9673c9cb8d9eb52551425ff
|
|||
+ *
|
||||
+ * @return the compatibility of the pack
|
||||
+ */
|
||||
+ @NonNull Compatibility getCompatibility();
|
||||
+ Compatibility getCompatibility();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the set of required features for this datapack.
|
||||
+ *
|
||||
+ * @return the set of required features
|
||||
+ */
|
||||
+ @NonNull @Unmodifiable Set<FeatureFlag> getRequiredFeatures();
|
||||
+ @Unmodifiable Set<FeatureFlag> getRequiredFeatures();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the enabled state of this pack.
|
||||
|
@ -91,7 +92,7 @@ index 0000000000000000000000000000000000000000..233a31afa9673c9cb8d9eb52551425ff
|
|||
+ *
|
||||
+ * @return the pack source
|
||||
+ */
|
||||
+ @NonNull DatapackSource getSource();
|
||||
+ DatapackSource getSource();
|
||||
+
|
||||
+ /**
|
||||
+ * Computes the component vanilla Minecraft uses
|
||||
|
@ -101,7 +102,7 @@ index 0000000000000000000000000000000000000000..233a31afa9673c9cb8d9eb52551425ff
|
|||
+ * @return a new component
|
||||
+ */
|
||||
+ @Contract(pure = true, value = "-> new")
|
||||
+ @NonNull Component computeDisplayName();
|
||||
+ Component computeDisplayName();
|
||||
+
|
||||
+ enum Compatibility {
|
||||
+ TOO_OLD,
|
||||
|
@ -111,18 +112,18 @@ index 0000000000000000000000000000000000000000..233a31afa9673c9cb8d9eb52551425ff
|
|||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/datapack/DatapackManager.java b/src/main/java/io/papermc/paper/datapack/DatapackManager.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..bbb81a8058a67fd554c781dbb4908434ad339655
|
||||
index 0000000000000000000000000000000000000000..4f758a781612bb14c8f2ee41b2b6f40a074e6359
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/datapack/DatapackManager.java
|
||||
@@ -0,0 +1,43 @@
|
||||
+package io.papermc.paper.datapack;
|
||||
+
|
||||
+import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
+
|
||||
+import java.util.Collection;
|
||||
+import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
+import org.jetbrains.annotations.Unmodifiable;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+import org.jspecify.annotations.Nullable;
|
||||
+
|
||||
+@NullMarked
|
||||
+public interface DatapackManager {
|
||||
+
|
||||
+ /**
|
||||
|
@ -140,7 +141,7 @@ index 0000000000000000000000000000000000000000..bbb81a8058a67fd554c781dbb4908434
|
|||
+ * @param name the name/id of the datapack
|
||||
+ * @return the datapack, or null if not found
|
||||
+ */
|
||||
+ @Nullable Datapack getPack(@NonNull String name);
|
||||
+ @Nullable Datapack getPack(String name);
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the available datapacks. May require calling {@link #refreshPacks()} before
|
||||
|
@ -148,7 +149,7 @@ index 0000000000000000000000000000000000000000..bbb81a8058a67fd554c781dbb4908434
|
|||
+ *
|
||||
+ * @return all the packs known to the server
|
||||
+ */
|
||||
+ @NonNull @Unmodifiable Collection<Datapack> getPacks();
|
||||
+ @Unmodifiable Collection<Datapack> getPacks();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the enabled datapacks. May require calling {@link #refreshPacks()} before
|
||||
|
@ -156,19 +157,22 @@ index 0000000000000000000000000000000000000000..bbb81a8058a67fd554c781dbb4908434
|
|||
+ *
|
||||
+ * @return all the packs which are currently enabled
|
||||
+ */
|
||||
+ @NonNull @Unmodifiable Collection<Datapack> getEnabledPacks();
|
||||
+ @Unmodifiable Collection<Datapack> getEnabledPacks();
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/datapack/DatapackSource.java b/src/main/java/io/papermc/paper/datapack/DatapackSource.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..1679cbd78920005475343092857e13906ab73f82
|
||||
index 0000000000000000000000000000000000000000..b9b81cd974c2df501fef55bd8d9b78406c073038
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/datapack/DatapackSource.java
|
||||
@@ -0,0 +1,17 @@
|
||||
@@ -0,0 +1,20 @@
|
||||
+package io.papermc.paper.datapack;
|
||||
+
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+/**
|
||||
+ * Source of a datapack.
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public sealed interface DatapackSource permits DatapackSourceImpl {
|
||||
+
|
||||
+ DatapackSource DEFAULT = create("default");
|
||||
|
@ -183,15 +187,17 @@ index 0000000000000000000000000000000000000000..1679cbd78920005475343092857e1390
|
|||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/datapack/DatapackSourceImpl.java b/src/main/java/io/papermc/paper/datapack/DatapackSourceImpl.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..3eb4d1df8187fdeab74948d261d9c8e03e55605c
|
||||
index 0000000000000000000000000000000000000000..0dfd101f01d16cc38f21831ca873633453dc6c9e
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/datapack/DatapackSourceImpl.java
|
||||
@@ -0,0 +1,12 @@
|
||||
@@ -0,0 +1,14 @@
|
||||
+package io.papermc.paper.datapack;
|
||||
+
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+@ApiStatus.Internal
|
||||
+@NullMarked
|
||||
+record DatapackSourceImpl(String name) implements DatapackSource {
|
||||
+
|
||||
+ @Override
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue