Finish converting all events to jspecify annotations
This commit is contained in:
parent
fa97c59a4e
commit
29a25df60e
78 changed files with 757 additions and 883 deletions
|
@ -17,20 +17,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+import java.util.EnumMap;
|
||||
+import java.util.Map;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+/**
|
||||
+ * A reputation score for a player on a villager.
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public final class Reputation {
|
||||
+
|
||||
+ @NotNull
|
||||
+ private final Map<ReputationType, Integer> reputation;
|
||||
+
|
||||
+ public Reputation() {
|
||||
+ this(new EnumMap<>(ReputationType.class));
|
||||
+ }
|
||||
+
|
||||
+ public Reputation(@NotNull Map<ReputationType, Integer> reputation) {
|
||||
+ public Reputation(Map<ReputationType, Integer> reputation) {
|
||||
+ Preconditions.checkNotNull(reputation, "reputation cannot be null");
|
||||
+ this.reputation = reputation;
|
||||
+ }
|
||||
|
@ -41,7 +42,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(@NotNull ReputationType type) {
|
||||
+ public int getReputation(ReputationType type) {
|
||||
+ Preconditions.checkNotNull(type, "the reputation type cannot be null");
|
||||
+ return this.reputation.getOrDefault(type, 0);
|
||||
+ }
|
||||
|
@ -52,7 +53,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(@NotNull ReputationType type, int value) {
|
||||
+ public void setReputation(ReputationType type, int value) {
|
||||
+ Preconditions.checkNotNull(type, "the reputation type cannot be null");
|
||||
+ this.reputation.put(type, value);
|
||||
+ }
|
||||
|
@ -63,7 +64,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(@NotNull ReputationType type) {
|
||||
+ public boolean hasReputationSet(ReputationType type) {
|
||||
+ return this.reputation.containsKey(type);
|
||||
+ }
|
||||
+}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue