Home›Java›Mods›TitanSQL
TitanSQL
ModsJava

TitanSQL

Java mod listed for Minecraft 1.14. Downloads from the MC Java Mods app on Android.

⬇ Download on Spigot
TitanSQL ​
This is another mySQL plugin. The best use is to load all data on server startup and send changes to TitanSQL as needed. TitanSQL will collect data from all plugins using it and send every 5 minutes (configable) and when server is shutting down, data will be send as bulk. Also, inserts will be sent first then deletes so it's best to make every row a unique id with no repeat ids.

I've been using this on my server for over a year and it works really well and reliable so I thought I would share it.

Example ​
Code (Text):

public static Table yourMySQLTable = new Table("MySQLTable");
public void onEnable()
{
        setupTable();
        loadData();
}
public static void setupTable()
    {
        yourMySQLTable.addDataType("id", DataTypeEnum.CHARARRAY, true, false, true);
        yourMySQLTable.addDataType("modules", DataTypeEnum.STRINGLIST, false, false, false);
        yourMySQLTable.addDataType("owner", DataTypeEnum.UUID, false, false, false);
        yourMySQLTable.addDataType("size", DataTypeEnum.INTEGER, false, false, false);
        yourMySQLTable.addDataType("location", DataTypeEnum.LOCATION, false, false, false);

        yourMySQLTable.createTable(); //create the table only if one doesn't exist.

    }
public static void loadData()
{
//load only at startup (recommended)
    yourMySQLTable.search(new CallbackResults() {
        @Override
        public void onResult(List<HashMap<String, ResultData>> results) {
            if (results != null && results.size() >0) {
                for (HashMap<String, ResultData> result : results) {
                    String key = result.get("id").getString();
                    List<String> tmp = result.get("modules").getStringList();
                    UUID owner = result.get("owner").getUUID();
                    int size = result.get("size").getInteger();
                    //do something
                }
            }
            System.out.println("Loaded: " + results.size());
        }
    });
}

public void saveData()
{
//Savedata when needed.
        yourMySQLTable.setDataField("id", this.getID());
        yourMySQLTable.setDataField("modules", keys);
        yourMySQLTable.setDataField("owner", this.getOwner());
        yourMySQLTable.setDataField("size", this.getMax());
        yourMySQLTable.setDataField("location", this.getLocation());
        yourMySQLTable.insertData();
    }
}
public void removeField(String ID)
{
//call when needed
    yourMySQLTable.delete("id", ID);
}
 

Data Types ​

Methods
  • addDataType (String name, DataTypeEnum type, Boolean NOT_NULL, Boolean UNIQUE, boolean PRIMARY_KEY)
    adds field to the MySQL table, you must add all the fields in the table.
    ​
  • createTable ()
    Creates a table if it doesn't exist
    ​
  • search (final CallbackResults callback)​
  • search (String type, Object what, CallbackResults callback)​
  • search (final DataType type, final Object what, final CallbackResults callback)
    Search table for results
    ​
  • setDataField (String dataname, Object value)
    sets data in a field for saving
    ​
  • insertData ()
    sends all fields once there set.
    ​
  • delete (String name, Object what)
    Deletes data from table
    ​
Config ​
Code (Text):

  host: Host_Adrress_Here
  port: '3306'
  database: Database_Name_Here
  username: Username_Name_Here
  password: Password_Name_Here
  enabled: false #Turn to turn once information is set
  max_que_size: 1000 #Before sending
  stop_sending_on_shutdown: 5.0 #Minutes
  send_data_intervals: 5.0 #Minutes
 


Quick facts

Install steps are the general flow for this file type — How to install Minecraft Java mods & modpacks walks through it step by step.

TitanSQL is a free Minecraft Java mod. Compatible with Minecraft 1.14. Downloaded 215 times (via Spigot). Download it and open it directly in the game.

Explore more