How to get the mysql list and use it?

Discussion in 'Plugin Development' started by MrGG4ming, Feb 4, 2017.

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

    MrGG4ming

    Hello everyone, I'm new to programming started two months and today I'm going through a challenge I'll explain to you.

    Well, I created a plugin in which the player can buy a certain region, but the information is being registered in a HashMap and every time I restart the server the information basically leaks and everything starts over ..

    I learned now the mecher with the basics of mysql and I know how to register information, however now I do not know how to make the plugin I did check the mysql list, Good to get easier to understand this is the system in which verifies the regions : http://pastebin.com/DJsp9nbA

    And this place is where it stores information: http://pastebin.com/S8dfuYkU, Sorry for the mess .. But what I wanted to change is how to check this list by taking the information that is registered in my mysql, How do I do this?


    Sorry my English because I'm Brazilian!
     
    Last edited: Feb 4, 2017
  2. Offline

    timtower Administrator Administrator Moderator

    @MrGG4ming Phpmyadmin is just an interface, doesn't store anything, so not related to this question.
    Do you know how to save and load information with mysql in Java?
     
  3. Offline

    MrGG4ming

    @timtower Yes I know how to store and get information.
     
  4. Offline

    timtower Administrator Administrator Moderator

    @MrGG4ming Then why not load all the information in the onEnable and save in the onDisable?
     
  5. Offline

    MrGG4ming

    @timtower Well the plugin I made it takes the HashMap <list> where all the saved information is stored, I get a mysql information at a time I know, but I get several as if it were a <list> I do not know. I do not know if I'm being very accurate, but I want to get all the information that is in the table and return me as a <list>

    Catching onEnable and saving not onDisable would it?
     
  6. Offline

    timtower Administrator Administrator Moderator

    @MrGG4ming You execute a select query, you fill your list / lists with the data that you got from it.
    When a new region gets created you perform an insert query.
     
  7. Offline

    MrGG4ming

    @timtower Is it basically something like: ?
     
  8. Offline

    timtower Administrator Administrator Moderator

    @MrGG4ming Maybe, not gonna watch a video to answer that question.
     
Thread Status:
Not open for further replies.

Share This Page