MySQL Storage System

Jun 7, 2015
MySQL Storage System
  • BattleClans - SQL Storage System

    This 'Wiki Page' will serve to document the SQL Storage System of BattleClans.

    SQL Storage System | Introduction:

    The way BattleClans keeps track of it's data is by storing it in a Table within a SQL Database. This is a common method in which resources store data relevant to their usage. BattleClans has four tables at the time of writing this. Which are as follows; Players, Clans, Memos and, Claims.

    The purpose of the Players table is quite obvious. Though, To be precise, It stores such data as: UUID, Name, Clan, LastClan, ClanTag, LastClanTag, Memo, ChatMode, LastOnline.

    The Clans table keeps track of all of the Clans. Such as the Leader of each Clan and, Coordinates of the Clans Home. As well as the clans tag.

    The Claims table is used to store world data, Such as what chunks are owned by which clans. As well as in what world the chunks are claimed.

    The Memos table is used to store messages set by the Leader. Which are broadcasted to each member one time when they login or, Immediately if the member is online.

    SQL Storage System | Configuration:

    As you may well know by now, The connection settings for connecting to your MySQL Database are available in the Configuration file. If MySQL is not enabled in the Configuration file, BattleClans will default to use a SQLite database. It is important to configure which database you would like to use, As BattleClans won't be able to export data from one database to another. So, If you go a couple months using SQLite then switch to MySQL, You'll have to export everything manually or, Lose your existing data.

    Once you have placed BattleClans in your plugins folder and, restarted your server. BattleClans will generate all of it's necessary files and, Start writing to a SQLite database by default. At this point, If everything appears normal and, No errors have been generated. You should stop your server and, Make your desired configuration changes. As well, You can edit the Messages.yml file.

    This is where you would input your MySQL Database settings if you don't want to use a SQLite database. After you have filled in all the fields pertaining to MySQL, Make sure to set "Enabled = true". Once this has been done, You can proceed to Start your server again. From here, Everything should work as planned.

    MySQL Storage System | Post Configuration:

    Typically, Once configured properly, BattleClans should run maintenance free. The only exception to this is during the initial setup. When the MySQL Connection detail you provided are deemed valid and, A connection is established to the Database. BattleClans will attempt to create four tables previously mentioned. As a fail safe, If the four tables don't exist or, Can't be created BattleClans will disable itself.

    If you're one of the fortunate ones and, Were successful on connecting to your MySQL database on the first attempt congratulations. BattleClans, Will check to verify that the required tables exist. If they don't exist, They will be created. Once this check has passed, BattleClans will go on to verify that each table contains the appropriate columns it needs. Like before, If they don't exists, They should be created automatically. If not, BattleClans will disable itself.

    While your server is starting up and, BattleClans is creating the required tables in the MySQL database you provided. You may notice that Players can't login. This is a fail safe, Built into BattleClans. Which denies login attempts while BattleClans has not been fully initialized. BattleClans is considered fully initialized when the tables are created and, the reconnection is performed. This process should take less than a minute in most cases and, Only occurs when the required tables don't exist. Which means, When you restart your server or, Reload it. You won't experience the fail safe ever again, Unless you have to reinstall BattleClans.
  • Loading...
  • Loading...