1.14.4 For all player inventories

Discussion in 'Spigot Plugin Development' started by ThatGuyLogi, Jan 15, 2020.

  1. I need to get all the player inventories and whenever they die, put their items in a chest that spawns via lightning at their death location. I managed to do this with one account, but as soon as another player logs on (my alt account) and they die, it spawns the chest with the main account's inventory, and the account who died cannot open the chest
  2. Can you explain to us how you are attempting to store it when they die?
  3. I ain't storing it, I'm just getting their inventory and the chest's inventory and
    Code (Text):

    for(Player p : Bukkit.getOnlinePlayers()){
        for(ItemStack item : p.getInventory().getContents()){
  4. Can you show us the full code, we don't know were comes the variable inv. Please.
    • Agree Agree x 1
  5. You currently grab everyone's inventory and try to put it in a single chest when someone logs out, I don't think that's what you're trying to do.

  6. Why are you even looping over all players? just use the PlayerDeathEvent and do what you need then.
    • Agree Agree x 3