Skip to content

Commit

Permalink
Add AttributeModifier constructor without EquipmentSlotGroup (#11079)
Browse files Browse the repository at this point in the history
  • Loading branch information
Malfrador authored Jul 15, 2024
1 parent 99ae7bb commit 9fd5b3c
Show file tree
Hide file tree
Showing 85 changed files with 49 additions and 34 deletions.
14 changes: 14 additions & 0 deletions patches/api/0053-Fix-upstream-javadocs.patch
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,20 @@ index 9885fd1adc1f93a80d650e6d42dfa3a0b084db9f..c4f2f03ec31998d486dad1d45ef83df3
* temporarily freezing while locating an unexplored structure.
* <p>
* The {@code radius} is not a rigid square radius. Each structure may alter
diff --git a/src/main/java/org/bukkit/attribute/AttributeModifier.java b/src/main/java/org/bukkit/attribute/AttributeModifier.java
index d66502c9df2592cd18694481e7e90a71a5c3a359..ee39c0b83e558681e8b006172d34c98e2c83cda2 100644
--- a/src/main/java/org/bukkit/attribute/AttributeModifier.java
+++ b/src/main/java/org/bukkit/attribute/AttributeModifier.java
@@ -117,8 +117,7 @@ public class AttributeModifier implements ConfigurationSerializable, Keyed {
}

/**
- * Get the {@link EquipmentSlot} this AttributeModifier is active on,
- * or null if this modifier is applicable for any slot.
+ * Get the {@link EquipmentSlotGroup} this AttributeModifier is active on.
*
* @return the slot
*/
diff --git a/src/main/java/org/bukkit/block/Bed.java b/src/main/java/org/bukkit/block/Bed.java
index f9bd74f9ce6bd6650726e5a993f9b6e292cdc74d..f4c37ce1fe7aac3dde8485ee51fc8888ed56e79e 100644
--- a/src/main/java/org/bukkit/block/Bed.java
Expand Down
27 changes: 0 additions & 27 deletions patches/api/0396-Add-transient-modifier-API.patch

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: TonytheMacaroni <tonythemacaroni123@gmail.com>
Date: Thu, 9 Nov 2023 20:35:35 -0500
Subject: [PATCH] Add UUID attribute modifier API
Subject: [PATCH] Attribute Modifier API improvements

Co-authored-by: Malfrador <malfrador@gmail.com>

diff --git a/src/main/java/org/bukkit/attribute/AttributeInstance.java b/src/main/java/org/bukkit/attribute/AttributeInstance.java
index 5513174ea545bb5b4fdc028cbaa4c1bb763e2c6d..f1fa86ddf1f50a357c9e94cc61261d8c96a2da6f 100644
index f08ee26cc4d479e1bfc5264b8cbe721315de91f2..f1fa86ddf1f50a357c9e94cc61261d8c96a2da6f 100644
--- a/src/main/java/org/bukkit/attribute/AttributeInstance.java
+++ b/src/main/java/org/bukkit/attribute/AttributeInstance.java
@@ -39,6 +39,42 @@ public interface AttributeInstance {
Expand Down Expand Up @@ -51,11 +52,28 @@ index 5513174ea545bb5b4fdc028cbaa4c1bb763e2c6d..f1fa86ddf1f50a357c9e94cc61261d8c
/**
* Add a modifier to this instance.
*
@@ -46,6 +82,16 @@ public interface AttributeInstance {
*/
void addModifier(@NotNull AttributeModifier modifier);

+ // Paper start - Transient modifier API
+ /**
+ * Add a transient modifier to this instance.
+ * Transient modifiers are not persisted (saved with the NBT data)
+ *
+ * @param modifier to add
+ */
+ void addTransientModifier(@NotNull AttributeModifier modifier);
+ // Paper end
+
/**
* Remove a modifier from this instance.
*
diff --git a/src/main/java/org/bukkit/attribute/AttributeModifier.java b/src/main/java/org/bukkit/attribute/AttributeModifier.java
index d66502c9df2592cd18694481e7e90a71a5c3a359..90f18f355a6a236a7e4273cc1258e7c8034b8276 100644
index c6b8700d258b859d246118868167497397010292..3808f76d49e24c20156c013f68e00efa9351f1a3 100644
--- a/src/main/java/org/bukkit/attribute/AttributeModifier.java
+++ b/src/main/java/org/bukkit/attribute/AttributeModifier.java
@@ -25,22 +25,22 @@ public class AttributeModifier implements ConfigurationSerializable, Keyed {
@@ -25,26 +25,32 @@ public class AttributeModifier implements ConfigurationSerializable, Keyed {
private final Operation operation;
private final EquipmentSlotGroup slot;

Expand All @@ -82,7 +100,17 @@ index d66502c9df2592cd18694481e7e90a71a5c3a359..90f18f355a6a236a7e4273cc1258e7c8
public AttributeModifier(@NotNull UUID uuid, @NotNull String name, double amount, @NotNull Operation operation, @NotNull EquipmentSlotGroup slot) {
this(NamespacedKey.fromString(uuid.toString()), amount, operation, slot);
}
@@ -63,7 +63,7 @@ public class AttributeModifier implements ConfigurationSerializable, Keyed {

+ // Paper start - Add constructor without EquipmentSlotGroup
+ public AttributeModifier(@NotNull NamespacedKey key, double amount, @NotNull Operation operation) {
+ this(key, amount, operation, EquipmentSlotGroup.ANY);
+ }
+ // Paper end
+
public AttributeModifier(@NotNull NamespacedKey key, double amount, @NotNull Operation operation, @NotNull EquipmentSlotGroup slot) {
Preconditions.checkArgument(key != null, "Key cannot be null");
Preconditions.checkArgument(operation != null, "Operation cannot be null");
@@ -63,7 +69,7 @@ public class AttributeModifier implements ConfigurationSerializable, Keyed {
* @deprecated attributes are now identified by keys
*/
@NotNull
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ Adds the following:
Co-authored-by: SoSeDiK <mrsosedik@gmail.com>

diff --git a/src/main/java/org/bukkit/attribute/AttributeModifier.java b/src/main/java/org/bukkit/attribute/AttributeModifier.java
index 90f18f355a6a236a7e4273cc1258e7c8034b8276..a0750d457a9cd7cf3ab9c45bb28ce5a2aef35298 100644
index 3808f76d49e24c20156c013f68e00efa9351f1a3..e14b64d3b178791dacc7849e97f2ed95f1919c55 100644
--- a/src/main/java/org/bukkit/attribute/AttributeModifier.java
+++ b/src/main/java/org/bukkit/attribute/AttributeModifier.java
@@ -112,6 +112,7 @@ public class AttributeModifier implements ConfigurationSerializable, Keyed {
@@ -118,6 +118,7 @@ public class AttributeModifier implements ConfigurationSerializable, Keyed {
*/
@Nullable
@Deprecated
Expand Down

0 comments on commit 9fd5b3c

Please sign in to comment.