Search in sources :

Example 1 with UserTableManager

use of com.iridium.iridiumskyblock.managers.tablemanagers.UserTableManager in project IridiumSkyblock by Iridium-Development.

the class DatabaseManager method init.

public void init() throws SQLException {
    LoggerFactory.setLogBackendFactory(new NullLogBackend.NullLogBackendFactory());
    SQL sqlConfig = IridiumSkyblock.getInstance().getSql();
    String databaseURL = getDatabaseURL(sqlConfig);
    DataPersisterManager.registerDataPersisters(XMaterialType.getSingleton());
    if (!IridiumSkyblock.getInstance().isTesting()) {
        this.connectionSource = new JdbcConnectionSource(databaseURL, sqlConfig.username, sqlConfig.password, DatabaseTypeUtils.createDatabaseType(databaseURL));
        if (connectionSource.getReadWriteConnection(null).isTableExists("islands")) {
            convertDatabaseData(sqlConfig.driver);
        }
    }
    this.islandTableManager = new IslandTableManager(connectionSource);
    this.userTableManager = new UserTableManager(connectionSource);
    this.islandInviteTableManager = new ForeignIslandTableManager<>(connectionSource, IslandInvite.class, Comparator.comparing(IslandInvite::getIslandId).thenComparing(islandInvite -> islandInvite.getUser().getUuid()));
    this.islandPermissionTableManager = new ForeignIslandTableManager<>(connectionSource, IslandPermission.class, Comparator.comparing(IslandPermission::getIslandId).thenComparing(IslandPermission::getRank).thenComparing(IslandPermission::getPermission));
    this.islandBlocksTableManager = new ForeignIslandTableManager<>(connectionSource, IslandBlocks.class, Comparator.comparing(IslandBlocks::getIslandId).thenComparing(IslandBlocks::getMaterial));
    this.islandSpawnersTableManager = new ForeignIslandTableManager<>(connectionSource, IslandSpawners.class, Comparator.comparing(IslandSpawners::getIslandId).thenComparing(IslandSpawners::getSpawnerType));
    this.islandBankTableManager = new ForeignIslandTableManager<>(connectionSource, IslandBank.class, Comparator.comparing(IslandBank::getIslandId).thenComparing(IslandBank::getBankItem));
    this.islandMissionTableManager = new ForeignIslandTableManager<>(connectionSource, IslandMission.class, Comparator.comparing(IslandMission::getIslandId).thenComparing(IslandMission::getMissionName).thenComparing(IslandMission::getMissionIndex));
    this.islandRewardTableManager = new ForeignIslandTableManager<>(connectionSource, IslandReward.class, Comparator.comparing(IslandReward::getIslandId));
    this.islandUpgradeTableManager = new ForeignIslandTableManager<>(connectionSource, IslandUpgrade.class, Comparator.comparing(IslandUpgrade::getIslandId).thenComparing(IslandUpgrade::getUpgrade));
    this.islandTrustedTableManager = new ForeignIslandTableManager<>(connectionSource, IslandTrusted.class, Comparator.comparing(IslandTrusted::getIslandId).thenComparing(islandTrusted -> islandTrusted.getUser().getUuid()));
    this.islandBoosterTableManager = new ForeignIslandTableManager<>(connectionSource, IslandBooster.class, Comparator.comparing(IslandBooster::getIslandId).thenComparing(IslandBooster::getBooster));
    this.islandWarpTableManager = new ForeignIslandTableManager<>(connectionSource, IslandWarp.class, Comparator.comparing(IslandWarp::getIslandId));
    this.islandLogTableManager = new ForeignIslandTableManager<>(connectionSource, IslandLog.class, Comparator.comparing(IslandLog::getIslandId));
    this.islandBanTableManager = new ForeignIslandTableManager<>(connectionSource, IslandBan.class, Comparator.comparing(IslandBan::getIslandId).thenComparing(islandBan -> islandBan.getBannedUser().getUuid()));
    this.islandSettingTableManager = new ForeignIslandTableManager<>(connectionSource, IslandSetting.class, Comparator.comparing(IslandSetting::getIslandId).thenComparing(IslandSetting::getSetting));
}
Also used : ForeignIslandTableManager(com.iridium.iridiumskyblock.managers.tablemanagers.ForeignIslandTableManager) IslandTableManager(com.iridium.iridiumskyblock.managers.tablemanagers.IslandTableManager) NullLogBackend(com.j256.ormlite.logger.NullLogBackend) SQL(com.iridium.iridiumskyblock.configs.SQL) UserTableManager(com.iridium.iridiumskyblock.managers.tablemanagers.UserTableManager) JdbcConnectionSource(com.j256.ormlite.jdbc.JdbcConnectionSource)

Aggregations

SQL (com.iridium.iridiumskyblock.configs.SQL)1 ForeignIslandTableManager (com.iridium.iridiumskyblock.managers.tablemanagers.ForeignIslandTableManager)1 IslandTableManager (com.iridium.iridiumskyblock.managers.tablemanagers.IslandTableManager)1 UserTableManager (com.iridium.iridiumskyblock.managers.tablemanagers.UserTableManager)1 JdbcConnectionSource (com.j256.ormlite.jdbc.JdbcConnectionSource)1 NullLogBackend (com.j256.ormlite.logger.NullLogBackend)1