aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0858-Add-PlayerStopUsingItemEvent.patch
blob: 90dcaae6a1405c61c2c0229275ea47ac5b8211c0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: u9g <git@u9g.dev>
Date: Tue, 3 May 2022 20:41:37 -0400
Subject: [PATCH] Add PlayerStopUsingItemEvent


diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 73d931489c76f2effe71362a46a69087a1a09463..33c22f908440664dc9d67f1678a3c4bd8b862457 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3926,6 +3926,7 @@ public abstract class LivingEntity extends Entity {
 
     public void releaseUsingItem() {
         if (!this.useItem.isEmpty()) {
+            if (this instanceof ServerPlayer) new io.papermc.paper.event.player.PlayerStopUsingItemEvent((Player) getBukkitEntity(), useItem.asBukkitMirror(), getTicksUsingItem()).callEvent(); // Paper
             this.useItem.releaseUsing(this.level, this, this.getUseItemRemainingTicks());
             if (this.useItem.useOnRelease()) {
                 this.updatingUsingItem();