Help

Discussion in 'Spigot Plugin Development' started by byTrentox., May 27, 2017.

  1. How can i use the args[0] as condition in a for loop? Because i wanted to add the command /spawnmob <Entity> <Amount>. So now i need to know how i can do this with a for loop?

    Btw, sorry for my bad english. I am German xd
     
  2. Why do you need a for loop in a args?
     
  3. Cause I need the number from the args 0 for example.
     
  4. Code (Text):
    for(int i = 0; i < Integer.valueOf(args[1]); i++) {
        EntityType entType = EntityType.valueOf(args[0]);
        Bukkit.getWorld("world").spawnEntity(p.getLocation(), entType);
    }
    this should work c:
     
    • Agree Agree x 1
  5. Why would you loop through a NUMBER. You can't loop through 5 or 10...

    Integer.parseInt(arg0); returns a int (your amount or entityID?
     
    • Agree Agree x 1