本文整理汇总了Java中ch.njol.skript.lang.util.SimpleLiteral类的典型用法代码示例。如果您正苦于以下问题:Java SimpleLiteral类的具体用法?Java SimpleLiteral怎么用?Java SimpleLiteral使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SimpleLiteral类属于ch.njol.skript.lang.util包,在下文中一共展示了SimpleLiteral类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: simplify
import ch.njol.skript.lang.util.SimpleLiteral; //导入依赖的package包/类
@SuppressWarnings("null")
@Override
public Expression<? extends Number> simplify() {
if (first instanceof Literal && second instanceof Literal)
return new SimpleLiteral<Number>(getArray(null), Number.class, false);
return this;
}
示例2: init
import ch.njol.skript.lang.util.SimpleLiteral; //导入依赖的package包/类
@SuppressWarnings({"unchecked", "null"})
@Override
public boolean init(final Expression<?>[] exprs, final int matchedPattern, final Kleenean isDelayed, final ParseResult parseResult) {
start = matchedPattern == 0 ? (Expression<Number>) exprs[0] : new SimpleLiteral<Number>(1, false);
end = (Expression<Number>) exprs[1 - matchedPattern];
integer = parseResult.mark == 1 || matchedPattern == 1;
return true;
}
示例3: init
import ch.njol.skript.lang.util.SimpleLiteral; //导入依赖的package包/类
@SuppressWarnings({"unchecked", "null"})
@Override
public boolean init(final Expression<?>[] exprs, final int matchedPattern, final Kleenean isDelayed, final ParseResult parseResult) {
if (matchedPattern == 0)
line = (Expression<Number>) exprs[0];
else
line = new SimpleLiteral<Number>(parseResult.mark, false);
block = (Expression<Block>) exprs[exprs.length - 1];
return true;
}
示例4: simplify
import ch.njol.skript.lang.util.SimpleLiteral; //导入依赖的package包/类
@Override
public Expression<T> simplify() {
boolean isSimpleList = true;
for (int i = 0; i < expressions.length; i++)
isSimpleList &= expressions[i].isSingle();
if (isSimpleList) {
@SuppressWarnings("unchecked")
final T[] values = (T[]) Array.newInstance(getReturnType(), expressions.length);
for (int i = 0; i < values.length; i++)
values[i] = ((Literal<? extends T>) expressions[i]).getSingle();
return new SimpleLiteral<T>(values, getReturnType(), and);
}
return this;
}
示例5: newInstance
import ch.njol.skript.lang.util.SimpleLiteral; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Nullable
public static <T> Parameter<T> newInstance(final String name, final ClassInfo<T> type, final boolean single, final @Nullable String def) {
if (!Variable.isValidVariableName(name, false, false)) {
Skript.error("An argument's name must be a valid variable name, and cannot be a list variable.");
return null;
}
Expression<? extends T> d = null;
if (def != null) {
// if (def.startsWith("%") && def.endsWith("%")) {
// final RetainingLogHandler log = SkriptLogger.startRetainingLog();
// try {
// d = new SkriptParser("" + def.substring(1, def.length() - 1), SkriptParser.PARSE_EXPRESSIONS, ParseContext.FUNCTION_DEFAULT).parseExpression(type.getC());
// if (d == null) {
// log.printErrors("Can't understand this expression: " + def + "");
// return null;
// }
// log.printLog();
// } finally {
// log.stop();
// }
// } else {
final RetainingLogHandler log = SkriptLogger.startRetainingLog();
try {
if (type.getC() == String.class) {
if (def.startsWith("\"") && def.endsWith("\""))
d = (Expression<? extends T>) VariableString.newInstance("" + def.substring(1, def.length() - 1));
else
d = (Expression<? extends T>) new SimpleLiteral<String>(def, false);
} else {
d = new SkriptParser(def, SkriptParser.PARSE_LITERALS, ParseContext.DEFAULT).parseExpression(type.getC());
}
if (d == null) {
log.printErrors("'" + def + "' is not " + type.getName().withIndefiniteArticle());
return null;
}
log.printLog();
} finally {
log.stop();
}
// }
}
return new Parameter<T>(name, type, single, d);
}