Respawn

Discussion in 'Spigot Plugin Development' started by KingDotCom, Jun 2, 2016.

  1. How can I make it on respawn the player who gets respawned gets items.
     
  2. Register a PlayerRespawnEvent. Inside the event simply give the player the items you want.

    player.getInventory().addItem(item, item, item...)
     
    • Agree Agree x 2
  3. 1- Register a PlayerRespawnEvent
    2- Place "player.getInventory().addItem(new ItemStack(Material.VALUE, 1));" inside it

    Example:
    Code (Text):
        @EventHandler
        public void onRespawn(PlayerRespawnEvent e) {
        Player player = e.getPlayer();
       
        player.getInventory().addItem(new ItemStack(Material.SKULL_ITEM, 1));
        }
    P.S.: Don't forget registerEvents in your onEnable()!