Getting actual item

Discussion in 'Plugin Development' started by Konkz, May 16, 2014.

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

    Konkz

    Hey,

    I'm trying to get the name of item used to kill a player, before you say
    p.getItemInHand() then no. Because the problem is when player, for example,
    shoots a bow and swaps to fish before it lands it will say killed by fish not Pro Elite Bow.

    I looked though the method and I could not really find anything of use, anything
    that I've missed or do I have to do it the long way around?
     
  2. Offline

    Onlineids

    Try when the player fires a bow put the bows name in a hashmap with the players name, then on death if the cause was an arrow get the shooter get the hashmap get the name
     
  3. Offline

    Konkz

    Thanks. I know how to do it, was just making sure there was no method that I've
    missed such as

    PHP:
    @EventHandler
    public void onPlayerDeath(PlayerDeathEvent e) {
    Player p e.getPlayer();
    e.setDeathMessage("Player " p.getName() + " has died by a weapon named " p.getDeathCause().getName());
    }
    Would be much more useful.
     
  4. Offline

    Onlineids

    Yea sucks /:
     
  5. Offline

    metalhedd

    It would probably be a lot cleaner to add the bow's name to the Arrow's metadata
     
  6. Offline

    rsod

    Definitely the way it should be done
     
  7. Offline

    Konkz

Thread Status:
Not open for further replies.

Share This Page