Plugin to keep items at death?

Discussion in 'Spigot Plugin Development' started by CrushedCorpses, Jul 1, 2015.

  1. He wanted to know if they know any plugin that prevents losing the items upon death.

    VIP want to prevent losing their items.

    In what may have compatibility with version 1.8.7

  2. Creeoer


    You can tell him to turn on keep inventory, which is implemented in minecraft...
  3. I understand, but need only be in specific user groups
  4. On player death, or right before death, save there entire Inventory in a hashmap

    HashMap<UUID, Inventory> inventories = new HashMap<UUID, Inventory>();

    So you are saving player UUID and their inventory. When they respawn, check if they are in the hashmap. If so, set their inventory to the inventory you get from the hashmap.
  5. Umm.... Wouldn't this work?
    Code (Text):
        public void playerDeath(PlayerDeathEvent event) {
            Player player = (Player) event.getEntity();
            if (player.hasPermission("plugin.permission")) {
  6. Never knew about this.......... nice :)