On arrow fired by player event: get arrow, add nbt with the NBT named "owner" and set it to player's name On arrow collided event: check if it have a NBT named owner and check if the player is online remove/despawn the arrow then tp the player somewhere near the arrow that's safe to be spawned(so the player dont get stuck in weird places and die)
of which part you need a code example to understand it? Here is a more examples This one should help you with NBT https://forums.pmmp.io/threads/how-do-you-properly-set-nbt.1182/#post-13782 for On arrow fired by player event try ProjectileLaunchEvent and check if it's fired by a player that's online for On arrow collided event try ProjectileHitEvent (not very sure) and check if it's a arrow, optionally checks if it hits on block or entity then disallowing whatever you wish
what you meant by complete example? do i need to lay out every syntax and so on? am i expecting too much by using too many layers of abstractions and assuming most people would be able to understand them reasonably? most likely i already told you what you needed to know to make it work
This is the plugin development subforum, not the plugin requests. If you make your own plugin, please at least try it yourself.
This is the Code PHP: public function onTeleport(ProjectileHitEvent $event) { $arrow = $event->getEntity(); if($arrow instanceof Arrow) { $player = $arrow->shootingEntity; if($player instanceof Player) { $player->teleport($arrow); } }
code: PHP: public function onHit(ProjectileHitEvent $ev){ $arrow = $ev->getEntity(); if($arrow instanceof Arrow){ $x = $arrow->getX(); $y = $arrow->getY(); $z = $arrow->getZ(); $lvl = $arrow->getLevel(); $player->teleport(new Position($x, $y, $z, $lvl)); } }