diff --git a/Plugins/Mineplex.Core/src/mineplex/core/customdata/repository/CustomDataRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/customdata/repository/CustomDataRepository.java index 51866e26f..328aa6e6f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/customdata/repository/CustomDataRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/customdata/repository/CustomDataRepository.java @@ -73,30 +73,20 @@ public class CustomDataRepository extends RepositoryBase for (CustomData cd : data.getDataMap().keySet()) { - - executeInsert(UPDATE_DATA, new ResultSetCallable() - { - @Override - public void processResultSet(ResultSet resultSet) throws SQLException - { - - if (!resultSet.isBeforeFirst()) - { - - // Not already in the DB - executeUpdate( - INSERT_DATA, - new ColumnInt("account", accountId), - new ColumnInt("customData", cd.getId()), - new ColumnInt("data", data.getDataMap().get(cd)) - ); - } - } - }, + if (executeUpdate( + UPDATE_DATA, new ColumnInt("data", data.getDataMap().get(cd)), new ColumnInt("account", accountId), - new ColumnInt("customData", cd.getId()) - ); + new ColumnInt("customData", cd.getId())) < 1) + { + // Not already in the DB + executeUpdate( + INSERT_DATA, + new ColumnInt("account", accountId), + new ColumnInt("customData", cd.getId()), + new ColumnInt("data", data.getDataMap().get(cd)) + ); + } } }