Clone mutable types in events when changes are discarded (#10333)

This commit is contained in:
Jake Potrebic 2024-03-20 13:42:29 -07:00 committed by GitHub
parent 05fe15e0fc
commit de620b8480
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 175 additions and 25 deletions

View file

@ -65,7 +65,7 @@ index 0000000000000000000000000000000000000000..cfbc8aaf862ac90e794ee38bf8a6cb9e
+}
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/TurtleLayEggEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/TurtleLayEggEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..e917e64e8ea266a3fc7387c42aad95927f0f0501
index 0000000000000000000000000000000000000000..3029e406cd684efb5645e38711dff9c0bb7b01e4
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/entity/TurtleLayEggEvent.java
@@ -0,0 +1,92 @@
@ -116,7 +116,7 @@ index 0000000000000000000000000000000000000000..e917e64e8ea266a3fc7387c42aad9592
+ */
+ @NotNull
+ public Location getLocation() {
+ return this.location;
+ return this.location.clone();
+ }
+
+ /**
@ -163,7 +163,7 @@ index 0000000000000000000000000000000000000000..e917e64e8ea266a3fc7387c42aad9592
+}
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/TurtleStartDiggingEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/TurtleStartDiggingEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..5cdc6b0c3db43279e2bb8043922b31f750ddb3f5
index 0000000000000000000000000000000000000000..7a2fa4a11b47e4982d1644830d7e28f12b4378ec
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/entity/TurtleStartDiggingEvent.java
@@ -0,0 +1,66 @@
@ -210,7 +210,7 @@ index 0000000000000000000000000000000000000000..5cdc6b0c3db43279e2bb8043922b31f7
+ */
+ @NotNull
+ public Location getLocation() {
+ return this.location;
+ return this.location.clone();
+ }
+
+ @Override