diff --git a/src/main/java/net/hypr/doki/listeners/LevellingListener.java b/src/main/java/net/hypr/doki/listeners/LevellingListener.java index 2568523..330cb46 100644 --- a/src/main/java/net/hypr/doki/listeners/LevellingListener.java +++ b/src/main/java/net/hypr/doki/listeners/LevellingListener.java @@ -64,7 +64,8 @@ public class LevellingListener extends ListenerAdapter { } else { log.info("No record of user ID {} in server {}, creating blank record", user.getId(), guild.getId()); try { - DBUtils.createUserRecord(user.getIdLong(), guild.getIdLong(), user.getName()); + UserRecord rec = DBUtils.createUserRecord(user.getIdLong(), guild.getIdLong(), user.getName()); + LevellingUtils.incrementXp(log, rec); } catch (SQLException e) { throw new RuntimeException(e); } diff --git a/src/main/java/net/hypr/doki/utils/DBUtils.java b/src/main/java/net/hypr/doki/utils/DBUtils.java index 7825b2a..48f04fc 100644 --- a/src/main/java/net/hypr/doki/utils/DBUtils.java +++ b/src/main/java/net/hypr/doki/utils/DBUtils.java @@ -53,7 +53,7 @@ public class DBUtils { * @param username The users username * @throws SQLException A SQL exception */ - public static void createUserRecord(long user_id, long server_id, String username) throws SQLException { + public static UserRecord createUserRecord(long user_id, long server_id, String username) throws SQLException { Logger log = Logging.getLogger(); log.info("Creating record (usr:{},srv:{},unm:{})", user_id, server_id, username); BasicDataSource dataSource = Doki.getDataSource(); @@ -67,6 +67,7 @@ public class DBUtils { stmt.setTimestamp(4, Timestamp.valueOf(LocalDateTime.now())); stmt.execute(); log.info("Record (usr:{},srv:{},unm:{}) created!", user_id, server_id, username); + return new UserRecord(user_id, server_id, username); } /**