Exemplo n.º 1
0
 @Override
 public void update(Entity update) {
   super.update(update);
   Trigger t = (Trigger) update;
   this.enabled = t.isEnabled();
   this.targetVar = t.getTarget();
   this.trigger = t.getTrigger();
 }
Exemplo n.º 2
0
  @Override
  public void update(final Entity update) {
    super.update(update);

    final AccessKey k = (AccessKey) update;
    this.code = k.getCode();
    this.scope = k.getScope();
    this.enabled = true;
    this.authLevel = k.getAuthLevel().getCode();
  }
Exemplo n.º 3
0
 @Override
 @SuppressWarnings("unchecked")
 public void loadTag(T entity, Tag tag) {
   String name = tag.getName();
   if (name.equals("Dir")) {
     entity.setDirection(((ByteTag) tag).getValue());
   } else if (name.equals("Motive")) {
     entity.setArt(((StringTag) tag).getValue());
   } else if (name.equals("TileX")) {
     entity.getBlockCoordinates().setX(((IntTag) tag).getValue());
   } else if (name.equals("TileY")) {
     entity.getBlockCoordinates().setY(((IntTag) tag).getValue());
   } else if (name.equals("TileZ")) {
     entity.getBlockCoordinates().setZ(((IntTag) tag).getValue());
   } else {
     super.loadTag(entity, tag);
   }
 }
Exemplo n.º 4
0
  @Override
  public void validate(User user) {
    super.validate(user);
    if (Utils.isEmptyString(this.code)) {
      throw new IllegalArgumentException(
          "Access Key must not be empty, you can delete the key if you don't want it anymore.");
    }

    if (Utils.isEmptyString(this.scope)) {
      throw new IllegalArgumentException("Source must not be empty");
    }

    if (AuthLevel.get(this.authLevel).equals(AuthLevel.readPoint)
        || AuthLevel.get(this.authLevel).equals(AuthLevel.readWritePoint)) {
      if (Utils.isEmptyString(this.scope)) {
        throw new IllegalArgumentException(
            "Auth Keys with an auth level of point, must have a target point key set");
      }
    }
  }
Exemplo n.º 5
0
 @Override
 public void validate(User user) {
   super.validate(user);
 }