CraftInventoryCustom cannot be cast to PlayerInventory, creating a playerinventory object?

Discussion in 'Plugin Development' started by Mike724, Sep 27, 2012.

Thread Status:
Not open for further replies.
  1. Offline

    Mike724

    I'm trying to create a PlayerInventory object using this code:
    Code:
    PlayerInventory pinv = (PlayerInventory)Bukkit.getServer().createInventory(null, InventoryType.PLAYER);
    .. but it gives this error:
    full error:
    Show Spoiler



    Does anyone know how to fix this/do it correctly?
     
  2. Code:
    Inventory pinv = (Inventory) Bukkit.getServer().createInventory(null, InventoryType.PLAYER);
    It works like this :)
     
  3. Offline

    Mike724

    Then I do not have access to the armor slots?

    Still have not found a solution, I might just create an inventory with 4 extra slots and make my own PlayerInventory at this point.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 28, 2016
  4. Offline

    devilquak

    Mike724

    Just wondering, did you ever find a solution to this? I'm trying to do this exact same thing, and am having the exact same problem.
     
Thread Status:
Not open for further replies.

Share This Page