@@ -680,7 +680,11 @@ private static <T extends SyntaxElement> boolean checkExperimentalSyntax(T eleme
680680 if (classInfoMatcher .matches ()) {
681681 String literalString = classInfoMatcher .group ("literal" );
682682 String unparsedClassInfo = Noun .stripDefiniteArticle (classInfoMatcher .group ("classinfo" ));
683- return parseSpecifiedLiteral (literalString , unparsedClassInfo , log , types );
683+ Expression <?> result = parseSpecifiedLiteral (literalString , unparsedClassInfo , types );
684+ if (result != null ) {
685+ log .printLog ();
686+ return result ;
687+ }
684688 }
685689 }
686690 if (exprInfo .classes .length == 1 && exprInfo .classes [0 ].getC () == Object .class ) {
@@ -752,38 +756,31 @@ private static <T extends SyntaxElement> boolean checkExperimentalSyntax(T eleme
752756 * </p>
753757 * @param literalString A {@link String} representing a literal
754758 * @param unparsedClassInfo A {@link String} representing a class info
755- * @param log The current {@link ParseLogHandler} for containing errors
756759 * @param types An {@link Array} of the acceptable {@link Class}es
757760 * @return {@link SimpleLiteral} or {@code null} if any checks fail
758761 */
759762 private @ Nullable Expression <?> parseSpecifiedLiteral (
760763 String literalString ,
761764 String unparsedClassInfo ,
762- ParseLogHandler log ,
763765 Class <?> ... types
764766 ) {
765767 ClassInfo <?> classInfo = Classes .parse (unparsedClassInfo , ClassInfo .class , context );
766768 if (classInfo == null ) {
767- log . printError ( );
769+ Skript . error ( "A " + unparsedClassInfo + " is not a valid type." );
768770 return null ;
769771 }
770772 Parser <?> classInfoParser = classInfo .getParser ();
771773 if (classInfoParser == null || !classInfoParser .canParse (context )) {
772774 Skript .error ("A " + unparsedClassInfo + " cannot be parsed." );
773- log .printError ();
774775 return null ;
775776 }
776777 if (!checkAcceptedType (classInfo .getC (), types )) {
777778 Skript .error (expr + " " + Language .get ("is" ) + " " + notOfType (types ));
778- log .printError ();
779779 return null ;
780780 }
781781 Object parsedObject = classInfoParser .parse (literalString , context );
782- if (parsedObject != null ) {
783- log .printLog ();
782+ if (parsedObject != null )
784783 return new SimpleLiteral <>(parsedObject , false , new UnparsedLiteral (literalString ));
785- }
786- log .printError ();
787784 return null ;
788785 }
789786
0 commit comments