本文整理汇总了Java中ch.njol.skript.lang.Expression类的典型用法代码示例。如果您正苦于以下问题:Java Expression类的具体用法?Java Expression怎么用?Java Expression使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Expression类属于ch.njol.skript.lang包,在下文中一共展示了Expression类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import ch.njol.skript.lang.Expression; //导入依赖的package包/类
@Override
public boolean init(Expression<?>[] expr, int i, Kleenean kleenean, @NotNull SkriptParser.ParseResult parseResult) {
switch (parseResult.mark) {
case 0:
material = Material.POTION;
break;
case 1:
material = Material.SPLASH_POTION;
break;
case 2:
material = Material.LINGERING_POTION;
break;
case 3:
material = Material.TIPPED_ARROW;
break;
default:
material = Material.POTION;
break;
}
potionEffects = (Expression<PotionEffect>) expr[0];
return true;
}
示例2: init
import ch.njol.skript.lang.Expression; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public boolean init(Expression<?>[] exprs, int matchedPattern, Kleenean isDelayed,
SkriptParser.ParseResult parseResult) {
if (!ScriptLoader.isCurrentEvent(
CustomEffect.EffectEvent.class,
CustomExpression.ExpressionGetEvent.class,
CustomExpression.ExpressionChangeEvent.class,
CustomCondition.ConditionEvent.class
)) {
Skript.error("The expression 'expression' may only be used in a custom syntax.",
ErrorQuality.SEMANTIC_ERROR);
return false;
}
index = Utils.parseInt(parseResult.regexes.get(0).group(1));
if (index <= 0) {
Skript.error("The expression index must be a natural number.", ErrorQuality.SEMANTIC_ERROR);
return false;
}
index--;
plural = parseResult.mark == 1;
return true;
}
示例3: init
import ch.njol.skript.lang.Expression; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public boolean init(Expression<?>[] exprs, int matchedPattern, Kleenean isDelayed,
SkriptParser.ParseResult parseResult) {
if (!ScriptLoader.isCurrentEvent(
CustomEffect.EffectEvent.class,
CustomExpression.ExpressionGetEvent.class,
CustomExpression.ExpressionChangeEvent.class,
CustomCondition.ConditionEvent.class
)) {
Skript.error("Only custom syntax may be continued.", ErrorQuality.SEMANTIC_ERROR);
return false;
}
objects = Util.defendExpression(exprs[0]);
return Util.canInitSafely(objects);
}
示例4: init
import ch.njol.skript.lang.Expression; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public boolean init(Expression<?>[] exprs, int matchedPattern, Kleenean isDelayed,
SkriptParser.ParseResult parseResult) {
target = Util.defendExpression(exprs[0]);
switch (parseResult.mark) {
case 0:
mapper = Util::fields;
break;
case 1:
mapper = Util::methods;
break;
case 2:
mapper = Util::constructor;
break;
}
return Util.canInitSafely(target);
}
示例5: init
import ch.njol.skript.lang.Expression; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public boolean init(Expression<?>[] exprs, int matchedPattern, Kleenean isDelayed,
SkriptParser.ParseResult parseResult) {
className = (Expression<String>) exprs[0];
if (exprs[1] != null) {
if (!(exprs[1] instanceof Variable)) {
return false;
}
var = (Variable) exprs[1];
}
return true;
}
示例6: init
import ch.njol.skript.lang.Expression; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public boolean init(Expression<?>[] exprs, int matchedPattern, Kleenean isDelayed,
SkriptParser.ParseResult parseResult) {
expr = Util.defendExpression(exprs[0]);
if (!Util.canInitSafely(expr)) {
return false;
}
if (!(expr instanceof ExprJavaCall)) {
Skript.error("Try may only be used with Java calls");
return false;
}
((ExprJavaCall) expr).setSuppressErrors(true);
return true;
}
示例7: init
import ch.njol.skript.lang.Expression; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public boolean init(Expression<?>[] exprs, int matchedPattern, Kleenean isDelayed,
SkriptParser.ParseResult parseResult) {
target = Util.defendExpression(exprs[0]);
switch (parseResult.mark) {
case 0:
mapper = Util::fields;
break;
case 1:
mapper = Util::methods;
break;
}
return Util.canInitSafely(target);
}
示例8: get
import ch.njol.skript.lang.Expression; //导入依赖的package包/类
@Override
protected Expression[] get(Event e) {
Expression<?> expr = this.expr;
if (expr instanceof ExprExpression && e instanceof CustomSyntaxEvent) {
expr = ((ExprExpression) expr).getExpression(e).getSource();
}
return new Expression[]{expr};
}
示例9: init
import ch.njol.skript.lang.Expression; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public boolean init(Expression<?>[] exprs, int matchedPattern, Kleenean isDelayed,
SkriptParser.ParseResult parseResult) {
if (!ScriptLoader.isCurrentEvent(
CustomEffect.EffectEvent.class,
CustomExpression.ExpressionGetEvent.class,
CustomExpression.ExpressionChangeEvent.class,
CustomCondition.ConditionEvent.class
)) {
Skript.error("The parser mark may only be used in custom syntax.",
ErrorQuality.SEMANTIC_ERROR);
}
return true;
}
示例10: init
import ch.njol.skript.lang.Expression; //导入依赖的package包/类
@Override
public boolean init(Expression<?>[] exprs, int matchedPattern, Kleenean isDelayed,
SkriptParser.ParseResult parseResult) {
if (!ScriptLoader.isCurrentEvent(CustomExpression.ExpressionChangeEvent.class)) {
Skript.error("The change mode may only be used in change handlers.",
ErrorQuality.SEMANTIC_ERROR);
}
return true;
}
示例11: init
import ch.njol.skript.lang.Expression; //导入依赖的package包/类
@Override
public boolean init(Expression<?>[] expressions, int i, Kleenean kleenean, SkriptParser.ParseResult parseResult) {
VariableString v = VariableString.newInstance(parseResult.regexes.get(0).group(), StringMode.VARIABLE_NAME);
if (v == null) {
Skript.error("Invalid reference name.");
return false;
}
variableName = v;
return true;
}
示例12: init
import ch.njol.skript.lang.Expression; //导入依赖的package包/类
@Override
public boolean init(Expression<?>[] expr, int i, Kleenean kleenean, SkriptParser.ParseResult parseResult) {
type = (Expression<PotionEffectType>) expr[0];
duration = (Expression<Timespan>) expr[1];
level = (Expression<Number>) expr[2];
particles = (Expression<Boolean>) expr[3];
ambient = (Expression<Boolean>) expr[4];
color = (Expression<Color>) expr[5];
return true;
}
示例13: init
import ch.njol.skript.lang.Expression; //导入依赖的package包/类
@Override
public boolean init(Expression<?>[] exprs, int matchedPattern, Kleenean isDelayed, SkriptParser.ParseResult parseResult) {
if (!ScriptLoader.isCurrentEvent(PlaceholderAPIEvent.class)) {
Skript.error("The PlaceholderAPI identifier can only be used in a placeholder request event", ErrorQuality.SEMANTIC_ERROR);
return false;
}
return true;
}
示例14: init
import ch.njol.skript.lang.Expression; //导入依赖的package包/类
@Override
public boolean init(Expression<?>[] exprs, int matchedPattern, Kleenean isDelayed, SkriptParser.ParseResult parseResult) {
if (!ScriptLoader.isCurrentEvent(PlaceholderAPIEvent.class)) {
Skript.error("The PlaceholderAPI prefix can only be used in a placeholder request event", ErrorQuality.SEMANTIC_ERROR);
return false;
}
return true;
}
示例15: init
import ch.njol.skript.lang.Expression; //导入依赖的package包/类
@Override
public boolean init(Expression<?>[] exprs, int matchedPattern, Kleenean isDelayed, SkriptParser.ParseResult parseResult) {
if (!ScriptLoader.isCurrentEvent(PlaceholderAPIEvent.class)) {
Skript.error("The PlaceholderAPI result can only be used in a placeholder request event", ErrorQuality.SEMANTIC_ERROR);
return false;
}
return true;
}