API Events
xtomyserrax opened this issue ยท 10 comments
Could you please add to the API this events? PlayerPreTagEvent, PlayerPreUntagEvent, PlayerTagEvent, PlayerUntagEvent ; Or something like that?
The first two would be cancellable and in the other ones players are already tagged.
It would be amazing!
In my case I just need the events that cant be cancelled, but maybe for some other dev it could be useful to have cancellable events.
Oh so, in that case, I think you only needed to get the player in getPlayer and check if vanished since it gets called once for each, it shouldn't matter which one tagged who. Either way, the extra methods are still useful, I added them here: https://ci.md-5.net/job/PvPManager/338/
Also, the untag error should be fixed and added some documentation.
And yes, the plugin name is the same if you mean the name in plugin.yml. On the spigot page, the free version is called PvPManager Lite though.
Untag now works fine!
And I loved the new methods and documentation you made.
Thank you for everything, it seems stable. Let me know when you release the version to the public so I also release my hook .
In case you have a list of plugins hooking with PvPManager and you want to add mine its StaffFacilities. What the hook does is: preventing vanished players from tagging/being tagged, remove fly and remove god if you attack someone and get tagged.
Sorry for taking so long, the events are now on both versions, I think this can be closed. Let me know if you need anything else.
I have planned to add events like this for a long time, i just didn't know if anyone was interested.
Do you think the Pre events are necessary? Honestly i think it would be fine to only have a PlayerTagEvent and PlayerUntagEvent and have them both be cancellable.
In my case I need to be 100% sure the player is going to be tagged, so in that case I would need to use MONITOR then.
I suggested with and without Pre as CombatLogX does that, but yeah its as you prefer. Thanks!
I added those two events in a pretty basic way for now.
Download here https://ci.md-5.net/job/PvPManager/337/
Let me know if it works for you and if you think anything else is needed.
Yes, it fires once for each player. I'm thinking I could have a isAttacker() and a getEnemy() method. You could use the first to check if this is the tagger and the second would return the damager or the damaged depending on the result of isAttacker(). However, getEnemy() could also return null so you would have to check for that.
Speaking of getEnemy(), there is a similar method already inside PvPlayer which returns the last player to hit or that was hit by this player but it wouldn't be useful to you since I assume you want to know who attacked who and this method wouldn't tell you that.
It will work with the premium version but not with the current version, I will add it there once this is in a usable state. The untag error should be easy to fix.
Yeah sounds good. For me it would be amazing to know who attacked who, basicly to prevent a vanished player to get tagged (prevent the tag in general for that case) and if not, to add both players to this combat list in which they wont be able to use fly, god, feed and heal
Thank you so much for being open to it. Amazing that it will work with the Premium one too. The plugin name is the same, right?
Hey, could we get the damager in the event? Or the event is fired once for the damaged player and another time for the damager?
I also noticed this warn in console (just for untag, not tag): https://pastebin.com/u06rBTrX (basicly player is never getting untagged)
And despite I use the API from the free version my hook will work with the premium one either, right?