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);
if (c == null)
continue;
if (Skript.debug() || n.debug())
Skript.debug(indentation + "while " + c.toString(null, true) + ":");
final Kleenean hadDelayBefore = hasDelayBefore;
items.add(new While(c, (SectionNode) n));
if (hadDelayBefore != Kleenean.TRUE && hasDelayBefore != Kleenean.FALSE)
hasDelayBefore = Kleenean.UNKNOWN;
} else if (name.equalsIgnoreCase("else")) {
if (items.size() == 0 || !(items.get(items.size() - 1) instanceof Conditional) || ((Conditional) items.get(items.size() - 1)).hasElseClause()) {
Skript.error("'else' has to be placed just after an 'if' or 'else if' section");
continue;
}
if (Skript.debug() || n.debug())
Skript.debug(indentation + "else:");
final Kleenean hadDelayAfterLastIf = hasDelayBefore;
hasDelayBefore = hadDelayBeforeLastIf;
((Conditional) items.get(items.size() - 1)).loadElseClause((SectionNode) n);
hasDelayBefore = hadDelayBeforeLastIf.or(hadDelayAfterLastIf.and(hasDelayBefore));
} else if (StringUtils.startsWithIgnoreCase(name, "else if ")) {
if (items.size() == 0 || !(items.get(items.size() - 1) instanceof Conditional) || ((Conditional) items.get(items.size() - 1)).hasElseClause()) {
Skript.error("'else if' has to be placed just after another 'if' or 'else if' section");
continue;
}
name = "" + name.substring("else if ".length());
final Condition cond = Condition.parse(name, "can't understand this condition: '" + name + "'");
if (cond == null)
continue;
if (Skript.debug() || n.debug())
Skript.debug(indentation + "else if " + cond.toString(null, true));
final Kleenean hadDelayAfterLastIf = hasDelayBefore;
hasDelayBefore = hadDelayBeforeLastIf;
((Conditional) items.get(items.size() - 1)).loadElseIf(cond, (SectionNode) n);
hasDelayBefore = hadDelayBeforeLastIf.or(hadDelayAfterLastIf.and(hasDelayBefore.and(Kleenean.UNKNOWN)));
} else {
if (StringUtils.startsWithIgnoreCase(name, "if "))
name = "" + name.substring(3);
final Condition cond = Condition.parse(name, "can't understand this condition: '" + name + "'");
if (cond == null)
continue;
if (Skript.debug() || n.debug())
Skript.debug(indentation + cond.toString(null, true) + ":");
final Kleenean hadDelayBefore = hasDelayBefore;
hadDelayBeforeLastIf = hadDelayBefore;
items.add(new Conditional(cond, (SectionNode) n));
hasDelayBefore = hadDelayBefore.or(hasDelayBefore.and(Kleenean.UNKNOWN));
}