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 <nassim@njahnke.dev>
This commit is contained in:
Jedediah Smith
2016-04-02 05:09:16 -04:00
parent f9ef3612f7
commit e2263633d4
3 changed files with 95 additions and 40 deletions

View File

@@ -1929,4 +1929,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
}