ArrayList

Discussion in 'Plugin Development' started by shutara, Apr 8, 2013.

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

    shutara

    Hi, i got a problem. I have engine variable and i need to write it to ArrayList but i dont know what type off array i need to use?
    Code:
    Locomotiva engine = new Locomotiva(trem, eletrica, v, this.plugin);
                this.plugin.getLocomotivas().add(engine);
    Crashes on .add(); Engine contains - (CommandSender, Command, String, String[]). How to?
     
  2. Offline

    chasechocolate

    Can't you just use a List<Locomotiva>engines = new ArrayList<Locomotiva>()?
     
  3. Offline

    shutara

    The type List is not generic; it cannot be parameterized with arguments <Locomotiva>

    New errors

    Code:
    List<Locomotiva>engine = new ArrayList<Locomotiva>();
                this.plugin.getLocomotivas().[B]add[/B](engine);//error
                if(eletrica) {
                    sender.sendMessage("Created electric locomotive with " + engine.[B]getPotencia[/B]() + "HP of power\n" +
                            "and " + engine.[B]getConsumo[/B]() + "HP of electric power consumption.\n" +
                            "Designed to run in " + engine.[B]getVoltagem[/B]() + "V lines, rain or shine!" +
                            "\nBe happy!");
                } else {
                    sender.sendMessage("Created lava locomotive with " + engine.[B]getPotencia[/B]() + "HP of power\nand " +
                            engine.[B]getCapacidadeCombustivel[/B]() + " of fuel capacity.\nBe happy!");
                }
                return true;
            }
            return false;
        }
    
    with bold i marked errors functtions

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 31, 2016
  4. 'getLocomotivas()' is... ? And the error is... ?
     
Thread Status:
Not open for further replies.

Share This Page