1.8.8 Per-player inventories

Discussion in 'Spigot Plugin Development' started by FreakyPear5, Mar 26, 2020.

  1. Hi,

    I am making a plugin that when a command is run, it opens an inventory. But I have run into a problem where (because each item in the inv is named based on the player's name) that when two people try to use it at the same time, the first person who opened the inventory's items are renamed to the other player's name.
    In short, how do I make a new inventory for every player, in a command?

    Thanks,
    Freaky
     
  2. drives_a_ford

    Moderator

    You create a new inventory with cloned itemstacks for each user instead of using the existing one.
     
  3. Yes, but where do I create the inventories? How do I name them?
     
  4. drives_a_ford

    Moderator

    The simplest thing you can do is create the inventories when they're needed.
    And I'm not sure what your issue is with naming them. In legacy versions such as 1.8.8 you can simply use Server#createInventory and name it by passing its name as an argument.

    The reason I'm giving rather vague answers is because you never shared your code. Without knowing what's in your code, I'm unable to help you with the specifics.
     
  5. I've fixed it, thanks for your help!