Use less confusing variable name

This commit is contained in:
Hannes Greule 2020-08-17 15:32:17 +02:00
parent 914b44069b
commit aacf15757f
2 changed files with 8 additions and 8 deletions

View File

@ -51,10 +51,10 @@ import java.util.stream.IntStream;
@Override public void open(PlotInventory inv) { @Override public void open(PlotInventory inv) {
BukkitPlayer bp = (BukkitPlayer) inv.getPlayer(); BukkitPlayer bp = (BukkitPlayer) inv.getPlayer();
Inventory inventory = Bukkit.createInventory(null, inv.getSize() * 9, Inventory inventory = Bukkit.createInventory(null, inv.getLines() * 9,
ChatColor.translateAlternateColorCodes('&', inv.getTitle())); ChatColor.translateAlternateColorCodes('&', inv.getTitle()));
PlotItemStack[] items = inv.getItems(); PlotItemStack[] items = inv.getItems();
for (int i = 0; i < inv.getSize() * 9; i++) { for (int i = 0; i < inv.getLines() * 9; i++) {
PlotItemStack item = items[i]; PlotItemStack item = items[i];
if (item != null) { if (item != null) {
inventory.setItem(i, getItem(item)); inventory.setItem(i, getItem(item));

View File

@ -39,18 +39,18 @@ public class PlotInventory {
private static final Logger logger = LoggerFactory.getLogger("P2/" + PlotInventory.class.getSimpleName()); private static final Logger logger = LoggerFactory.getLogger("P2/" + PlotInventory.class.getSimpleName());
private final PlotPlayer<?> player; private final PlotPlayer<?> player;
private final int size; private final int lines;
private final PlotItemStack[] items; private final PlotItemStack[] items;
private String title; private String title;
private boolean open = false; private boolean open = false;
private final InventoryUtil inventoryUtil; private final InventoryUtil inventoryUtil;
public PlotInventory(@Nonnull final InventoryUtil inventoryUtil, public PlotInventory(@Nonnull final InventoryUtil inventoryUtil,
PlotPlayer<?> player, int size, String name) { PlotPlayer<?> player, int lines, String name) {
this.size = size; this.lines = lines;
this.title = name == null ? "" : name; this.title = name == null ? "" : name;
this.player = player; this.player = player;
this.items = new PlotItemStack[size * 9]; this.items = new PlotItemStack[lines * 9];
this.inventoryUtil = inventoryUtil; this.inventoryUtil = inventoryUtil;
} }
@ -144,7 +144,7 @@ public class PlotInventory {
return player; return player;
} }
public int getSize() { public int getLines() {
return size; return lines;
} }
} }