예제 #1
0
  @Nullable
  public List<EntityDataManager.DataEntry<?>> getDirty() {
    List<EntityDataManager.DataEntry<?>> list = null;

    if (this.dirty) {
      this.lock.readLock().lock();

      for (EntityDataManager.DataEntry<?> dataentry : this.entries.values()) {
        if (dataentry.isDirty()) {
          dataentry.setDirty(false);

          if (list == null) {
            list = Lists.<EntityDataManager.DataEntry<?>>newArrayList();
          }

          list.add(dataentry);
        }
      }

      this.lock.readLock().unlock();
    }

    this.dirty = false;
    return list;
  }
예제 #2
0
  public <T> void set(DataParameter<T> key, T value) {
    EntityDataManager.DataEntry<T> dataentry = this.<T>getEntry(key);

    if (ObjectUtils.notEqual(value, dataentry.getValue())) {
      dataentry.setValue(value);
      this.entity.notifyDataManagerChange(key);
      dataentry.setDirty(true);
      this.dirty = true;
    }
  }