|
1 | 1 | package org.skriptlang.reflect.syntax.custom.shared.elements.expressions; |
2 | 2 |
|
3 | 3 | import ch.njol.skript.classes.Changer.ChangeMode; |
| 4 | +import ch.njol.skript.expressions.base.PropertyExpression; |
4 | 5 | import ch.njol.skript.lang.Expression; |
5 | 6 | import ch.njol.skript.lang.SkriptParser.ParseResult; |
6 | 7 | import ch.njol.skript.lang.util.SimpleExpression; |
| 8 | +import ch.njol.skript.util.LiteralUtils; |
7 | 9 | import ch.njol.util.Kleenean; |
8 | 10 | import com.btk5h.skriptmirror.skript.reflect.ExprJavaCall; |
9 | 11 | import org.bukkit.event.Event; |
10 | 12 | import org.jetbrains.annotations.Nullable; |
11 | 13 | import org.skriptlang.reflect.syntax.custom.shared.CustomSyntaxEvent; |
12 | | -import org.skriptlang.skript.registration.SyntaxInfo; |
13 | 14 | import org.skriptlang.skript.registration.SyntaxRegistry; |
14 | 15 |
|
15 | 16 | public class ExprRawExpression extends SimpleExpression<Expression> { |
16 | 17 |
|
17 | 18 | public static void register(SyntaxRegistry registry) { |
18 | | - registry.register(SyntaxRegistry.EXPRESSION, SyntaxInfo.Expression.builder(ExprRawExpression.class, Expression.class) |
| 19 | + registry.register(SyntaxRegistry.EXPRESSION, PropertyExpression.infoBuilder( |
| 20 | + ExprRawExpression.class, |
| 21 | + Expression.class, |
| 22 | + "(raw|underlying) expression[s]", |
| 23 | + "objects", |
| 24 | + false |
| 25 | + ) |
19 | 26 | .supplier(ExprRawExpression::new) |
20 | | - .addPattern("[the] (raw|underlying) expression[s] of %objects%") |
21 | | - .addPattern("%objects%'[s] (raw|underlying) expression[s]") |
22 | | - .priority(SyntaxInfo.PATTERN_MATCHES_EVERYTHING) |
23 | 27 | .build()); |
24 | 28 | } |
25 | 29 |
|
26 | 30 | private Expression<?> expr; |
27 | 31 |
|
28 | 32 | @Override |
29 | 33 | public boolean init(Expression<?>[] expressions, int matchedPattern, Kleenean isDelayed, ParseResult parseResult) { |
30 | | - expr = expressions[0]; |
31 | | - return true; |
| 34 | + expr = LiteralUtils.defendExpression(expressions[0]); |
| 35 | + return LiteralUtils.canInitSafely(expressions); |
32 | 36 | } |
33 | 37 |
|
34 | 38 | @Override |
|
0 commit comments