Hashmap with multiple variables?

Discussion in 'Plugin Development' started by spurkle, Jul 30, 2014.

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

    spurkle

    Hi. How can i make a hashmap with multiple variables? Like:

    hashmap.put(variable1,variable2,variable3,variable4);

    Thanks.
     
  2. spurkle To do what exactly? This isn't possible the way you showed it, but tell us how you actually want to use this and we may be able to help
     
  3. Offline

    spurkle

    I am making a custom items plugin. and i want it to work like this:
    You add item data into a database (min. damage, max. damage, price,etc)
    When server starts, i want to put all that data into a hashmap. Item id, damages, price, etc.
    And then when player hits something with an item, the plugin would get the items data from a hashmap.(So i won't have to access a database every time someone hits something with a custom item)
     
  4. spurkle Create a simple class that holds those values and then store the objects of that.
    EDIT: Since you're storing item data can't you just store the ItemStack?
     
    Dragonphase likes this.
  5. Offline

    spurkle

    Won't really work for the way i want it to be ;3
     
  6. Offline

    stonar96

    Which way??

    Create a class, put in private variables with your values, create getter and setter. Then store the Objects in a list or a hashmap.

    (this is what classes are made for)

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 9, 2016
Thread Status:
Not open for further replies.

Share This Page