diff options
author | Riley Park <[email protected]> | 2024-05-15 17:06:59 -0700 |
---|---|---|
committer | GitHub <[email protected]> | 2024-05-15 17:06:59 -0700 |
commit | f17519338bc589c045e0b32bfc37e048b23544d5 (patch) | |
tree | e50182ec698b4a9de8f366f485ee089b1901bbd9 /patches/server/0085-Add-PlayerUseUnknownEntityEvent.patch | |
parent | 3fc93581bb876e8149b2ca423375a98f5ca12d27 (diff) | |
download | Paper-f17519338bc589c045e0b32bfc37e048b23544d5.tar.gz Paper-f17519338bc589c045e0b32bfc37e048b23544d5.zip |
Expose server build information (#10729)
* Expose server build information
* squash patches
* final tweaks
---------
Co-authored-by: Jake Potrebic <[email protected]>
Co-authored-by: masmc05 <[email protected]>
Diffstat (limited to 'patches/server/0085-Add-PlayerUseUnknownEntityEvent.patch')
-rw-r--r-- | patches/server/0085-Add-PlayerUseUnknownEntityEvent.patch | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/patches/server/0085-Add-PlayerUseUnknownEntityEvent.patch b/patches/server/0085-Add-PlayerUseUnknownEntityEvent.patch new file mode 100644 index 0000000000..8a7921ae97 --- /dev/null +++ b/patches/server/0085-Add-PlayerUseUnknownEntityEvent.patch @@ -0,0 +1,78 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jedediah Smith <[email protected]> +Date: Sat, 2 Apr 2016 05:09:16 -0400 +Subject: [PATCH] Add PlayerUseUnknownEntityEvent + +Adds the PlayerUseUnknownEntityEvent to be used by plugins dealing with +virtual entities/entities that are not actually known to the server. + +Co-authored-by: Nassim Jahnke <[email protected]> + +diff --git a/src/main/java/net/minecraft/network/protocol/game/ServerboundInteractPacket.java b/src/main/java/net/minecraft/network/protocol/game/ServerboundInteractPacket.java +index 1e9c68cd1868d083e6a790d56006dd4aa432010a..8a0ee9564fc36a2badf1357f7e6c47b5f1500f6c 100644 +--- a/src/main/java/net/minecraft/network/protocol/game/ServerboundInteractPacket.java ++++ b/src/main/java/net/minecraft/network/protocol/game/ServerboundInteractPacket.java +@@ -176,4 +176,14 @@ public class ServerboundInteractPacket implements Packet<ServerGamePacketListene + buf.writeEnum(this.hand); + } + } ++ ++ // Paper start - PlayerUseUnknownEntityEvent ++ public int getEntityId() { ++ return this.entityId; ++ } ++ ++ public boolean isAttack() { ++ return this.action.getType() == ActionType.ATTACK; ++ } ++ // Paper end - PlayerUseUnknownEntityEvent + } +diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +index ad598e57feb2d9db1b71cb3a432df22212aab9b3..555623fa4176c9ac4534cc7c5174d45f7c321ba1 100644 +--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java ++++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +@@ -2476,7 +2476,26 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl + }); + } + } ++ // Paper start - PlayerUseUnknownEntityEvent ++ else { ++ packet.dispatch(new net.minecraft.network.protocol.game.ServerboundInteractPacket.Handler() { ++ @Override ++ public void onInteraction(net.minecraft.world.InteractionHand hand) { ++ CraftEventFactory.callPlayerUseUnknownEntityEvent(ServerGamePacketListenerImpl.this.player, packet, hand, null); ++ } ++ ++ @Override ++ public void onInteraction(net.minecraft.world.InteractionHand hand, net.minecraft.world.phys.Vec3 pos) { ++ CraftEventFactory.callPlayerUseUnknownEntityEvent(ServerGamePacketListenerImpl.this.player, packet, hand, pos); ++ } + ++ @Override ++ public void onAttack() { ++ CraftEventFactory.callPlayerUseUnknownEntityEvent(ServerGamePacketListenerImpl.this.player, packet, net.minecraft.world.InteractionHand.MAIN_HAND, null); ++ } ++ }); ++ } ++ // Paper end - PlayerUseUnknownEntityEvent + } + + @Override +diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +index 4c59520355a21249d2a3132dbaae97fd4e17c86b..76be4e52f7e140cf1951ae8be8a468e2bb7df20e 100644 +--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java ++++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +@@ -1853,4 +1853,13 @@ public class CraftEventFactory { + + Bukkit.getPluginManager().callEvent(new EntityRemoveEvent(entity.getBukkitEntity(), cause)); + } ++ // Paper start - PlayerUseUnknownEntityEvent ++ public static void callPlayerUseUnknownEntityEvent(net.minecraft.world.entity.player.Player player, net.minecraft.network.protocol.game.ServerboundInteractPacket packet, InteractionHand hand, @Nullable net.minecraft.world.phys.Vec3 vector) { ++ new com.destroystokyo.paper.event.player.PlayerUseUnknownEntityEvent( ++ (Player) player.getBukkitEntity(), packet.getEntityId(), packet.isAttack(), ++ CraftEquipmentSlot.getHand(hand), ++ vector != null ? CraftVector.toBukkit(vector) : null ++ ).callEvent(); ++ } ++ // Paper end - PlayerUseUnknownEntityEvent + } |