-
-
Notifications
You must be signed in to change notification settings - Fork 368
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
on damage: message "something"
does not error
#1415
Comments
to add some info to this: it seems like the error is going off but gets stuck in a log handler somewhere |
I always thought Skript errored saying that you need to specify the player receiving the message? Such as the attacker or the victim. |
@nfell2009 iirc people on skUnity said that it only errors when you explicitly use |
I thought it defaulted to the victim? 🤔 |
@OfusMC nope, it does completely nothing |
Not really sure what prio to put this at, I'm considering medium since I know many have encountered this behavior before including myself and it's unclear what's happening. |
Andrew made a fix for this iirc |
I tried to but I couldn't figure out how to print the error message in the part of the SkriptParser where I wrote the patch (Github name is set wrong :|): master...xXAndrew28Xx:fix-1415 (Skript.error would not work in this location for some reason) |
Isn't it the same system like the parse expression? Call it to listen then parse and an error gets printed |
Hmm I'll look into that. Thanks. |
Found and fixed bug; The issue is this mess https://github.com/SkriptLang/Skript/blob/master/src/main/java/ch/njol/skript/registrations/EventValues.java#L165-L181 Readable version: for (EventValueInfo<?, ?> ev : eventValues) {
if (!c.isAssignableFrom(ev.c)) // Projectile would pass
continue;
if (!EventValues.checkExcludes(ev, e)) // EntityDamageByDamage (ev.event) is not assignable from EntityDamageEvent
return null;
if (ev.event.isAssignableFrom(e)) // EntityDamageByDamage (ev.event) is not assignable from EntityDamageEvent
return (Getter<? extends T, ? super E>) ev.getter;
if (!e.isAssignableFrom(ev.event)) // EntityDamageByDamage (ev.event) is not assignable from EntityDamageEvent
continue;
return new Getter<T, E>() {
@Override
@Nullable
public T get(E event) {
// This looks like a fix that was added afterwards, because lots of related events can get here.
if (!ev.event.isInstance(event)) // EntityDamageByDamage (ev.event) is not an instance of EntityDamageEvent
return null; // Why EffMessage with no command sender doesn't work for default expressions.
return ((Getter<? extends T, E>) ev.getter).get(event);
}
};
} The issue is that the event value https://github.com/SkriptLang/Skript/blob/master/src/main/java/ch/njol/skript/classes/data/BukkitEventValues.java#L402 is taking priority, the projectile is an entity/commandsender, so it passes those isAssignableFrom, it passes all the event isAssignableFrom because EntityDamageByEntity is not assignable from EntityDamageEvent it's vice versa, and the getter will return null because EntityDamageByEntity is not an instance of EntityDamageEvent, so the EffMessage default expression sends the message to no consolesender when attempting to grab a default event value. |
Code
this code loads with no errors, yet does nothing at runtime (neither sends the message to the victim nor to the attacker)
Expected behavior
It should error, saying that in the damage event either
attacker
orvictim
should be explicitly specifiedThe text was updated successfully, but these errors were encountered: