use of com.plotsquared.core.plot.PlotItemStack in project PlotSquared by IntellectualSites.
the class BukkitInventoryUtil method getItems.
@Override
public PlotItemStack[] getItems(PlotPlayer<?> player) {
BukkitPlayer bp = (BukkitPlayer) player;
PlayerInventory inv = bp.player.getInventory();
return IntStream.range(0, 36).mapToObj(i -> getItem(inv.getItem(i))).toArray(PlotItemStack[]::new);
}
use of com.plotsquared.core.plot.PlotItemStack in project PlotSquared by IntellectualSites.
the class BukkitInventoryUtil method open.
// Paper deprecation
@SuppressWarnings("deprecation")
@Override
public void open(PlotInventory inv) {
BukkitPlayer bp = (BukkitPlayer) inv.getPlayer();
Inventory inventory = Bukkit.createInventory(null, inv.getLines() * 9, ChatColor.translateAlternateColorCodes('&', inv.getTitle()));
PlotItemStack[] items = inv.getItems();
for (int i = 0; i < inv.getLines() * 9; i++) {
PlotItemStack item = items[i];
if (item != null) {
inventory.setItem(i, getItem(item));
}
}
bp.player.openInventory(inventory);
}
Aggregations