API support for allowing bow fire attempts to succeed without arrows #10556
TheBentoBox
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Is your feature request related to a problem?
If possible, it would be nice to have an event which indicates that a player has attempted to begin the process of shooting a bow/crossbow, in such a way that we could allow the event to go through even in normally disallowed circumstances (i.e., not having arrows).
To give an example/context of how it could be used: I'm working on custom features for my server, including a bow which can store items in it (a "bow and quiver" type of thing). Logically, I should be able to fire this bow with arrows "from the quiver" even if I don't have arrows in my inventory, but that's much easier said than done.
The server is authoritative as to whether or not a bow firing attempt will begin when a player interact is received, so it seems logical that the API should expose a way to control this more finely if it is possible to do so.
Describe the solution you'd like.
Perhaps the
PlayerReadyArrowEvent
could fire in a pre-cancelled state in scenarios where there is no arrow to be readied, allowing it to be uncancelled to still allow the bow readying to begin. This would mimic stuff likeEntityResurrectEvent
. Alternatively, maybe it could fire withgetArrow()
as null, and asetArrow()
could be introduced, but this would be a breaking API change asgetArrow()
is currently@NotNull
.Describe alternatives you've considered.
I've put workarounds in place to attempt to do what I want right now, but makeshift solutions to problems like this require essentially rewriting much of the logic of core gameplay features (in this case bow firing), and hacky workarounds like granting temporary arrows to allow the firing process to begin in the first place. It may "work", but it's clunky and not ideal.
It also raises questions of safety/security when having to do inventory manipulation and recreations of server logic -- am I doing it correctly? Am I addressing all of the caveats? How compatible is this with popular existing plugins (mcMMO)?
Other
I got the idea for submitting this after seeing that Purpur has a setting which allows you to fire Infinity bows without arrows. Seeing that that's possible gave me hope that the same could be done more generically and exposed via the event API. I filed it at this level (Paper, not Spigot or Purpur) because
PlayerReadyArrow
is a Paper event and it seems like the right area of the API where support for this could be added.Beta Was this translation helpful? Give feedback.
All reactions