classpublicPriority 3
TagTransaction
com.hypixel.hytale.server.core.inventory.transaction.TagTransaction
extends ListTransaction
7
Methods
7
Public Methods
6
Fields
1
Constructors
Constructors
public
TagTransaction(boolean succeeded, ActionType action, int tagIndex, int remainder, boolean allOrNothing, boolean exactAmount, boolean filter, List<TagSlotTransaction> slotTransactions)Methods
Public Methods (7)
public
ActionType getAction()@Nonnull
public
int getRemainder()public
int getTagIndex()@Nonnull
public
boolean isAllOrNothing()public
boolean isExactAmount()public
boolean isFilter()public
String toString()@Nonnull@Override
Fields
Private/Package Fields (6)
private
ActionType actionprivate
boolean allOrNothingprivate
boolean exactAmountprivate
boolean filterprivate
int remainderprivate
int tagIndexInheritance
Parent
Current
Interface
Child
Use mouse wheel to zoom, drag to pan. Click nodes to navigate.
Related Classes
Used By
Source Code
package com.hypixel.hytale.server.core.inventory.transaction;
import com.hypixel.hytale.server.core.inventory.container.ItemContainer;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public class TagTransaction extends ListTransaction<TagSlotTransaction> {
@Nonnull
private final ActionType action;
private final int tagIndex;
private final int remainder;
private final boolean allOrNothing;
private final boolean exactAmount;
private final boolean filter;
public TagTransaction(
boolean succeeded,
@Nonnull ActionType action,
int tagIndex,
int remainder,
boolean allOrNothing,
boolean exactAmount,
boolean filter,
@Nonnull List<TagSlotTransaction> slotTransactions
) {
super(succeeded, slotTransactions);
this.action = action;
this.tagIndex = tagIndex;
this.remainder = remainder;
this.allOrNothing = allOrNothing;
this.exactAmount = exactAmount;
this.filter = filter;
}
@Nonnull
public ActionType getAction() {
return this.action;
}
@Nonnull
public int getTagIndex() {
return this.tagIndex;
}
public int getRemainder() {
return this.remainder;
}
public boolean isAllOrNothing() {
return this.allOrNothing;
}
public boolean isExactAmount() {
return this.exactAmount;
}
public boolean isFilter() {
return this.filter;
}
@Nonnull
public TagTransaction toParent(ItemContainer parent, short start, ItemContainer container) {
List<TagSlotTransaction> slotTransactions = this.getList()
.stream()
.map(transaction -> transaction.toParent(parent, start, container))
.collect(Collectors.toList());
return new TagTransaction(
this.succeeded(), this.action, this.tagIndex, this.remainder, this.allOrNothing, this.exactAmount, this.filter, slotTransactions
);
}
@Nullable
public TagTransaction fromParent(ItemContainer parent, short start, @Nonnull ItemContainer container) {
List<TagSlotTransaction> slotTransactions = this.getList()
.stream()
.map(transactionx -> transactionx.fromParent(parent, start, container))
.filter(Objects::nonNull)
.collect(Collectors.toList());
if (slotTransactions.isEmpty()) {
return null;
} else {
boolean succeeded = false;
for (TagSlotTransaction transaction : slotTransactions) {
if (transaction.succeeded()) {
succeeded = true;
break;
}
}
return new TagTransaction(succeeded, this.action, this.tagIndex, this.remainder, this.allOrNothing, this.exactAmount, this.filter, slotTransactions);
}
}
@Nonnull
@Override
public String toString() {
return "TagTransaction{action="
+ this.action
+ ", tag="
+ this.tagIndex
+ ", remainder="
+ this.remainder
+ ", allOrNothing="
+ this.allOrNothing
+ ", exactAmount="
+ this.exactAmount
+ ", filter="
+ this.filter
+ "} "
+ super.toString();
}
}