Package ch.njol.skript.lang

Examples of ch.njol.skript.lang.Loop


            continue;
          }
          if (Skript.debug() || n.debug())
            Skript.debug(indentation + "loop " + loopedExpr.toString(null, true) + ":");
          final Kleenean hadDelayBefore = hasDelayBefore;
          items.add(new Loop(loopedExpr, (SectionNode) n));
          if (hadDelayBefore != Kleenean.TRUE && hasDelayBefore != Kleenean.FALSE)
            hasDelayBefore = Kleenean.UNKNOWN;
        } else if (StringUtils.startsWithIgnoreCase(name, "while ")) {
          final String l = "" + name.substring("while ".length());
          final Condition c = Condition.parse(l, "Can't understand this condition: " + l);
View Full Code Here


      s = "" + m.group(1);
      i = Utils.parseInt("" + m.group(2));
    }
    final Class<?> c = Classes.getClassFromUserInput(s);
    int j = 1;
    Loop loop = null;
    for (final Loop l : ScriptLoader.currentLoops) {
      if ((c != null && c.isAssignableFrom(l.getLoopedExpression().getReturnType())) || l.getLoopedExpression().isLoopOf(s)) {
        if (j < i) {
          j++;
          continue;
        }
        if (loop != null) {
          Skript.error("There are multiple loops that match loop-" + s + ". Use loop-" + s + "-1/2/3/etc. to specify which loop's value you want.", ErrorQuality.SEMANTIC_ERROR);
          return false;
        }
        loop = l;
        if (j == i)
          break;
      }
    }
    if (loop == null) {
      Skript.error("There's no loop that matches 'loop-" + s + "'", ErrorQuality.SEMANTIC_ERROR);
      return false;
    }
    if (loop.getLoopedExpression() instanceof Variable) {
      isVariableLoop = true;
      if (((Variable<?>) loop.getLoopedExpression()).isIndexLoop(s))
        isIndex = true;
    }
    this.loop = loop;
    return true;
  }
View Full Code Here

TOP

Related Classes of ch.njol.skript.lang.Loop

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.