Skript
Skript copied to clipboard
Literal Multiple Infos Warning
Description
This PR aims to add a warning when a literal, that can be referenced to multiple ClassInfos/types, is used. The warning informs the user that the literal can be referenced to multiple types and that they should consider specifying which type to use, using the new literal specification feature introduced in 2.11.
This PR also fixes a bug that was present within SkriptParser#parseSingleExpr where when an element's pattern allowed multiple types, including Object for an expression (%.../.../object%) if all other types failed to be parsed and reached Object, it did not treat it correctly as seen with the prior condition check (if (exprInfo.classes[0].getC() == Object.class) {). Which lead to the literal being parsed as the first ClassInfo that gets registered with that pattern. Now the loop will log if it reaches Object and continue to attempt every other ClassInfo. If all fail, and Object was logged, will use the method #getUnparsedLiteral which is the code from the aforementioned condition, to prevent duplicated code.
With that change, a fix was required for CondContains as it did not properly handle UnparsedLiterals.
Target Minecraft Versions: any Requirements: none Related Issues: none