Package ch.njol.skript

Examples of ch.njol.skript.SkriptAPIException


   */
  public void convertToEntries(final int levels, final String separator) {
    if (levels < -1)
      throw new IllegalArgumentException("levels must be >= -1");
    if (!config.simple)
      throw new SkriptAPIException("config is not simple: " + config);
    for (int i = 0; i < nodes.size(); i++) {
      final Node n = nodes.get(i);
      if (levels != 0 && n instanceof SectionNode) {
        ((SectionNode) n).convertToEntries(levels == -1 ? -1 : levels - 1, separator);
      }
View Full Code Here


   * @throws SkriptAPIException If the given class was not registered
   */
  public static ClassInfo<?> getClassInfo(final String codeName) {
    final ClassInfo<?> ci = classInfosByCodeName.get(codeName);
    if (ci == null)
      throw new SkriptAPIException("No class info found for " + codeName);
    return ci;
  }
View Full Code Here

    out.defaultWriteObject();
    out.writeObject(data.getClass().getComponentType());
    final SerializedVariable.Value[] d = new SerializedVariable.Value[data.length];
    for (int i = 0; i < data.length; i++) {
      if ((d[i] = Classes.serialize(data[i])) == null) {
        throw new SkriptAPIException("Parsed class cannot be serialized: " + data[i].getClass().getName());
      }
    }
    out.writeObject(d);
  }
View Full Code Here

  public Expression<? extends Object> simplify() {
    return this;
  }
 
  private final static SkriptAPIException invalidAccessException() {
    return new SkriptAPIException("UnparsedLiterals must be converted before use");
  }
View Full Code Here

  public final T getSingle(final Event e) {
    final T[] all = getArray(e);
    if (all.length == 0)
      return null;
    if (all.length > 1)
      throw new SkriptAPIException("Call to getSingle() on a non-single expression");
    return all[0];
  }
View Full Code Here

 
  @SuppressWarnings("null")
  @Override
  public T getSingle() {
    if (getAnd() && data.length > 1)
      throw new SkriptAPIException("Call to getSingle on a non-single expression");
    return CollectionUtils.getRandom(data);
  }
View Full Code Here

  public final static EntityDataInfo<?> getInfo(final Class<? extends EntityData<?>> c) {
    for (final EntityDataInfo<?> i : infos) {
      if (i.c == c)
        return i;
    }
    throw new SkriptAPIException("Unregistered EntityData class " + c.getName());
  }
View Full Code Here

    assert expr != null;
    assert node != null;
    if (Container.class.isAssignableFrom(expr.getReturnType())) {
      final ContainerType type = expr.getReturnType().getAnnotation(ContainerType.class);
      if (type == null)
        throw new SkriptAPIException(expr.getReturnType().getName() + " implements Container but is missing the required @ContainerType annotation");
      this.expr = new ContainerExpression(expr, type.value());
    } else {
      this.expr = expr;
    }
    ScriptLoader.currentSections.add(this);
View Full Code Here

    try {
      final Constructor<E> constr = c.getDeclaredConstructor();
      constr.setAccessible(true);
      return constr.newInstance();
    } catch (final InstantiationException e) {
      throw new SkriptAPIException("Serializer of " + info.getCodeName() + " must override newInstance(), canBeInstantiated() or mustSyncDeserialization() if its class does not have a nullary constructor");
    } catch (final NoSuchMethodException e) {
      throw new SkriptAPIException("Serializer of " + info.getCodeName() + " must override newInstance(), canBeInstantiated() or mustSyncDeserialization() if its class does not have a nullary constructor");
    } catch (final SecurityException e) {
      throw Skript.exception("Security manager present");
    } catch (final IllegalArgumentException e) {
      assert false;
      return null;
View Full Code Here

   * @throws StreamCorruptedException If the given data is invalid or incomplete
   * @throws NotSerializableException
   */
  @SuppressWarnings("unused")
  protected T deserialize(final Fields fields) throws StreamCorruptedException, NotSerializableException {
    throw new SkriptAPIException("deserialize(Fields) has not been overridden in " + getClass() + " (serializer of " + info + ")");
  }
View Full Code Here

TOP

Related Classes of ch.njol.skript.SkriptAPIException

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.