[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

@ -10,17 +10,19 @@ Co-authored-by: Nassim Jahnke <nassim@njahnke.dev>
diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerUseUnknownEntityEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerUseUnknownEntityEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..a7228e248e3d8eb2e9f011dfe2c7dd9f3f48000f
index 0000000000000000000000000000000000000000..f64b253f1794c7987a32a4313df19d7512bea1bc
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerUseUnknownEntityEvent.java
@@ -0,0 +1,82 @@
@@ -0,0 +1,86 @@
+package com.destroystokyo.paper.event.player;
+
+import org.bukkit.entity.Player;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.player.PlayerEvent;
+import org.bukkit.event.player.PlayerInteractAtEntityEvent;
+import org.bukkit.inventory.EquipmentSlot;
+import org.bukkit.util.Vector;
+import org.jetbrains.annotations.ApiStatus;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
@ -33,14 +35,16 @@ index 0000000000000000000000000000000000000000..a7228e248e3d8eb2e9f011dfe2c7dd9f
+ */
+public class PlayerUseUnknownEntityEvent extends PlayerEvent {
+
+ private static final HandlerList HANDLERS = new HandlerList();
+ private static final HandlerList HANDLER_LIST = new HandlerList();
+
+ private final int entityId;
+ private final boolean attack;
+ private final @NotNull EquipmentSlot hand;
+ private final @Nullable Vector clickedPosition;
+
+ public PlayerUseUnknownEntityEvent(@NotNull Player who, int entityId, boolean attack, @NotNull EquipmentSlot hand, @Nullable Vector clickedPosition) {
+ super(who);
+ @ApiStatus.Internal
+ public PlayerUseUnknownEntityEvent(@NotNull Player player, int entityId, boolean attack, @NotNull EquipmentSlot hand, @Nullable Vector clickedPosition) {
+ super(player);
+ this.entityId = entityId;
+ this.attack = attack;
+ this.hand = hand;
@ -59,7 +63,7 @@ index 0000000000000000000000000000000000000000..a7228e248e3d8eb2e9f011dfe2c7dd9f
+ /**
+ * Returns whether the interaction was an attack.
+ *
+ * @return true if the player is attacking the entity, false if the player is interacting with the entity
+ * @return {@code true} if the player is attacking the entity, {@code false} if the player is interacting with the entity
+ */
+ public boolean isAttack() {
+ return this.attack;
@ -75,11 +79,11 @@ index 0000000000000000000000000000000000000000..a7228e248e3d8eb2e9f011dfe2c7dd9f
+ }
+
+ /**
+ * Returns the position relative to the entity that was clicked, or null if not available.
+ * See {@link org.bukkit.event.player.PlayerInteractAtEntityEvent} for more details.
+ * Returns the position relative to the entity that was clicked, or {@code null} if not available.
+ * See {@link PlayerInteractAtEntityEvent} for more details.
+ *
+ * @return the position relative to the entity that was clicked, or null if not available
+ * @see org.bukkit.event.player.PlayerInteractAtEntityEvent
+ * @return the position relative to the entity that was clicked, or {@code null} if not available
+ * @see PlayerInteractAtEntityEvent
+ */
+ public @Nullable Vector getClickedRelativePosition() {
+ return this.clickedPosition != null ? this.clickedPosition.clone() : null;
@ -88,11 +92,11 @@ index 0000000000000000000000000000000000000000..a7228e248e3d8eb2e9f011dfe2c7dd9f
+ @NotNull
+ @Override
+ public HandlerList getHandlers() {
+ return HANDLERS;
+ return HANDLER_LIST;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return HANDLERS;
+ return HANDLER_LIST;
+ }
+}