Search in sources :

Example 6 with BukkitPlayer

use of com.plotsquared.bukkit.player.BukkitPlayer 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);
}
Also used : PlotItemStack(com.plotsquared.core.plot.PlotItemStack) Inventory(org.bukkit.inventory.Inventory) PlotInventory(com.plotsquared.core.plot.PlotInventory) PlayerInventory(org.bukkit.inventory.PlayerInventory) BukkitPlayer(com.plotsquared.bukkit.player.BukkitPlayer)

Aggregations

BukkitPlayer (com.plotsquared.bukkit.player.BukkitPlayer)6 PlotItemStack (com.plotsquared.core.plot.PlotItemStack)3 InventoryView (org.bukkit.inventory.InventoryView)3 PlotPlayer (com.plotsquared.core.player.PlotPlayer)2 PlotInventory (com.plotsquared.core.plot.PlotInventory)2 Inventory (org.bukkit.inventory.Inventory)2 ItemStack (org.bukkit.inventory.ItemStack)2 PlayerInventory (org.bukkit.inventory.PlayerInventory)2 Singleton (com.google.inject.Singleton)1 InventoryUtil (com.plotsquared.core.util.InventoryUtil)1 BukkitAdapter (com.sk89q.worldedit.bukkit.BukkitAdapter)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 IntStream (java.util.stream.IntStream)1 Component (net.kyori.adventure.text.Component)1 Bukkit (org.bukkit.Bukkit)1 ChatColor (org.bukkit.ChatColor)1 Material (org.bukkit.Material)1 Player (org.bukkit.entity.Player)1 InventoryType (org.bukkit.event.inventory.InventoryType)1