diff --git a/src/main/java/com/iridium/iridiumskyblock/managers/DatabaseManager.java b/src/main/java/com/iridium/iridiumskyblock/managers/DatabaseManager.java index 6834aa312..c29ef7ee9 100644 --- a/src/main/java/com/iridium/iridiumskyblock/managers/DatabaseManager.java +++ b/src/main/java/com/iridium/iridiumskyblock/managers/DatabaseManager.java @@ -19,6 +19,8 @@ import java.io.File; import java.sql.SQLException; +import java.util.Comparator; +import java.util.List; import java.util.concurrent.CompletableFuture; @Getter @@ -50,6 +52,11 @@ public void init() throws SQLException { String databaseURL = getDatabaseURL(sqlConfig); DataPersisterManager.registerDataPersisters(XMaterialType.getSingleton()); + DataPersisterManager.registerDataPersisters(XEntityTypeType.getSingleton()); + DataPersisterManager.registerDataPersisters(XPotionType.getSingleton()); + DataPersisterManager.registerDataPersisters(XEnchantmentType.getSingleton()); + DataPersisterManager.registerDataPersisters(XBiomeType.getSingleton()); + DataPersisterManager.registerDataPersisters(LocationType.getSingleton()); DataPersisterManager.registerDataPersisters(InventoryType.getSingleton()); DataPersisterManager.registerDataPersisters(LocalDateTimeType.getSingleton()); @@ -77,6 +84,14 @@ public void init() throws SQLException { this.teamMissionTableManager = new ForeignIslandTableManager<>(teamMission -> getDatabaseKey(teamMission.getTeamID(), teamMission.getMissionName()), connectionSource, TeamMission.class); this.teamRewardsTableManager = new ForeignIslandTableManager<>(teamRewards -> getDatabaseKey(teamRewards.getId()), connectionSource, TeamReward.class); this.teamSettingsTableManager = new ForeignIslandTableManager<>(teamSetting -> getDatabaseKey(teamSetting.getTeamID(), teamSetting.getSetting()), connectionSource, TeamSetting.class); + + // We need to clear out null values + for(TeamBlock teamBlock : teamBlockTableManager.getEntries()) { + if(teamBlock.getXMaterial() == null) teamBlockTableManager.delete(teamBlock); + } + for(TeamSpawners teamSpawners : teamSpawnerTableManager.getEntries()) { + if(teamSpawners.getEntityType() == null) teamSpawnerTableManager.delete(teamSpawners); + } } private String getDatabaseKey(Object... params) {