MySQL API 2.4

A simplified MySQL API that will help you work with your Minecraft related database.

  1. Vagdedes
    Native Minecraft Version:
    Legacy (< 1.13)
    Tested Minecraft Versions:
    • 1.7
    • 1.8
    • 1.9
    • 1.10
    • 1.11
    • 1.12
    • 1.13
    Contributors:
    Can be found in the Discord server (https://discord.gg/TTrqRkM)
    Languages Supported:
    English

    Permissions:
    mysql.admin - Gives your permission to /mysql command.

    Commands:

    /mysql <reload/rl> - Reloads the config.
    /mysql <connect/disconnect/reconnect> - Interacts with the connection.

    Config API:
    Class: me.vagdedes.basic.Config

    Code (Text):

    void create() // Creates the config or object if doesn't exist.
    void reload() // Reloads the plugin config.
    void clear() // Clears the mysql configuration file.

    String getHost() // Returns the host.
    String getUser() // Returns the user.
    String getPassword() // Returns the password.
    String getDatabase() // Returns the database.
    String getPort() // Returns the port.

    void setHost(String s) // Changes the host.
    void setUser(String s) // Changes the user
    void setPassword(String s) // Changes the password.
    void setDatabase(String s) // Changes the database.
    void setPort(String s) // Changes the port.
     
    Basic API:

    Class: me.vagdedes.mysql.MySQL
    Code (Text):

    void connect() // Connects to the database.
    void disconnect() // Disconnects from the database.
    void reconnect() // Restarts the connection to the database.
    Boolean isConnected() // Checks if the connection exists.
    void update(String command) // Excecutes an update to the database.
    ResultSet query(String command) // Returns a query from the database.
    Connection getConnection() // Returns the mysql current connection.
     
    Advanced API:

    Class: me.vagdedes.mysql.SQL
    Code (Text):

    void deleteTable(String table) // Deletes a table from the database.
    void truncateTable(String table) // Clears a table in the database.
    Integer countRows(String table) // Coureturns retunrs the number of rows in a table.
    Boolean tableExists(String table) // Returns if a table exists in the database.
     

    Object get(String selected, String column, String logic_gate, String data, String table)
    Returns an object variable owned by the selected column.
    Code (Text):
    Object o = SQL.get("kills", "uuid", "!=", "6t4efghsdq251", "pvp_stats");

    void set(String selected, Object object, String column, String logic_gate, String data, String table)
    Updates the data of a column with your inserted object.
    Code (Text):
    SQL.set("cooldown", 5, "name", "=", "Player", "basic_table");

    void deleteData(String column, String logic_gate, String data, String table)
    Deletes data from a table.
    Code (Text):
    SQL.deleteData("nickname", "=", "George2009", "ranks");

    void insertData(String columns, String values, String table)
    Inserts data into a table.
    Code (Text):
    SQL.insertData("name, kit, cooldown", " 'Sam', 'Fisherman', '29' ", "kitpvp");

    Boolean exists(String column, String data, String table)
    Checks if a data exists in a certain column.
    Code (Text):
    Boolean b = SQL.exists("custom_nickname", "&1J&2o&3h&4n", "player_settings");

    void createTable(String table, String columns)
    Creates a new table if it doesn't already exist.
    Code (Text):
    SQL.createTable("ranks", "rank INT (11), join_date TIMESTAMP");

    If the advanced methods of the SQL class aren't enough for your systems, you can still make your own by using MySQL's class update and query methods.

Recent Updates

  1. Version 2.4
  2. Version 2.3
  3. Version 2.2

Recent Reviews

  1. RedLime
    RedLime
    5/5,
    Version: 2.4
    thank you!
    I can developing plugins as too fast!
    10/10
    =========================
  2. 14i56
    14i56
    5/5,
    Version: 2.4
    After hours of thinking about my errors, they were fixed. Now I can say this is great API. Keep up the good work and support.

    For another persons, if your plugin is started previously than API, it shows errors in console with NullPointer because SQL is not connected.
  3. DrOreo002
    DrOreo002
    5/5,
    Version: 2.4
    Really useful API!. Thanks so much for this!, this will help me a lot!

    10/10

    - DrOreo002
  4. FalconSeeker
    FalconSeeker
    5/5,
    Version: 2.4
    Excellent work!
    ------------------------------------------------------------------------------
    i needed something like this badly ffor a while
  5. Mr_Redstone_19
    Mr_Redstone_19
    4/5,
    Version: 2.4
    If I do /mysql disconnect, MySQL doesnt disconnect. What can I do? I need it :D.
    1. Vagdedes
      Author's Response
      Threads exist for discussions. Leaving a review, won't get you the answer...
  6. VoidCraftPlays
    VoidCraftPlays
    5/5,
    Version: 2.4
    I love this API seeing as I am ridiculously lazy and never implement MySQL into my plugins, but this makes it that much easier.
  7. Crafting4ever
    Crafting4ever
    5/5,
    Version: 2.3
    Pure amazing! Never have seen a better API. Docs are great. No real way to explain it more than examples!
    1. Vagdedes
      Author's Response
      Thank you!
  8. catman2014_
    catman2014_
    5/5,
    Version: 2.3
    Amazing plugin! The documentation is now amazing and much better than it used to be!
  9. catman2014_
    catman2014_
    4/5,
    Version: Version 2.1
    A very good API, makes it much easier to use MySQL in Java / Spigot / Bukkit plugins, I have tried to standard way, but failed all 3 times, this makes that so much easier, I would give this resource 5 stars, but it doesn't have the best documentation, improve on this and I will change my review to 5 stars! Thanks, this is awsome!
    1. Vagdedes
      Author's Response
      Thanks for the review. I will make sure to improve it.
  10. hhsskk_story
    hhsskk_story
    5/5,
    Version: Version 2.1
    good jobs ! this simple library is very useful, but also hope you can add more featueres!
    1. Vagdedes
      Author's Response
      Thank you. Make sure to use the discussion to tell me what features you would like.