Solved Spawn in endercrystals???

Discussion in 'Plugin Development' started by spankynutbean, Mar 7, 2013.

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

    spankynutbean

    I've seen plugins that are able to spawn in endercrystals, but i have no idea how!
    Also i need a way to detect when the endercrystal has been broken.
    Here's the code that needs it:
    Code:
    @EventHandler
        public void onWin(BlockBreakEvent event){
            if(war = true){
                Block b = event.getBlock();
                if(b.getType() == //Here is where i need to put endercrystal) {
                    endwar = true;
                }
            }
        }
     
  2. Offline

    ZeusAllMighty11

    AlexLeporiday


    Pretty sure you can just spawn in EnderCrystal.class :)
     
  3. The user asked how to spawn them in and then gave an example where they wanted to detect if the crystal was broken. I simply gave them the answer that you need to treat Ender Crystals as entities instead of blocks. You spawn them in like minecarts of zombies and you test if they're destroyed with entity killed events etc..
     
  4. Offline

    spankynutbean

    Thanks alex! But now i have a problem with the code:
    Code:
    @EventHandler
        public void onWin(EntityDeathEvent e) {
        if(e instanceof EntityDamageByEntityEvent)&&(war == true) {
        EntityDeathByEntityEvent event = (EntityDeathByEntityEvent) e;
        if(e.getEntity() instanceof EnderCrystal) {
            endwar = true;
        }
        }
        }
    the '&&' is in red and i can't find a way around it, help!
     
  5. Offline

    ZeusAllMighty11

    Your parentheses are wrong
     
  6. Offline

    spankynutbean

    What should i do to correct it zeus?
     
  7. Offline

    xXCryptoFreakXx

    if((e instanceof EntityDamageByEntityEvent)&&(war == true))
    or
    if(e instanceof EntityDamageByEntityEvent && war == true)
    should work
     
  8. Offline

    spankynutbean

    Sooo, would this work?

    Code:
    @EventHandler
        public void onWin(EntityDamageByEntityEvent e) {
            if((e instanceof EntityDamageByEntityEvent)&&(war == true)) {
        EntityDamageByEntityEvent event = (EntityDamageByEntityEvent) e;
        if(e.getEntity() instanceof EnderCrystal) {
            endwar = true;
        }
        }
        }
     
  9. Offline

    GodzOfMadness

    spankynutbean i would rather check my boolean another way
    to check if it's true just do if(war)
    and false do if(!war)
    not if(war == true)
    or if(war == false)
    just personal preference :p
     
  10. Offline

    spankynutbean

    Ok, now, how would i be able to spawn in the endercrystals?
     
  11. Offline

    GodzOfMadness

    spankynutbean here is an example of spawning a Endercrystal
    player.getWorld().spawnEntity(player.getLocation(), EntityType.ENDER_CRYSTAL);
     
  12. Offline

    spankynutbean

    Ok thanks guys!
     
Thread Status:
Not open for further replies.

Share This Page