SlotTransaction class
Пакет: com.hypixel.hytale.server.core.inventory.transaction
Файл: com/hypixel/hytale/server/core/inventory/transaction/SlotTransaction.java
implements: Transaction
Поля (3)
| Модификаторы | Тип | Имя |
|---|---|---|
final |
SlotTransaction |
FAILED_ADD |
|
short |
var4 |
|
short |
var4 |
Методы (4)
| Модификаторы | Возврат | Сигнатура |
|---|---|---|
public |
short |
getSlotshort getSlot() |
public |
boolean |
isAllOrNothingboolean isAllOrNothing() |
public |
boolean |
isExactAmountboolean isExactAmount() |
public |
boolean |
isFilterboolean isFilter() |
Исходный код
Показать/скрыть
class="kw">package com.hypixel.hytale.server.core.inventory.transaction;
class="kw">import com.hypixel.hytale.server.core.inventory.ItemStack;
class="kw">import com.hypixel.hytale.server.core.inventory.container.ItemContainer;
class="kw">import javax.annotation.Nonnull;
class="kw">import javax.annotation.Nullable;
class="kw">public class SlotTransaction class="kw">implements Transaction {
class="kw">public class="kw">static class="kw">final SlotTransaction FAILED_ADD = new SlotTransaction(false, ActionType.ADD, (short)-1, null, null, null, false, false, false);
class="kw">private class="kw">final boolean succeeded;
@Nonnull
class="kw">private class="kw">final ActionType action;
class="kw">private class="kw">final short slot;
@Nullable
class="kw">private class="kw">final ItemStack slotBefore;
@Nullable
class="kw">private class="kw">final ItemStack slotAfter;
@Nullable
class="kw">private class="kw">final ItemStack output;
class="kw">private class="kw">final boolean allOrNothing;
class="kw">private class="kw">final boolean exactAmount;
class="kw">private class="kw">final boolean filter;
class="kw">public SlotTransaction(
boolean var1,
@Nonnull ActionType var2,
short var3,
@Nullable ItemStack var4,
@Nullable ItemStack var5,
@Nullable ItemStack var6,
boolean var7,
boolean var8,
boolean var9
) {
this.succeeded = var1;
this.action = var2;
this.slot = var3;
this.slotBefore = var4;
this.slotAfter = var5;
this.output = var6;
this.allOrNothing = var7;
this.exactAmount = var8;
this.filter = var9;
}
@Override
class="kw">public boolean succeeded() {
class="kw">return this.succeeded;
}
@Override
class="kw">public boolean wasSlotModified(short var1) {
class="kw">return !this.succeeded ? false : this.slot == var1;
}
@Nonnull
class="kw">public ActionType getAction() {
class="kw">return this.action;
}
class="kw">public short getSlot() {
class="kw">return this.slot;
}
@Nullable
class="kw">public ItemStack getSlotBefore() {
class="kw">return this.slotBefore;
}
@Nullable
class="kw">public ItemStack getSlotAfter() {
class="kw">return this.slotAfter;
}
@Nullable
class="kw">public ItemStack getOutput() {
class="kw">return this.output;
}
class="kw">public boolean isAllOrNothing() {
class="kw">return this.allOrNothing;
}
class="kw">public boolean isExactAmount() {
class="kw">return this.exactAmount;
}
class="kw">public boolean isFilter() {
class="kw">return this.filter;
}
@Nonnull
class="kw">public SlotTransaction toParent(ItemContainer var1, short var2, ItemContainer var3) {
short var4 = (short)(var2 + this.slot);
class="kw">return new SlotTransaction(
this.succeeded, this.action, var4, this.slotBefore, this.slotAfter, this.output, this.allOrNothing, this.exactAmount, this.filter
);
}
@Nullable
class="kw">public SlotTransaction fromParent(ItemContainer var1, short var2, @Nonnull ItemContainer var3) {
short var4 = (short)(this.slot - var2);
class="kw">return var4 >= 0 && var4 < var3.getCapacity()
? new SlotTransaction(
this.succeeded, this.action, var4, this.slotBefore, this.slotAfter, this.output, this.allOrNothing, this.exactAmount, this.filter
)
: null;
}
@Nonnull
@Override
class="kw">public String toString() {
class="kw">return "SlotTransaction{succeeded="
+ this.succeeded
+ ", action="
+ this.action
+ ", slot="
+ this.slot
+ ", slotBefore="
+ this.slotBefore
+ ", slotAfter="
+ this.slotAfter
+ ", allOrNothing="
+ this.allOrNothing
+ ", exactAmount="
+ this.exactAmount
+ ", filter="
+ this.filter
+ "}";
}
}