Set player on fire when damaged

Discussion in 'Plugin Development' started by iAmGuus, May 11, 2014.

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

    iAmGuus

    Hey Guys,
    Its iAmGuus here,
    And i got an question about setting a player on fire.
    I'm currently working on a kitpvp plugin and i was making a pyro kit.
    I wonder how to make it when a player hit a player with an iron axe.
    Then the player who got damaged will be put on fire.
    Any idea?
    Thanks,
    iAmGuus
     
  2. Offline

    bennie3211

    EntityDamageByEntity event, check if tool is an iron axe, check if damage is from a player, then set it on fire.
     
  3. Offline

    ShadowWizardMC

    bennie3211 Lawl you beat me to it was just putting that in another tab XD
     
  4. Offline

    iAmGuus

    Could someone post an example of it?
     
  5. Offline

    bennie3211

    Something like this: (No spoonfeed, but I think you can work this out yourself :)


    Code:java
    1.  
    2. @EventHandler
    3. public void onDamage(EntityDamageByEntityEvent event) {
    4. if (event.damager instancof player) {
    5. if (damager.getItemInHand().getType() == Iron axe) {
    6. pl.setFireTicks(1000);
    7. }
    8. }
    9. }
    10.  
     
    Ub1 likes this.
  6. Offline

    JoeyDevs

    What is the pl?
    And use Iron Axe as material
    Code:java
    1. Material.IRON_AXE
     
  7. JoeyDevs I think you missed the point - he was trying not to spoonfeed.
     
    bennie3211 likes this.
  8. Offline

    iAmGuus

    Thanks for your reply's guys, i'll test it out!
     
  9. Offline

    bennie3211

    JoeyDevs I know :p I was just trying to let iAmGuus figure it out :) Else its copy & paste xD
     
    AdamQpzm likes this.
  10. Offline

    JoeyDevs

    O oke sorry!
     
Thread Status:
Not open for further replies.

Share This Page