Not very good with databases.

Discussion in 'Plugin Development' started by TheDirtyDan, Jul 5, 2012.

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

    TheDirtyDan

    I am not good with databases so I was wondering if someone could point me to a good tutorial about the specific needs I want or explain how it's done. So on a BlockBreakEvent, I want to store the amount of diamond to stone ratio the person has, and then when I do a command say /br (for bad ratio), it shows a list of people with horrible ratios. I just want to do this to learn how to save this sort of stuff and also how to grab offline players.
     
  2. Offline

    pd9937

  3. Offline

    Aphelion

    If you still want to go the direction of learning how to use databases in conjunction with plugins, I suggest you install WAMP on your PC: http://www.makeuseof.com/tag/how-to-set-up-your-own-wampserver/

    Then you will be able to use the java.sql and com.sql.jdbc packages to create and manage Database connections. This article (from another SQL related thread yesterday), will give you some starting points: http://www.developer.com/java/data/jdbc-and-mysql-discussion-and-sample-code-for-jdbc-programs.html

    As pd9937 says, you could also use a hashmap for this, where you store the player name as the key, and their ratio as a string value. You could write this out to file at intervals, or when the server shuts down, so the map will persist across server restarts. It would be simpler than using a database, but it's always good to learn new things :)
     
  4. Offline

    LucasEmanuel

    I dont see why he has to use the entire WAMP package (Apahce (webserver), MySQL (database), PHP (scripting lanugage)) when he only needs a database?

    The simplest thing to do is study on how to work with SQLite3, you dont even have to install a database for that or tell your users to install a database its all handled locally and the packages to run it is builtin to CraftBukkit so you dont even have to download seperate libraries. :)
     
  5. Offline

    Aphelion

    Like I said, it's always good to learn new things ;), but SQLite does seem like the way most people are going. If i'm honest, it never really occured to me to use it :)
     
Thread Status:
Not open for further replies.

Share This Page