diff --git a/src/main/java/com/btk5h/skriptmirror/util/ClassInfoReference.java b/src/main/java/com/btk5h/skriptmirror/util/ClassInfoReference.java index 98b7239..f931118 100644 --- a/src/main/java/com/btk5h/skriptmirror/util/ClassInfoReference.java +++ b/src/main/java/com/btk5h/skriptmirror/util/ClassInfoReference.java @@ -4,6 +4,7 @@ import ch.njol.skript.expressions.base.WrapperExpression; import ch.njol.skript.lang.Expression; import ch.njol.skript.lang.SkriptParser; +import ch.njol.skript.lang.util.SimpleExpression; import ch.njol.util.Kleenean; import org.bukkit.event.Event; import org.eclipse.jdt.annotation.Nullable; @@ -49,7 +50,12 @@ public boolean isPlural() { public static Expression getFromClassInfoExpression(Expression> expression) { ClassInfoReference parsedReference = SkriptUtil.getClassInfoReference(expression); - return new WrapperExpression() { + return new SimpleExpression() { + + @Override + public boolean init(Expression[] expressions, int matchedPattern, Kleenean isDelayed, SkriptParser.ParseResult parseResult) { + return expression.init(expressions, matchedPattern, isDelayed, parseResult); + } @Override protected ClassInfoReference[] get(Event event) { @@ -69,14 +75,22 @@ protected ClassInfoReference[] get(Event event) { } } + public Class getReturnType() { + return ClassInfoReference.class; + } + @Override - public String toString(@Nullable Event event, boolean debug) { - return expression.toString(event, debug); + public boolean isSingle() { + return expression.isSingle(); } + @Override - public boolean init(Expression[] expressions, int matchedPattern, Kleenean isDelayed, SkriptParser.ParseResult parseResult) { - return expression.init(expressions, matchedPattern, isDelayed, parseResult); + public String toString(@Nullable Event event, boolean debug) { + if (debug) { + return expression.toString(event, true) + " (wrapped by ClassInfoReference)"; + } + return expression.toString(event, false); } };