-
-
Notifications
You must be signed in to change notification settings - Fork 385
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
Bug: contains not working propperly with lists stored in options #1404
Comments
Addition: could only reproduce when more than three values are defined, valid issue. Note: The player's world is not related to the issue, it's in general. The contains condition has been modified a lot by Bensku over the life of this fork, potential issue in the condition. |
I was able to reproduce the issue with this code:
but not this code
I'll keep looking into this issue and maybe PR if I can find a fix. |
I have identified why the issue happens. Keep in mind implementations of Expression#check should (and I think all implementations in Skript follow this) return true if getAnd() is true and all elements pass the checker, or if getAnd() is false and any of the elements pass the checker. When you check if a list variable contains a string, it will be This is not an issue specific to being used with options. This is if an ExpressionList is passed to CondCompare. However when you use an ExpressionList ( Now you may ask, what happens if you use I hope I explained it clearly enough. Proposed Solution: Don't use Expression#check (as it considers getAnd() into the result) and instead loop through the TL;DR: When variables are used in the contains condition they get special treatment and getAnd() is ignored. This isn't the same case for ExpressionList though. |
I'm not going to PR because I'm not sure of the best way to fix it and if that will cause any unforeseen side effects with other use cases of the contains condition. |
for some reason the contains statement is not working correctly with options,
I debugged it and the following thing seemed to work so this is probbably an issue with expressionlist comparisons.
The text was updated successfully, but these errors were encountered: