use of me.staartvin.statz.database.datatype.sqlite.SQLiteTable in project Statz by Staartvin.
the class SQLiteConnector method loadTables.
@Override
public void loadTables() {
// UUID table to look up uuid of players
SQLiteTable newTable = new SQLiteTable("players");
Column id = new Column("id", true, SQLDataType.INT, true);
// Populate table
// UUID of the player
newTable.addColumn("uuid", true, SQLDataType.TEXT);
// Name of player
newTable.addColumn("playerName", false, SQLDataType.TEXT);
this.addTable(newTable);
// ----------------------------------------------------------
// How many times did a player join this server?
newTable = new SQLiteTable(PlayerStat.JOINS.getTableName());
// UUID of the player
newTable.addColumn("uuid", true, SQLDataType.TEXT);
// How many times did the player join.
newTable.addColumn("value", false, SQLDataType.INT);
this.addTable(newTable);
// ----------------------------------------------------------
// How many times did a player die?
newTable = new SQLiteTable(PlayerStat.DEATHS.getTableName());
id = new Column("id", true, SQLDataType.INT, true);
newTable.addColumn(id);
// UUID of the player
newTable.addColumn("uuid", false, SQLDataType.TEXT);
// How many times did the player die.
newTable.addColumn("value", false, SQLDataType.INT);
// What world did the player die.
newTable.addColumn("world", false, SQLDataType.TEXT);
newTable.addUniqueMatched("uuid");
newTable.addUniqueMatched("world");
this.addTable(newTable);
// ----------------------------------------------------------
// How many times did a player catch an item and what type?
newTable = new SQLiteTable(PlayerStat.ITEMS_CAUGHT.getTableName());
id = new Column("id", true, SQLDataType.INT, true);
newTable.addColumn(id);
Column uuid = new Column("uuid", false, SQLDataType.TEXT, true);
Column caught = new Column("caught", false, SQLDataType.TEXT, true);
Column world = new Column("world", false, SQLDataType.TEXT, true);
// UUID of the player
newTable.addColumn(uuid);
newTable.addColumn("value", false, SQLDataType.INT);
newTable.addColumn(caught);
newTable.addColumn(world);
newTable.addUniqueMatched(uuid);
newTable.addUniqueMatched(caught);
newTable.addUniqueMatched(world);
this.addTable(newTable);
// ----------------------------------------------------------
// What block did a player place and how many times?
newTable = new SQLiteTable(PlayerStat.BLOCKS_PLACED.getTableName());
id = new Column("id", true, SQLDataType.INT, true);
newTable.addColumn(id);
uuid = new Column("uuid", false, SQLDataType.TEXT, true);
Column typeID = new Column("typeid", false, SQLDataType.INT, true);
Column dataValue = new Column("datavalue", false, SQLDataType.INT, true);
world = new Column("world", false, SQLDataType.TEXT, true);
// UUID of the player
newTable.addColumn(uuid);
newTable.addColumn("value", false, SQLDataType.INT);
newTable.addColumn(world);
newTable.addColumn(typeID);
newTable.addColumn(dataValue);
newTable.addUniqueMatched(uuid);
newTable.addUniqueMatched(typeID);
newTable.addUniqueMatched(dataValue);
newTable.addUniqueMatched(world);
this.addTable(newTable);
// ----------------------------------------------------------
// What block did a player break and how many times?
newTable = new SQLiteTable(PlayerStat.BLOCKS_BROKEN.getTableName());
id = new Column("id", true, SQLDataType.INT, true);
uuid = new Column("uuid", false, SQLDataType.TEXT, true);
typeID = new Column("typeid", false, SQLDataType.INT, true);
dataValue = new Column("datavalue", false, SQLDataType.INT, true);
world = new Column("world", false, SQLDataType.TEXT, true);
newTable.addColumn(id);
// UUID of the player
newTable.addColumn(uuid);
newTable.addColumn("value", false, SQLDataType.INT);
newTable.addColumn(world);
newTable.addColumn(typeID);
newTable.addColumn(dataValue);
newTable.addUniqueMatched(uuid);
newTable.addUniqueMatched(typeID);
newTable.addUniqueMatched(dataValue);
newTable.addUniqueMatched(world);
this.addTable(newTable);
// ----------------------------------------------------------
// What mobs did a player kill?
newTable = new SQLiteTable(PlayerStat.KILLS_MOBS.getTableName());
id = new Column("id", true, SQLDataType.INT, true);
uuid = new Column("uuid", false, SQLDataType.TEXT, true);
typeID = new Column("mob", false, SQLDataType.TEXT, true);
world = new Column("world", false, SQLDataType.TEXT, true);
Column weapon = new Column("weapon", false, SQLDataType.TEXT, true);
newTable.addColumn(id);
// UUID of the player
newTable.addColumn(uuid);
newTable.addColumn("value", false, SQLDataType.INT);
newTable.addColumn(world);
newTable.addColumn(typeID);
newTable.addColumn(weapon);
newTable.addUniqueMatched(uuid);
newTable.addUniqueMatched(typeID);
newTable.addUniqueMatched(world);
newTable.addUniqueMatched(weapon);
this.addTable(newTable);
// ----------------------------------------------------------
// What players did a player kill?
newTable = new SQLiteTable(PlayerStat.KILLS_PLAYERS.getTableName());
id = new Column("id", true, SQLDataType.INT, true);
uuid = new Column("uuid", false, SQLDataType.TEXT, true);
typeID = new Column("playerKilled", false, SQLDataType.TEXT, true);
world = new Column("world", false, SQLDataType.TEXT, true);
newTable.addColumn(id);
// UUID of the player
newTable.addColumn(uuid);
newTable.addColumn("value", false, SQLDataType.INT);
newTable.addColumn(world);
newTable.addColumn(typeID);
newTable.addUniqueMatched(uuid);
newTable.addUniqueMatched(typeID);
newTable.addUniqueMatched(world);
this.addTable(newTable);
// ----------------------------------------------------------
// How long did a player play (in minutes)?
newTable = new SQLiteTable(PlayerStat.TIME_PLAYED.getTableName());
id = new Column("id", true, SQLDataType.INT, true);
uuid = new Column("uuid", false, SQLDataType.TEXT, true);
world = new Column("world", false, SQLDataType.TEXT, true);
newTable.addColumn(id);
// UUID of the player
newTable.addColumn(uuid);
newTable.addColumn("value", false, SQLDataType.INT);
newTable.addColumn(world);
newTable.addUniqueMatched(uuid);
newTable.addUniqueMatched(world);
this.addTable(newTable);
// ----------------------------------------------------------
// What food did a player eat?
newTable = new SQLiteTable(PlayerStat.FOOD_EATEN.getTableName());
id = new Column("id", true, SQLDataType.INT, true);
uuid = new Column("uuid", false, SQLDataType.TEXT, true);
typeID = new Column("foodEaten", false, SQLDataType.TEXT, true);
world = new Column("world", false, SQLDataType.TEXT, true);
newTable.addColumn(id);
// UUID of the player
newTable.addColumn(uuid);
newTable.addColumn("value", false, SQLDataType.INT);
newTable.addColumn(world);
newTable.addColumn(typeID);
newTable.addUniqueMatched(uuid);
newTable.addUniqueMatched(typeID);
newTable.addUniqueMatched(world);
this.addTable(newTable);
// ----------------------------------------------------------
// How much damage has a player taken?
newTable = new SQLiteTable(PlayerStat.DAMAGE_TAKEN.getTableName());
id = new Column("id", true, SQLDataType.INT, true);
uuid = new Column("uuid", false, SQLDataType.TEXT, true);
typeID = new Column("cause", false, SQLDataType.TEXT, true);
world = new Column("world", false, SQLDataType.TEXT, true);
newTable.addColumn(id);
// UUID of the player
newTable.addColumn(uuid);
newTable.addColumn("value", false, SQLDataType.INT);
newTable.addColumn(world);
newTable.addColumn(typeID);
newTable.addUniqueMatched(uuid);
newTable.addUniqueMatched(typeID);
newTable.addUniqueMatched(world);
this.addTable(newTable);
// ----------------------------------------------------------
// How many sheep did a player shear?
newTable = new SQLiteTable(PlayerStat.TIMES_SHORN.getTableName());
id = new Column("id", true, SQLDataType.INT, true);
uuid = new Column("uuid", false, SQLDataType.TEXT, true);
world = new Column("world", false, SQLDataType.TEXT, true);
newTable.addColumn(id);
// UUID of the player
newTable.addColumn(uuid);
newTable.addColumn("value", false, SQLDataType.INT);
newTable.addColumn(world);
newTable.addUniqueMatched(uuid);
newTable.addUniqueMatched(world);
this.addTable(newTable);
// ----------------------------------------------------------
// How far and in what way has a player travelled?
newTable = new SQLiteTable(PlayerStat.DISTANCE_TRAVELLED.getTableName());
id = new Column("id", true, SQLDataType.INT, true);
uuid = new Column("uuid", false, SQLDataType.TEXT, true);
typeID = new Column("moveType", false, SQLDataType.TEXT, true);
world = new Column("world", false, SQLDataType.TEXT, true);
newTable.addColumn(id);
// UUID of the player
newTable.addColumn(uuid);
newTable.addColumn("value", false, SQLDataType.INT);
newTable.addColumn(world);
newTable.addColumn(typeID);
newTable.addUniqueMatched(uuid);
newTable.addUniqueMatched(typeID);
newTable.addUniqueMatched(world);
this.addTable(newTable);
// ----------------------------------------------------------
// How far and in what way has a player travelled?
newTable = new SQLiteTable(PlayerStat.ITEMS_CRAFTED.getTableName());
id = new Column("id", true, SQLDataType.INT, true);
uuid = new Column("uuid", false, SQLDataType.TEXT, true);
typeID = new Column("item", false, SQLDataType.TEXT, true);
world = new Column("world", false, SQLDataType.TEXT, true);
newTable.addColumn(id);
// UUID of the player
newTable.addColumn(uuid);
newTable.addColumn("value", false, SQLDataType.INT);
newTable.addColumn(world);
newTable.addColumn(typeID);
newTable.addUniqueMatched(uuid);
newTable.addUniqueMatched(typeID);
newTable.addUniqueMatched(world);
this.addTable(newTable);
// ----------------------------------------------------------
// How much XP did a player gain?
newTable = new SQLiteTable(PlayerStat.XP_GAINED.getTableName());
id = new Column("id", true, SQLDataType.INT, true);
uuid = new Column("uuid", false, SQLDataType.TEXT, true);
world = new Column("world", false, SQLDataType.TEXT, true);
newTable.addColumn(id);
// UUID of the player
newTable.addColumn(uuid);
newTable.addColumn("value", false, SQLDataType.INT);
newTable.addColumn(world);
newTable.addUniqueMatched(uuid);
newTable.addUniqueMatched(world);
this.addTable(newTable);
// ----------------------------------------------------------
// How many times did a player vote for this server?
newTable = new SQLiteTable(PlayerStat.VOTES.getTableName());
// UUID of the player
newTable.addColumn("uuid", true, SQLDataType.TEXT);
// How many times did the player vote.
newTable.addColumn("value", false, SQLDataType.INT);
this.addTable(newTable);
// ----------------------------------------------------------
// How many arrows did a player shoot?
newTable = new SQLiteTable(PlayerStat.ARROWS_SHOT.getTableName());
id = new Column("id", true, SQLDataType.INT, true);
uuid = new Column("uuid", false, SQLDataType.TEXT, true);
world = new Column("world", false, SQLDataType.TEXT, true);
typeID = new Column("forceShot", false, SQLDataType.DOUBLE, true);
newTable.addColumn(id);
// UUID of the player
newTable.addColumn(uuid);
newTable.addColumn("value", false, SQLDataType.INT, true);
newTable.addColumn(world);
newTable.addColumn(typeID);
newTable.addUniqueMatched(uuid);
newTable.addUniqueMatched(world);
newTable.addUniqueMatched(typeID);
this.addTable(newTable);
// ----------------------------------------------------------
// How many times did a player enter a bed?
newTable = new SQLiteTable(PlayerStat.ENTERED_BEDS.getTableName());
id = new Column("id", true, SQLDataType.INT, true);
uuid = new Column("uuid", false, SQLDataType.TEXT, true);
world = new Column("world", false, SQLDataType.TEXT, true);
newTable.addColumn(id);
// UUID of the player
newTable.addColumn(uuid);
newTable.addColumn("value", false, SQLDataType.INT, true);
newTable.addColumn(world);
newTable.addUniqueMatched(uuid);
newTable.addUniqueMatched(world);
this.addTable(newTable);
// ----------------------------------------------------------
// How many times did a player perform a command?
newTable = new SQLiteTable(PlayerStat.COMMANDS_PERFORMED.getTableName());
id = new Column("id", true, SQLDataType.INT, true);
uuid = new Column("uuid", false, SQLDataType.TEXT, true);
world = new Column("world", false, SQLDataType.TEXT, true);
newTable.addColumn(id);
// UUID of the player
newTable.addColumn(uuid);
newTable.addColumn("value", false, SQLDataType.INT, true);
newTable.addColumn(world);
newTable.addColumn("command", false, SQLDataType.TEXT, true);
newTable.addColumn("arguments", false, SQLDataType.TEXT, true);
newTable.addUniqueMatched(uuid);
newTable.addUniqueMatched(world);
newTable.addUniqueMatched("command");
newTable.addUniqueMatched("arguments");
this.addTable(newTable);
// ----------------------------------------------------------
// How many times did a player get kicked?
newTable = new SQLiteTable(PlayerStat.TIMES_KICKED.getTableName());
id = new Column("id", true, SQLDataType.INT, true);
uuid = new Column("uuid", false, SQLDataType.TEXT, true);
world = new Column("world", false, SQLDataType.TEXT, true);
newTable.addColumn(id);
// UUID of the player
newTable.addColumn(uuid);
newTable.addColumn("value", false, SQLDataType.INT, true);
newTable.addColumn(world);
newTable.addColumn("reason", false, SQLDataType.TEXT, true);
newTable.addUniqueMatched(uuid);
newTable.addUniqueMatched(world);
newTable.addUniqueMatched("reason");
this.addTable(newTable);
// ----------------------------------------------------------
// How many tools did a player break?
newTable = new SQLiteTable(PlayerStat.TOOLS_BROKEN.getTableName());
id = new Column("id", true, SQLDataType.INT, true);
uuid = new Column("uuid", false, SQLDataType.TEXT, true);
world = new Column("world", false, SQLDataType.TEXT, true);
newTable.addColumn(id);
// UUID of the player
newTable.addColumn(uuid);
newTable.addColumn("value", false, SQLDataType.INT, true);
newTable.addColumn(world);
newTable.addColumn("item", false, SQLDataType.TEXT, true);
newTable.addUniqueMatched(uuid);
newTable.addUniqueMatched(world);
newTable.addUniqueMatched("item");
this.addTable(newTable);
// ----------------------------------------------------------
// How many eggs did a player throw?
newTable = new SQLiteTable(PlayerStat.EGGS_THROWN.getTableName());
id = new Column("id", true, SQLDataType.INT, true);
uuid = new Column("uuid", false, SQLDataType.TEXT, true);
world = new Column("world", false, SQLDataType.TEXT, true);
newTable.addColumn(id);
// UUID of the player
newTable.addColumn(uuid);
newTable.addColumn("value", false, SQLDataType.INT, true);
newTable.addColumn(world);
newTable.addUniqueMatched(uuid);
newTable.addUniqueMatched(world);
this.addTable(newTable);
// ----------------------------------------------------------
// How many times did a player switch worlds?
newTable = new SQLiteTable(PlayerStat.WORLDS_CHANGED.getTableName());
id = new Column("id", true, SQLDataType.INT, true);
uuid = new Column("uuid", false, SQLDataType.TEXT, true);
world = new Column("world", false, SQLDataType.TEXT, true);
newTable.addColumn(id);
// UUID of the player
newTable.addColumn(uuid);
newTable.addColumn("value", false, SQLDataType.INT, true);
newTable.addColumn(world);
newTable.addColumn("destWorld", false, SQLDataType.TEXT, true);
newTable.addUniqueMatched(uuid);
newTable.addUniqueMatched(world);
newTable.addUniqueMatched("destWorld");
this.addTable(newTable);
// ----------------------------------------------------------
// How many times did a player fill a bucket?
newTable = new SQLiteTable(PlayerStat.BUCKETS_FILLED.getTableName());
id = new Column("id", true, SQLDataType.INT, true);
uuid = new Column("uuid", false, SQLDataType.TEXT, true);
world = new Column("world", false, SQLDataType.TEXT, true);
newTable.addColumn(id);
// UUID of the player
newTable.addColumn(uuid);
newTable.addColumn("value", false, SQLDataType.INT, true);
newTable.addColumn(world);
newTable.addUniqueMatched(uuid);
newTable.addUniqueMatched(world);
this.addTable(newTable);
// ----------------------------------------------------------
// How many times did a player fill a bucket?
newTable = new SQLiteTable(PlayerStat.BUCKETS_EMPTIED.getTableName());
id = new Column("id", true, SQLDataType.INT, true);
uuid = new Column("uuid", false, SQLDataType.TEXT, true);
world = new Column("world", false, SQLDataType.TEXT, true);
newTable.addColumn(id);
// UUID of the player
newTable.addColumn(uuid);
newTable.addColumn("value", false, SQLDataType.INT, true);
newTable.addColumn(world);
newTable.addUniqueMatched(uuid);
newTable.addUniqueMatched(world);
this.addTable(newTable);
// ----------------------------------------------------------
// How many items did a player drop?
newTable = new SQLiteTable(PlayerStat.ITEMS_DROPPED.getTableName());
id = new Column("id", true, SQLDataType.INT, true);
uuid = new Column("uuid", false, SQLDataType.TEXT, true);
world = new Column("world", false, SQLDataType.TEXT, true);
typeID = new Column("item", false, SQLDataType.TEXT, true);
newTable.addColumn(id);
// UUID of the player
newTable.addColumn(uuid);
newTable.addColumn("value", false, SQLDataType.INT, true);
newTable.addColumn(world);
newTable.addColumn(typeID);
newTable.addUniqueMatched(uuid);
newTable.addUniqueMatched(world);
newTable.addUniqueMatched(typeID);
this.addTable(newTable);
// ----------------------------------------------------------
// How many items did a player pick up?
newTable = new SQLiteTable(PlayerStat.ITEMS_PICKED_UP.getTableName());
id = new Column("id", true, SQLDataType.INT, true);
uuid = new Column("uuid", false, SQLDataType.TEXT, true);
world = new Column("world", false, SQLDataType.TEXT, true);
typeID = new Column("item", false, SQLDataType.TEXT, true);
newTable.addColumn(id);
// UUID of the player
newTable.addColumn(uuid);
newTable.addColumn("value", false, SQLDataType.INT, true);
newTable.addColumn(world);
newTable.addColumn(typeID);
newTable.addUniqueMatched(uuid);
newTable.addUniqueMatched(world);
newTable.addUniqueMatched(typeID);
this.addTable(newTable);
// ----------------------------------------------------------
// How many times did a player teleport?
newTable = new SQLiteTable(PlayerStat.TELEPORTS.getTableName());
id = new Column("id", true, SQLDataType.INT, true);
uuid = new Column("uuid", false, SQLDataType.TEXT, true);
world = new Column("world", false, SQLDataType.TEXT, true);
newTable.addColumn(id);
// UUID of the player
newTable.addColumn(uuid);
newTable.addColumn("value", false, SQLDataType.INT, true);
newTable.addColumn(world);
newTable.addColumn("destWorld", false, SQLDataType.TEXT, true);
newTable.addColumn("cause", false, SQLDataType.TEXT, true);
newTable.addUniqueMatched(uuid);
newTable.addUniqueMatched(world);
newTable.addUniqueMatched("destWorld");
newTable.addUniqueMatched("cause");
this.addTable(newTable);
// ----------------------------------------------------------
// How many times did a player trade with villagers?
newTable = new SQLiteTable(PlayerStat.VILLAGER_TRADES.getTableName());
id = new Column("id", true, SQLDataType.INT, true);
uuid = new Column("uuid", false, SQLDataType.TEXT, true);
world = new Column("world", false, SQLDataType.TEXT, true);
newTable.addColumn(id);
// UUID of the player
newTable.addColumn(uuid);
newTable.addColumn("value", false, SQLDataType.INT, true);
newTable.addColumn(world);
newTable.addColumn("trade", false, SQLDataType.TEXT, true);
newTable.addUniqueMatched(uuid);
newTable.addUniqueMatched(world);
newTable.addUniqueMatched("trade");
this.addTable(newTable);
}
Aggregations