2018-09-01 06:56:57 +08:00
|
|
|
From a4e04803a51a04f1963738c2c8b147ad162daed0 Mon Sep 17 00:00:00 2001
|
2018-07-15 09:53:17 +08:00
|
|
|
From: Jedediah Smith <jedediah@silencegreys.com>
|
|
|
|
Date: Sat, 2 Apr 2016 05:09:16 -0400
|
|
|
|
Subject: [PATCH] Add PlayerUseUnknownEntityEvent
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/PacketPlayInUseEntity.java b/src/main/java/net/minecraft/server/PacketPlayInUseEntity.java
|
2018-09-01 06:56:57 +08:00
|
|
|
index a4b98c81f5..53d38ea40f 100644
|
2018-07-15 09:53:17 +08:00
|
|
|
--- a/src/main/java/net/minecraft/server/PacketPlayInUseEntity.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/PacketPlayInUseEntity.java
|
2018-09-01 06:56:57 +08:00
|
|
|
@@ -4,7 +4,7 @@ import java.io.IOException;
|
|
|
|
import javax.annotation.Nullable;
|
2018-07-19 02:55:52 +08:00
|
|
|
|
2018-07-15 09:53:17 +08:00
|
|
|
public class PacketPlayInUseEntity implements Packet<PacketListenerPlayIn> {
|
|
|
|
- private int a;
|
|
|
|
+ private int a; public int getEntityId() { return this.a; } // Paper - add accessor
|
|
|
|
private PacketPlayInUseEntity.EnumEntityUseAction action;
|
|
|
|
private Vec3D c;
|
|
|
|
private EnumHand d;
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
|
2018-09-01 06:56:57 +08:00
|
|
|
index 62f35d2672..306ef5bf79 100644
|
2018-07-15 09:53:17 +08:00
|
|
|
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
|
2018-08-27 02:11:49 +08:00
|
|
|
@@ -1903,6 +1903,16 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
|
2018-07-15 09:53:17 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
+ // Paper start - fire event
|
|
|
|
+ else {
|
|
|
|
+ this.server.getPluginManager().callEvent(new com.destroystokyo.paper.event.player.PlayerUseUnknownEntityEvent(
|
|
|
|
+ this.getPlayer(),
|
|
|
|
+ packetplayinuseentity.getEntityId(),
|
2018-07-18 13:08:17 +08:00
|
|
|
+ packetplayinuseentity.b() == PacketPlayInUseEntity.EnumEntityUseAction.ATTACK,
|
|
|
|
+ packetplayinuseentity.c() == EnumHand.MAIN_HAND ? EquipmentSlot.HAND : EquipmentSlot.OFF_HAND
|
2018-07-15 09:53:17 +08:00
|
|
|
+ ));
|
|
|
|
+ }
|
|
|
|
+ // Paper end
|
2018-07-19 02:55:52 +08:00
|
|
|
|
2018-07-15 09:53:17 +08:00
|
|
|
}
|
2018-07-19 02:55:52 +08:00
|
|
|
|
|
|
|
--
|
|
|
|
2.18.0
|
2018-07-15 09:53:17 +08:00
|
|
|
|