Rename InventoryType#getAdditionalSlot to InventoryType#getSize

This commit is contained in:
themode 2021-03-29 17:36:18 +02:00
parent adb9a449bf
commit 7f0dc6d40a
3 changed files with 15 additions and 7 deletions

View File

@ -12,7 +12,7 @@ public class InventoryData extends DataType<Inventory> {
@Override
public void encode(@NotNull BinaryWriter writer, @NotNull Inventory value) {
final InventoryType inventoryType = value.getInventoryType();
final int size = inventoryType.getAdditionalSlot();
final int size = inventoryType.getSize();
// Inventory title & type
writer.writeSizedString(value.getTitle());
@ -29,7 +29,7 @@ public class InventoryData extends DataType<Inventory> {
public Inventory decode(@NotNull BinaryReader reader) {
final String title = reader.readSizedString(Integer.MAX_VALUE);
final InventoryType inventoryType = InventoryType.valueOf(reader.readSizedString(Integer.MAX_VALUE));
final int size = inventoryType.getAdditionalSlot();
final int size = inventoryType.getSize();
Inventory inventory = new Inventory(inventoryType, title);

View File

@ -74,7 +74,7 @@ public class Inventory implements InventoryModifier, InventoryClickHandler, View
this.inventoryType = inventoryType;
this.title = title;
this.size = inventoryType.getAdditionalSlot();
this.size = inventoryType.getSize();
this.offset = size;

View File

@ -30,18 +30,26 @@ public enum InventoryType {
CARTOGRAPHY(3),
STONE_CUTTER(2);
private final int slot;
private final int size;
InventoryType(int slot) {
this.slot = slot;
InventoryType(int size) {
this.size = size;
}
public int getWindowType() {
return ordinal();
}
public int getSize() {
return size;
}
/**
* @deprecated use {@link #getSize()}
*/
@Deprecated
public int getAdditionalSlot() {
return slot;
return size;
}
}