[REQ] Small PvP "Killing" API?

Discussion in 'Archived: Plugin Requests' started by Flenix, May 25, 2011.

  1. Offline

    Flenix

    Hey everyone :)

    I was wondering, would it be possible for someone to make some sort of API/plugin, that can be hooked into so special "kills" can be detected properly?

    A bit of background:
    Our server has a race system. We have Warriors and Rangers, who obviously get kills as normal and they are registered, and then we have Summoners, Assassins, and a few Mage races.
    Now, if the summoner summoned a creeper, and that creeper killed somoene, the Summoner wouldn't get any points/money etc from the kill. Or if the Mage set someone on fire, the same problem happens. Basically what I'm requesting is an API system, which other modders can then hook into so the attacks from their plugins are traced, so if that Mage sets the ground on fire, then something walks through it, it will detect that the Mage set that something on fire and the Mage will get the kill for it.

    So is this possible? Anyone up for taking it on? Its a must-have for most servers with any special attacks like those...
     
  2. Offline

    dreadiscool

    I'll try, but I'm tied up with some other things as well.
     
  3. Offline

    Flenix

    Awesome, thanks! Let me know if you make any progress :)
     
  4. Offline

    chronopolis

    I won't write an API for it, but in my plugin I am able to check damage events and change the outcome depending on the source. Here is a snippet from my EntityListener class
    Code:
    public void onEntityDamage(EntityDamageEvent event){
    if (Pokeblocks.isAPokemon(event.getEntity().getEntityId())){
    
        Pokeblocks.getOwner(event.getEntity().getEntityId()).outPokemon.hp -= event.getDamage();
        ((LivingEntity) event.getEntity()).setHealth(100);
    
    }
    }
    Basically I have a static function named isAPokemon - and that checks the Entity ID you pass it against all existing Pokemon(mobs). When I create a new Pokemon, I feed it the Entity ID of its model in the world. What this function does is whenever a Pokemon is damaged, it sets its actual in-game hp to 100 and subtracts the damage from a variable in the Pokemon class that I named HP. This allows me to extend the Pokemons HP to whatever I want. I also have some hooks in place for the Pokemons damage if you'd like to see those.

    But, since I'm not sure EXACTLY what you're looking for, I will stop here...but I put this thread on watch so just reply with any questions you have :)
     

Share This Page