Example #1
0
  /**
   * Use this to deliver a user from one WorldDataHolder to another
   *
   * @param dataSource
   * @return null if given dataSource already contains the same user
   */
  public User clone(WorldDataHolder dataSource) {

    if (dataSource.isUserDeclared(this.getName())) {
      return null;
    }
    User clone = dataSource.createUser(this.getName());
    if (dataSource.getGroup(group) == null) {
      clone.setGroup(dataSource.getDefaultGroup());
    } else {
      clone.setGroup(dataSource.getGroup(this.getGroupName()));
    }
    for (String perm : this.getPermissionList()) {
      clone.addPermission(perm);
    }
    clone.variables = this.variables.clone(this);
    clone.flagAsChanged();
    return clone;
  }
Example #2
0
  /** @param name */
  public User(WorldDataHolder source, String name) {

    super(source, name);
    this.group = source.getDefaultGroup().getName();
  }