Yatopia/patches/api/0028-EMC-Add-a-PlayerThrowTrident-event.patch
2020-02-26 21:44:51 +01:00

69 lines
2.0 KiB
Diff

From b5460992e5d12d962a1ae4bff91a0a4902fadb2a Mon Sep 17 00:00:00 2001
From: chickeneer <emcchickeneer@gmail.com>
Date: Fri, 29 Nov 2019 02:47:35 -0600
Subject: [PATCH] EMC Add a PlayerThrowTrident event
---
.../event/player/PlayerThrowTridentEvent.java | 49 +++++++++++++++++++
1 file changed, 49 insertions(+)
create mode 100644 src/main/java/com/destroystokyo/paper/event/player/PlayerThrowTridentEvent.java
diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerThrowTridentEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerThrowTridentEvent.java
new file mode 100644
index 00000000..1ee88dcf
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerThrowTridentEvent.java
@@ -0,0 +1,49 @@
+package com.destroystokyo.paper.event.player;
+
+import org.bukkit.entity.Entity;
+import org.bukkit.entity.Player;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.player.PlayerEvent;
+import org.bukkit.inventory.ItemStack;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Called when a Player throws a trident
+ */
+public class PlayerThrowTridentEvent extends PlayerEvent {
+ private static final HandlerList handlers = new HandlerList();
+ private final Entity projectile;
+ private final ItemStack tridentItem;
+
+ @NotNull
+ public ItemStack getTridentItem() {
+ return tridentItem;
+ }
+
+ public PlayerThrowTridentEvent(@NotNull final Player shooter, @NotNull ItemStack tridentItem, @NotNull final Entity projectile) {
+ super(shooter);
+ this.tridentItem = tridentItem;
+ this.projectile = projectile;
+ }
+
+ /**
+ * Gets the projectile which will be launched by this event
+ *
+ * @return the launched projectile
+ */
+ @NotNull
+ public Entity getProjectile() {
+ return projectile;
+ }
+
+ @NotNull
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+}
--
2.25.1.windows.1