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 29a25df60e
commit 0adf5876db
45 changed files with 782 additions and 718 deletions

View File

@@ -13,10 +13,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+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..00000000000000000000000000000000
+ 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..00000000000000000000000000000000
+ * @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..00000000000000000000000000000000
+ * @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..00000000000000000000000000000000
+ * @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);
+ }
+}