13
0
geforkt von Mirrors/Paper

Add AttributeModifier constructor without EquipmentSlotGroup (#11079)

Dieser Commit ist enthalten in:
Malfrador 2024-07-15 12:31:41 +02:00
Ursprung b8af72fa88
Commit 656cc3915f
3 geänderte Dateien mit 43 neuen und 28 gelöschten Zeilen

Datei anzeigen

@ -1,27 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Malfrador <malfrador@gmail.com>
Date: Wed, 31 May 2023 21:25:01 +0200
Subject: [PATCH] Add transient modifier API
diff --git a/src/main/java/org/bukkit/attribute/AttributeInstance.java b/src/main/java/org/bukkit/attribute/AttributeInstance.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/attribute/AttributeInstance.java
+++ b/src/main/java/org/bukkit/attribute/AttributeInstance.java
@@ -0,0 +0,0 @@ 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.
*

Datei anzeigen

@ -1,8 +1,9 @@
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
@ -51,6 +52,23 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
/**
* Add a modifier to this instance.
*
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/attribute/AttributeModifier.java
@ -82,6 +100,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public AttributeModifier(@NotNull UUID uuid, @NotNull String name, double amount, @NotNull Operation operation, @NotNull EquipmentSlotGroup slot) {
this(NamespacedKey.fromString(uuid.toString()), amount, operation, slot);
}
+ // 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");
@@ -0,0 +0,0 @@ public class AttributeModifier implements ConfigurationSerializable, Keyed {
* @deprecated attributes are now identified by keys
*/

Datei anzeigen

@ -185,6 +185,20 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
* 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/attribute/AttributeModifier.java
+++ b/src/main/java/org/bukkit/attribute/AttributeModifier.java
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/block/Bed.java