Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ default DataTransactionResult undo(DataTransactionResult result) {
for (final Value<?> value : result.successfulData()) {
builder.absorbResult(this.remove(value));
}
return DataTransactionResult.failNoData();
return builder.build();
}

// Delegated
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,21 @@ public class InventoryTransactionResultImpl implements InventoryTransactionResul

@Override
public InventoryTransactionResult and(InventoryTransactionResult other) {
Type resultType = Type.SUCCESS;
final Type resultType;
if (this.type == Type.ERROR || other.type() == Type.ERROR) {
resultType = Type.ERROR;
}
if (this.type == Type.FAILURE || other.type() == Type.FAILURE) {
} else if (this.type == Type.FAILURE || other.type() == Type.FAILURE) {
resultType = Type.FAILURE;
} else if (this.type == Type.NO_SLOT || other.type() == Type.NO_SLOT) {
resultType = Type.NO_SLOT;
} else {
resultType = Type.SUCCESS;
}
InventoryTransactionResult.Builder builder =
InventoryTransactionResult.builder().type(resultType).reject(this.rejected).reject(other.rejectedItems())
.transaction(this.slotTransactions).transaction(other.slotTransactions());
this.polled.forEach(builder::poll);
other.polledItems().forEach(builder::poll);
return builder.build();
}

Expand Down Expand Up @@ -189,6 +193,7 @@ public InventoryTransactionResult.Builder from(InventoryTransactionResult value)
this.resultType = Objects.requireNonNull(value.type(), "ResultType cannot be null!");
this.slotTransactions = new ArrayList<>(value.slotTransactions());
this.rejected = new ArrayList<>(value.rejectedItems());
this.polled = new ArrayList<>(value.polledItems());
return this;
}

Expand All @@ -197,6 +202,7 @@ public InventoryTransactionResult.Builder reset() {
this.resultType = null;
this.rejected = null;
this.slotTransactions = null;
this.polled = null;
return this;
}

Expand Down
Loading