当前位置: 首页>>代码示例>>Java>>正文


Java SkriptParser类代码示例

本文整理汇总了Java中ch.njol.skript.lang.SkriptParser的典型用法代码示例。如果您正苦于以下问题:Java SkriptParser类的具体用法?Java SkriptParser怎么用?Java SkriptParser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SkriptParser类属于ch.njol.skript.lang包,在下文中一共展示了SkriptParser类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: init

import ch.njol.skript.lang.SkriptParser; //导入依赖的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;
}
 
开发者ID:Syst3ms,项目名称:QuarSK,代码行数:23,代码来源:ExprCustomPotionItem.java

示例2: init

import ch.njol.skript.lang.SkriptParser; //导入依赖的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);
}
 
开发者ID:btk5h,项目名称:skript-mirror,代码行数:21,代码来源:ExprMembers.java

示例3: init

import ch.njol.skript.lang.SkriptParser; //导入依赖的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;
}
 
开发者ID:btk5h,项目名称:skript-mirror,代码行数:17,代码来源:EffImport.java

示例4: init

import ch.njol.skript.lang.SkriptParser; //导入依赖的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;
}
 
开发者ID:btk5h,项目名称:skript-mirror,代码行数:20,代码来源:ExprTry.java

示例5: init

import ch.njol.skript.lang.SkriptParser; //导入依赖的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);
}
 
开发者ID:btk5h,项目名称:skript-mirror,代码行数:18,代码来源:ExprMemberNames.java

示例6: init

import ch.njol.skript.lang.SkriptParser; //导入依赖的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;
}
 
开发者ID:btk5h,项目名称:skript-mirror,代码行数:27,代码来源:ExprExpression.java

示例7: init

import ch.njol.skript.lang.SkriptParser; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public boolean init(Literal<?>[] args, int matchedPattern,
                    SkriptParser.ParseResult parseResult) {
  isChanger = (parseResult.mark & 1) == 1;

  String what = parseResult.regexes.get(0).group();
  switch (matchedPattern) {
    case 0:
      whiches.add(createSyntaxInfo(what, (parseResult.mark & 2) == 2, false));
      break;
    case 1:
      String fromType = ((Literal<ClassInfo>) args[0]).getSingle().getCodeName();
      whiches.add(createSyntaxInfo("[the] " + what + " of %$" + fromType + "s%", false, true));
      whiches.add(createSyntaxInfo("%$" + fromType + "s%'[s] " + what, false, false));
      break;
  }

  return true;
}
 
开发者ID:btk5h,项目名称:skript-mirror,代码行数:21,代码来源:CustomExpression.java

示例8: init

import ch.njol.skript.lang.SkriptParser; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public boolean init(Literal<?>[] args, int matchedPattern,
                    SkriptParser.ParseResult parseResult) {
  String c = parseResult.regexes.get(0).group();
  switch (matchedPattern) {
    case 0:
      whiches.add(createSyntaxInfo(c, false));
      break;
    case 1:
      String type = ((Literal<ClassInfo>) args[0]).getSingle().getCodeName();
      whiches.add(createSyntaxInfo("%" + type + "% (is|are) " + c, false));
      whiches.add(createSyntaxInfo("%" + type + "% (isn't|is not|aren't|are not) " + c, true));
      break;
  }

  return true;
}
 
开发者ID:btk5h,项目名称:skript-mirror,代码行数:19,代码来源:CustomCondition.java

示例9: init

import ch.njol.skript.lang.SkriptParser; //导入依赖的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);
}
 
开发者ID:btk5h,项目名称:skript-mirror,代码行数:20,代码来源:EffContinue.java

示例10: init

import ch.njol.skript.lang.SkriptParser; //导入依赖的package包/类
@Override
public boolean init(Expression<?>[] expressions, int i, Kleenean kleenean, SkriptParser.ParseResult parseResult) {
    if (i == 0) {
        xExpr = (Expression<Number>) expressions[0];
        yExpr = (Expression<Number>) expressions[1];
        zExpr = (Expression<Number>) expressions[2];
        chunkExpression = (Expression<Chunk>) expressions[3];
    } else {
        int mark = parseResult.mark;
        yExpr = (Expression<Number>) expressions[0];
        level = mark % 4;
        south = (mark & NS) == 0;
        east = (mark & EW) == 0;
        center = (mark & CORCEN) == 0;
        chunkExpression = (Expression<Chunk>) expressions[1];
    }
    return true;
}
 
开发者ID:MundoSK,项目名称:MundoSK,代码行数:19,代码来源:ExprChunkBlock.java

示例11: init

import ch.njol.skript.lang.SkriptParser; //导入依赖的package包/类
@Override
public boolean init(Expression<?>[] expressions, int i, Kleenean kleenean, SkriptParser.ParseResult parseResult) {
    a = (Expression<Number>) expressions[0];
    b = (Expression<Number>) expressions[1];

    return true;
}
 
开发者ID:ResultLuna,项目名称:skMath,代码行数:8,代码来源:ExprModulus.java

示例12: init

import ch.njol.skript.lang.SkriptParser; //导入依赖的package包/类
@Override
public boolean init(Expression<?>[] expr, int i, Kleenean kleenean, @NotNull SkriptParser.ParseResult parseResult) {
	entity = (Expression<LivingEntity>) expr[0];
	type = (Expression<PotionEffectType>) expr[1];
	setNegated(parseResult.mark == 1);
	return true;
}
 
开发者ID:Syst3ms,项目名称:QuarSK,代码行数:8,代码来源:CondHasPotionEffect.java

示例13: init

import ch.njol.skript.lang.SkriptParser; //导入依赖的package包/类
@Override
public boolean init(Expression<?>[] expr, int i, Kleenean kleenean, @NotNull SkriptParser.ParseResult parseResult) {
	mat = parseResult.mark == 0 ? Material.BANNER : Material.SHIELD;
	patterns = (Expression<Pattern>) expr[0];
	color = (Expression<Color>) expr[1];
	return true;
}
 
开发者ID:Syst3ms,项目名称:QuarSK,代码行数:8,代码来源:ExprBannerOrShieldWithLayers.java

示例14: init

import ch.njol.skript.lang.SkriptParser; //导入依赖的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;
}
 
开发者ID:Syst3ms,项目名称:QuarSK,代码行数:11,代码来源:SExprReference.java

示例15: init

import ch.njol.skript.lang.SkriptParser; //导入依赖的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;
}
 
开发者ID:Syst3ms,项目名称:QuarSK,代码行数:11,代码来源:ExprCustomPotionEffect.java


注:本文中的ch.njol.skript.lang.SkriptParser类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。