[ci skip] Cleanup events (#10202)

This commit is contained in:
Lulu13022002 2024-02-01 10:15:57 +01:00 committed by GitHub
parent b3c81089ae
commit 294347bee2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
295 changed files with 3245 additions and 3088 deletions

View file

@ -6,25 +6,29 @@ Subject: [PATCH] Turtle API
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/TurtleGoHomeEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/TurtleGoHomeEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..021356d151ed638068e3e89b8cc77b3795883233
index 0000000000000000000000000000000000000000..cfbc8aaf862ac90e794ee38bf8a6cb9ea414b13e
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/entity/TurtleGoHomeEvent.java
@@ -0,0 +1,49 @@
@@ -0,0 +1,53 @@
+package com.destroystokyo.paper.event.entity;
+
+import org.bukkit.entity.Turtle;
+import org.bukkit.event.Cancellable;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.entity.EntityEvent;
+import org.jetbrains.annotations.ApiStatus;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Fired when a Turtle decides to go home
+ */
+public class TurtleGoHomeEvent extends EntityEvent implements Cancellable {
+ private static final HandlerList handlers = new HandlerList();
+ private boolean cancelled = false;
+
+ private static final HandlerList HANDLER_LIST = new HandlerList();
+
+ private boolean cancelled;
+
+ @ApiStatus.Internal
+ public TurtleGoHomeEvent(@NotNull Turtle turtle) {
+ super(turtle);
+ }
@ -36,35 +40,35 @@ index 0000000000000000000000000000000000000000..021356d151ed638068e3e89b8cc77b37
+ */
+ @NotNull
+ public Turtle getEntity() {
+ return (Turtle) entity;
+ return (Turtle) super.getEntity();
+ }
+
+ @Override
+ public boolean isCancelled() {
+ return cancelled;
+ return this.cancelled;
+ }
+
+ @Override
+ public void setCancelled(boolean cancel) {
+ cancelled = cancel;
+ this.cancelled = cancel;
+ }
+
+ @NotNull
+ public HandlerList getHandlers() {
+ return handlers;
+ return HANDLER_LIST;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ return HANDLER_LIST;
+ }
+}
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..bcc8dba50e3a3df0206c4827bb468bf884837b8b
index 0000000000000000000000000000000000000000..e917e64e8ea266a3fc7387c42aad95927f0f0501
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/entity/TurtleLayEggEvent.java
@@ -0,0 +1,87 @@
@@ -0,0 +1,92 @@
+package com.destroystokyo.paper.event.entity;
+
+import org.bukkit.Location;
@ -72,18 +76,23 @@ index 0000000000000000000000000000000000000000..bcc8dba50e3a3df0206c4827bb468bf8
+import org.bukkit.event.Cancellable;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.entity.EntityEvent;
+import org.jetbrains.annotations.ApiStatus;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Fired when a Turtle lays eggs
+ */
+public class TurtleLayEggEvent extends EntityEvent implements Cancellable {
+ private static final HandlerList handlers = new HandlerList();
+ private boolean cancelled = false;
+
+ private static final HandlerList HANDLER_LIST = new HandlerList();
+
+ @NotNull
+ private final Location location;
+ private int eggCount;
+
+ private boolean cancelled;
+
+ @ApiStatus.Internal
+ public TurtleLayEggEvent(@NotNull Turtle turtle, @NotNull Location location, int eggCount) {
+ super(turtle);
+ this.location = location;
@ -97,7 +106,7 @@ index 0000000000000000000000000000000000000000..bcc8dba50e3a3df0206c4827bb468bf8
+ */
+ @NotNull
+ public Turtle getEntity() {
+ return (Turtle) entity;
+ return (Turtle) super.getEntity();
+ }
+
+ /**
@ -107,7 +116,7 @@ index 0000000000000000000000000000000000000000..bcc8dba50e3a3df0206c4827bb468bf8
+ */
+ @NotNull
+ public Location getLocation() {
+ return location;
+ return this.location;
+ }
+
+ /**
@ -116,7 +125,7 @@ index 0000000000000000000000000000000000000000..bcc8dba50e3a3df0206c4827bb468bf8
+ * @return Number of eggs
+ */
+ public int getEggCount() {
+ return eggCount;
+ return this.eggCount;
+ }
+
+ /**
@ -126,7 +135,7 @@ index 0000000000000000000000000000000000000000..bcc8dba50e3a3df0206c4827bb468bf8
+ */
+ public void setEggCount(int eggCount) {
+ if (eggCount < 1) {
+ cancelled = true;
+ this.cancelled = true;
+ return;
+ }
+ this.eggCount = Math.min(eggCount, 4);
@ -134,30 +143,30 @@ index 0000000000000000000000000000000000000000..bcc8dba50e3a3df0206c4827bb468bf8
+
+ @Override
+ public boolean isCancelled() {
+ return cancelled;
+ return this.cancelled;
+ }
+
+ @Override
+ public void setCancelled(boolean cancel) {
+ cancelled = cancel;
+ this.cancelled = cancel;
+ }
+
+ @NotNull
+ public HandlerList getHandlers() {
+ return handlers;
+ return HANDLER_LIST;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ return HANDLER_LIST;
+ }
+}
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..abeb24fccda2acfdb0dfdadacb8fe688bd97cf78
index 0000000000000000000000000000000000000000..5cdc6b0c3db43279e2bb8043922b31f750ddb3f5
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/entity/TurtleStartDiggingEvent.java
@@ -0,0 +1,62 @@
@@ -0,0 +1,66 @@
+package com.destroystokyo.paper.event.entity;
+
+import org.bukkit.Location;
@ -165,16 +174,20 @@ index 0000000000000000000000000000000000000000..abeb24fccda2acfdb0dfdadacb8fe688
+import org.bukkit.event.Cancellable;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.entity.EntityEvent;
+import org.jetbrains.annotations.ApiStatus;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Fired when a Turtle starts digging to lay eggs
+ */
+public class TurtleStartDiggingEvent extends EntityEvent implements Cancellable {
+ private static final HandlerList handlers = new HandlerList();
+ private boolean cancelled = false;
+ @NotNull private final Location location;
+
+ private static final HandlerList HANDLER_LIST = new HandlerList();
+
+ @NotNull private final Location location;
+ private boolean cancelled;
+
+ @ApiStatus.Internal
+ public TurtleStartDiggingEvent(@NotNull Turtle turtle, @NotNull Location location) {
+ super(turtle);
+ this.location = location;
@ -187,7 +200,7 @@ index 0000000000000000000000000000000000000000..abeb24fccda2acfdb0dfdadacb8fe688
+ */
+ @NotNull
+ public Turtle getEntity() {
+ return (Turtle) entity;
+ return (Turtle) super.getEntity();
+ }
+
+ /**
@ -197,27 +210,27 @@ index 0000000000000000000000000000000000000000..abeb24fccda2acfdb0dfdadacb8fe688
+ */
+ @NotNull
+ public Location getLocation() {
+ return location;
+ return this.location;
+ }
+
+ @Override
+ public boolean isCancelled() {
+ return cancelled;
+ return this.cancelled;
+ }
+
+ @Override
+ public void setCancelled(boolean cancel) {
+ cancelled = cancel;
+ this.cancelled = cancel;
+ }
+
+ @NotNull
+ public HandlerList getHandlers() {
+ return handlers;
+ return HANDLER_LIST;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ return HANDLER_LIST;
+ }
+}
diff --git a/src/main/java/org/bukkit/entity/Turtle.java b/src/main/java/org/bukkit/entity/Turtle.java