Get items from 2 lists!

Discussion in 'Plugin Development' started by LagBug, Nov 20, 2017.

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

    LagBug

    Hello everyone, am trying to do that:

    So, when a player types [let's say] /potatolists ,it will get all of the items of 2 lists, and it will print a message like that:

    Commands:
    bluepotato --> redpotato
    greenpotato --> normalpotato
    etc. [the 1st is (bluepotato, greenpotato) the 1st list (lets say: currentlist) and the 2nd is (redpotato, normalpotato) is the 2nd list!

    Would really appreciate some help!
     
  2. Offline

    MightyOne

    Code:
    for(int i = 0; i < someList.length; i++)
        player.sendMessage(someList.get(i) + "-->" + someOtherList.get(1));
    
    that hard?
     
  3. Offline

    Smegel

    @MightyOne
    Your method won't even work :]

    @LagBug
    Why are you using two lists, instead of a hashmap?
     
  4. Offline

    CraftCreeper6

    @LagBug
    Do what @Smegel said and use a HashMap. If you intend to have bluepotato always equal to redpotato then this is your best bet.

    Otherwise do what @MightyOne said. It will work so long as both lists are the same length.
     
  5. Offline

    Blares

    use a config.yml file?
     
Thread Status:
Not open for further replies.

Share This Page