-
-
Notifications
You must be signed in to change notification settings - Fork 382
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
Damage effect fixes #4003
Damage effect fixes #4003
Conversation
In my testing, I was able to get it to work, with the caveat that the damage effect processes twice (first for the designated cause and then again for "unknown" if the first was not cancelled.) Are you sure there's no way? I was going to do more research to see if I could get it to only call the damage once. |
The first event call you had, was from Skript calling the event manually (which I removed, as it shouldn't do this). The second is the actual event being called from your server, the damage cause of which cannot be set without reflection (and probably NMS). |
Yeah... upon further analysis, I noticed that the event call doesn't deal the damage directly, instead only being used to check if the event is being cancelled. Why shouldn't it call the event manually, though? If the damage event can be made to apply the damage, that should solve the issue, unless I'm misunderstanding the way Bukkit events work. |
Bukkit events are only called to let plugins know something happened, no internal server stuff relies on events being called. The player will therefore not be damaged if an event is called, all it will do is confuse other plugins (and scripts), because it seems like the player is taking damage twice, even though it's only once. EDIT: well done on the debugging and testing, by the way 👍 |
(Thanks) It's probably too hacky to have it call the event and then play the hit animation and reduce the HP directly in accordance with the final damage amount, right? |
src/main/java/ch/njol/skript/expressions/ExprLastDamageCause.java
Outdated
Show resolved
Hide resolved
Yep |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
Description
ItemStack
, should beItemType
).Target Minecraft Versions: any
Requirements: none
Related Issues: #3997, #3715 (also #3719, #2755, #2836)