Get killers inventory

Discussion in 'Plugin Development' started by XgXXSnipz, Dec 20, 2014.

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

    XgXXSnipz

    Im making a BOSS plugin but I need to know how to get someones killers inventory, so basically if some guy named, "Bob" killed me, his hot bar would go into my hot bar and his armor would be put in my armor slot
     
  2. Offline

    teej107

    Do you know how to get a regular player's inventory?
     
  3. Offline

    XgXXSnipz

  4. Offline

    teej107

    KingFaris11 likes this.
  5. Building on to the information above, to get the killer of a player:

    Player killer = player.getKiller();

    Make sure to check if the killer is not null as PlayerDeathEvent and EntityDeathEvent is not only called if a player is killed by a player only. getKiller() only returns a player, so if the death is not caused by a player, then it'll throw exceptions unless you check for null.
     
  6. Offline

    XgXXSnipz

  7. Offline

    TheDiamondGuy

    On the death event, get the killer and the player.

    Get the killers Inventory:
    Code:
    killer.getInventory();
    Then do whatever with it
     
Thread Status:
Not open for further replies.

Share This Page