Finish converting most of the undeprecated api to jspecify

This commit is contained in:
Jake Potrebic 2024-09-30 11:44:36 -07:00
parent ba3c29b92e
commit e7e1ab56ca
No known key found for this signature in database
GPG key ID: ECE0B3C133C016C5
45 changed files with 1046 additions and 982 deletions

View file

@ -6,17 +6,15 @@ Subject: [PATCH] Add villager reputation API
diff --git a/src/main/java/com/destroystokyo/paper/entity/villager/Reputation.java b/src/main/java/com/destroystokyo/paper/entity/villager/Reputation.java
new file mode 100644
index 0000000000000000000000000000000000000000..f16294ef3148f8671389fa097e3e369a046e48cf
index 0000000000000000000000000000000000000000..cbbf70507c2df922e75b686c36500f6f85f92db6
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/entity/villager/Reputation.java
@@ -0,0 +1,58 @@
@@ -0,0 +1,56 @@
+package com.destroystokyo.paper.entity.villager;
+
+import com.google.common.base.Preconditions;
+
+import java.util.EnumMap;
+import java.util.Map;
+import org.jetbrains.annotations.NotNull;
+import org.jspecify.annotations.NullMarked;
+
+/**
@ -31,7 +29,7 @@ index 0000000000000000000000000000000000000000..f16294ef3148f8671389fa097e3e369a
+ this(new EnumMap<>(ReputationType.class));
+ }
+
+ public Reputation(Map<ReputationType, Integer> reputation) {
+ public Reputation(final Map<ReputationType, Integer> reputation) {
+ Preconditions.checkNotNull(reputation, "reputation cannot be null");
+ this.reputation = reputation;
+ }
@ -42,7 +40,7 @@ index 0000000000000000000000000000000000000000..f16294ef3148f8671389fa097e3e369a
+ * @param type The {@link ReputationType type} of reputation to get.
+ * @return The value of the {@link ReputationType type}.
+ */
+ public int getReputation(ReputationType type) {
+ public int getReputation(final ReputationType type) {
+ Preconditions.checkNotNull(type, "the reputation type cannot be null");
+ return this.reputation.getOrDefault(type, 0);
+ }
@ -53,7 +51,7 @@ index 0000000000000000000000000000000000000000..f16294ef3148f8671389fa097e3e369a
+ * @param type The {@link ReputationType type} of reputation to set.
+ * @param value The value of the {@link ReputationType type}.
+ */
+ public void setReputation(ReputationType type, int value) {
+ public void setReputation(final ReputationType type, final int value) {
+ Preconditions.checkNotNull(type, "the reputation type cannot be null");
+ this.reputation.put(type, value);
+ }
@ -64,7 +62,7 @@ index 0000000000000000000000000000000000000000..f16294ef3148f8671389fa097e3e369a
+ * @param type The {@link ReputationType type} to check
+ * @return If there is a value for this {@link ReputationType type} set.
+ */
+ public boolean hasReputationSet(ReputationType type) {
+ public boolean hasReputationSet(final ReputationType type) {
+ return this.reputation.containsKey(type);
+ }
+}