"spawnEntity" amount?

Discussion in 'Plugin Development' started by Goty_Metal, Dec 6, 2012.

Thread Status:
Not open for further replies.
  1. I tried many ways and read all the doc but with that method you can only spawn 1 entity, i mean, there's no int to modify, if i want more i must repeat it ? But if i want to get the amount from config what should i do?

    Like:
    (In config)
    SpawnAmount: 5

    (In Java)
    ......getWorld().spawnEntity(location, EntityType.CREEPER);

    and

    plugin.getConfig().getInt(config);
     
  2. Offline

    fireblast709

    loops are your friends :3
     
  3. Ye but i don't know how to use them yet XD
     
  4. Offline

    fireblast709

  5. Offline

    jayfella

    Code:
     
    int count = plugin.getConfig().getInt(config);
     
    for (int i = 0; i < count; i++)
    {
            ......getWorld().spawnEntity(location, EntityType.CREEPER);
    }
     
    
     
  6. Offline

    tommycake50

    im presuming you have a command with the amount as an argument.
    Code:
    if(sender instanceof Player){
    Location loc = (Player)sender.getLocation();
    loc.setBlockX(loc.getBlockX + 5);
    for(i = integer.parseInt(args[0]); i >0; i--){
    (Player)sender.getWorld().spawnEntity(location, EntityType.CREEPER);
    }
    }
    
    dont know how much of this works done it off the top of my head
     
  7. Offline

    ImDeJay

  8. Not really, if you read my first message, i'm getting the amount from the config XD
     
Thread Status:
Not open for further replies.

Share This Page