Help damaging entities with fire.

Discussion in 'Plugin Development' started by iClipse, Jul 16, 2016.

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

    iClipse

    So Im no so new anymore, I made an accound earlier, forgot the password (lol), people told me to learn java, guess what. I learned Java 2 years ago, but barely practiced it since. But anyhow, I got my older bro who has taken university courses in Java, so he helped me out with that. Now I got an issue. Im making a plugin that has custom enchants, one of them is "Molten Core". What it does is damages an entity if they hit someone with the enchant. Heres what I got so far.

    Code:
     
        public void onEntityDamage(EntityDamageEvent event)
        {
            if(event instanceof EntityDamageByEntityEvent)
            {
                EntityDamageByEntityEvent e=(EntityDamageByEntityEvent) event;
                {
                    [What do I put here?].entity.setFireTicks(1250);
                }
            }
        }
    }
    
    Anyhow, the question is, "What do I put here?]. Kinda easy to figure out my question. What I want is for it to get the entity that damaged the other entity.

    Also, no, my older bro doesn't know Bukkit.
     
  2. @iClipse Why are you using EntityDamageEvent then checking for EntityDamageByEntityEvent, just use the EntityDamageByEntityEvent.
     
  3. Offline

    iClipse

    Dont ask. My brother said he was making it easier on me, and asking what id did at the same time xd
     
  4. @iClipse Just make it an EntityDamageByEntityEvent then do event.getEntity and make an instance check on that to see if it is a player.
     
  5. Offline

    iClipse

    K thx m8

    @bwfcwalshy
    Does this work?
    Code:
       EntityDamageByEntityEvent e=(EntityDamageByEntityEvent) event;
                {
                    ((EntityDamageByEntityEvent) event).getDamager().setFireTicks(1250);
    
    Cuz I did that without a single bit of help from my bro.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jul 16, 2016
  6. Offline

    ArsenArsen

    No, just listen to it instead
     
Thread Status:
Not open for further replies.

Share This Page