-
Notifications
You must be signed in to change notification settings - Fork 146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cancel spells casted on players? API? #1405
Comments
Hello! Thanks for your interest :) The cleanest way to do that is to use the Magic API, so that your plugin can work as a PVP status provider. If that's something you're up for doing, it's pretty easy, especially if your plugin already uses Maven for building. Here are the general instructions for using the API, including Maven repository and dependency information: https://github.com/elBukkit/MagicPlugin/tree/master/MagicAPI This also shows how to get a reference to the MageController instance from the plugin. Then what you would do is implement the PVPController interface in your plugin. This interface just has one method:
This is asking if a player can PVP in a specific location. The location will be the target of the spell, so not necessarily in the same place as the player. This could be important if you have pvp-free zones that a player could try to shoot at from outside the zone. If location is irrelevant for your plugin then of course you can just ignore that parameter. And then finally you call MageController.register, passing the instance to your class where you've implemented PVPController. If you do all of that, then Magic will ask your plugin any time a player casts a spell, whether or not that spell can target another player. This will prevent the spell from hitting players at all, the same as if you were using WorldGuard or some other supported PVP / Protection plugin. Note that some spells are tagged as "friendly", such as the heal spell, and will be allowed either way. This can be changed in the spell's configs if that ends up being a problem. I hope that helps, let me know if you get stuck or have any questions! |
I have a survival server, in which at some times of the day, PvP is activated. However, I don't want to disable the spells entirely, because my players use them to hit mobs and sometimes PvP will be active. Is there a way to get if the spell will target specifically on a player with that method? |
Yup, if you do what I outlined above all of the spells will still work, they just wont' target other players. |
Hi! Thank you for your awesome plugin! I have a custom PvP timer system and I have already canceled damage-related spells listening for Projectiles, however, there are some spells, like the Blinding, Poison, Wind (Flipendo?) that still target other players. How can I listen or cancel them to act on other players?
The text was updated successfully, but these errors were encountered: