Solved Dragon Set Exp and Delete Portal

Discussion in 'Plugin Development' started by thomas12000, Jun 6, 2016.

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

    thomas12000

    Hello sorry for the second post but it's different and at the same time is actually based on the first one :)

    Here is my code to actually respawn the dragon :
    Code:
        @EventHandler
        public void onEnderDragonDeath(EntityDeathEvent event){
            World dragonworld = event.getEntity().getWorld();
            Location dragonlocation = event.getEntity().getLocation();
            if(event.getEntity() instanceof EnderDragon){
                dragonworld.spawnEntity(dragonlocation, EntityType.ENDER_DRAGON);
            }
        }
    Now i wanna know how to change it's dropped exp and to delete the portal it creates

    I tried for drop exp
    Code:
    event.setDroppedExp(100);
    But it didn't work
     
  2. Offline

    Xerox262

    @thomas12000 Since you don't want anything from when the dragon dies, you could use the entity damage event, check if the entity is a dragon and then check if their health is less than or equal to 0, cancel the event, remove the dragon, drop the exp manually and spawn the new dragon.
     
    Zombie_Striker likes this.
  3. Offline

    thomas12000

    That's a great idea thanks :)
     
Thread Status:
Not open for further replies.

Share This Page