Sueta
✅S

✅StatsAPI [MySQLApi Simplified]✅[1.13.2-1.18]

1.1.3 beta

More simplified methods for create tables, add rows and other things into a database!

·Plugin

StatsAPI is a API plugin that use MySQL API by adding more simplified methods for create tables, add rows and other things!
Note: If you found any bugs please to report to me on discord! Alessandro (アレクサンデル)#5951
(Updated on 04/10/2021).
This plugin is in BETA phase!
If you see that the plugin works in other minecraft version please to refer it to me!
USAGE
StatsAPI
Class: mc.alessandroch.statsapi.StatsAPI

Table getTable(String tablename) // Return a Table class where you can do other cool things.
boolean existTable(String tablename) // Returns true if a table exists in the database.
int getTableRowsCount(String tablename) // Return the number of rows in a table.
void deleteTable(String tablename) // Delete a table from the database.

*/

Table
Class: mc.alessandroch.statsapi.Table

void setName(String name) // Set the name of the table
String getName() // Return the name of the table
void addIntType(String name) // Add a column of INT type to the table that will be created (Used when the table not exist)
void addTextType(String name) // Add a column of TEXT type to the table that will be created (Used when the table not exist)
void addFloatType(String name) // Add a column of FLOAT type to the table that will be created (Used when the table not exist)
void addDoubleType(String name) // Add a column of DOUBLE type to the table that will be created (Used when the table not exist)
void addBooleanType(String name) // Add a column of BOOLEAN type to the table that will be created (Used when the table not exist)
void inizializeTable(TableType type) // Finish the creation of the table
/*TableType are
UUIDIncluded, where create a table with first column a TEXT uuid (this only for get data by player uuid)
STARTAsEmpty used for create a table without uuid column, and used for other things that not require player uuid

*/
String getText(Player player, String columnname) // Get a String with the text of the column got by player uuid
int getInt(Player player, String columnname) // Get a Int from the column got by player uuid
float getFloat(Player player, String columnname) // Get a Float from the column got by player uuid
Boolean getBoolean(Player player, String columnname) // Get a boolean from the column got by player uuid
double getDouble(Player player, String columnname) // Get a Double from the column got by player uuid
Object getObject(Player player, String columnname) // Get a other type of class from column by player uuid that are not supported yet with this API

void setInt(Player player, String columnname, int value) // Set a int column with the designed value of the player uuid row.
void setFloat(Player player, String columnname, float value) // Set a float column with the designed value of the player uuid row.
void setDouble(Player player, String columnname, double value) // Set a double column with the designed value of the player uuid row.
void setText(Player player, String columnname, String value) // Set a TEXT column with the designed value of the player uuid row.
void setBoolean(Player player, String columnname, boolean value) // Set a boolean column with the designed value of the player uuid row.
void setObject(Player player, String columnname, Object value) // Set an other object column that are not supported yet from this API.

void removeRow(Player player) // Remove the row of the player uuid

Example

//Create for the first time a table
Table table = new Table("cool_table");
table.addIntType("wins");
table.addIntType("deaths");
table.addIntType("kills");
table.addDoubleType("health");
table.inizializeTable(TableType.UUIDIncluded); //It finish to create the table into the database and add for first a uuid column for get the data by player uuid!

//Add a player into the table rows
//Note: columns and values are need to be writed like MySQL api does.
table.addPlayerIntoTable(player,"wins, deaths, kills, health","0, 0, 0, 0")

//Get and set the data by player uuid
int allWins = table.getInt(player, "wins");
allWins+=1; //add a win;
table.setInt(player,"wins",allWins);

My discord server: https://discord.gg/6EJMxGXT8R

Similar projects

Plugin →