[Solved]VariableDeclaratorId

Discussion in 'Plugin Development' started by jamw, Jun 1, 2012.

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

    jamw

    Code:
    public static HashMap<Player,List<Location>>= new HashMap<Player,List<Location>>();

    I get "VariableDeclaratorId expected after this token" and the red line is on the '>>' located above. I am very new to making hashmaps and to my knowledge this gets the player and the location. So what is wrong? Why am i getting the errors?
     
  2. Offline

    Njol

    Your variable has to have a name
     
  3. Offline

    jamw

    Where should i put the name? sorry i'm newer to coding, if you couldn't tell.
     
  4. Offline

    Njol

    public static HashMap<String, List<Location>> nameOfTheVariable = new HashMap<String, List<Location>>();

    I also changed Player to String since you should not use Player objects as keys, but use the players' names instead.
     
  5. Offline

    jamw

    Do i want list with java.util or awt?
    I'm making a plugin that locates all the chests a player places
     
  6. Offline

    Njol

    You would want to use java.util.List.
    Good look with that, though I would suggest to start with something easier which doesn't require data to be saved between server restarts.
     
  7. Offline

    jamw

    Yeah this is going to be a challenge lol. I don't really know how to practice hashmaps though, i still don't really understand what to use them with
     
Thread Status:
Not open for further replies.

Share This Page