From 99bd4fed06efebfd33618878397390f0b767dac4 Mon Sep 17 00:00:00 2001 From: Rsl1122 Date: Sat, 7 Oct 2017 20:21:50 +0300 Subject: [PATCH] Fixes #336 --- .../com/djrapitops/plan/database/tables/UserInfoTable.java | 7 +++++++ .../plan/systems/processing/player/RegisterProcessor.java | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Plan/src/main/java/com/djrapitops/plan/database/tables/UserInfoTable.java b/Plan/src/main/java/com/djrapitops/plan/database/tables/UserInfoTable.java index 9ff3bedcb..74589c122 100644 --- a/Plan/src/main/java/com/djrapitops/plan/database/tables/UserInfoTable.java +++ b/Plan/src/main/java/com/djrapitops/plan/database/tables/UserInfoTable.java @@ -16,6 +16,7 @@ import main.java.com.djrapitops.plan.database.sql.Select; import main.java.com.djrapitops.plan.database.sql.Sql; import main.java.com.djrapitops.plan.database.sql.TableSqlParser; import main.java.com.djrapitops.plan.database.sql.Update; +import main.java.com.djrapitops.plan.utilities.MiscUtils; import java.sql.PreparedStatement; import java.sql.ResultSet; @@ -81,14 +82,20 @@ public class UserInfoTable extends UserIDTable { } public boolean isRegistered(UUID uuid) throws SQLException { + return isRegistered(uuid, MiscUtils.getIPlan().getServerUuid()); + } + + public boolean isRegistered(UUID uuid, UUID serverUUID) throws SQLException { String sql = Select.from(tableName, "COUNT(" + columnUserID + ") as c") .where(columnUserID + "=" + usersTable.statementSelectID) + .where(columnServerID + "=" + serverTable.statementSelectServerID) .toString(); return query(new QueryStatement(sql) { @Override public void prepare(PreparedStatement statement) throws SQLException { statement.setString(1, uuid.toString()); + statement.setString(2, serverUUID.toString()); } @Override diff --git a/Plan/src/main/java/com/djrapitops/plan/systems/processing/player/RegisterProcessor.java b/Plan/src/main/java/com/djrapitops/plan/systems/processing/player/RegisterProcessor.java index 071d23fb4..f09f9dba3 100644 --- a/Plan/src/main/java/com/djrapitops/plan/systems/processing/player/RegisterProcessor.java +++ b/Plan/src/main/java/com/djrapitops/plan/systems/processing/player/RegisterProcessor.java @@ -53,7 +53,9 @@ public class RegisterProcessor extends PlayerProcessor { return; } plugin.getDataCache().markFirstSession(uuid); - userInfoTable.registerUserInfo(uuid, registered); + if (userInfoTable.isRegistered(uuid)) { + userInfoTable.registerUserInfo(uuid, registered); + } db.getActionsTable().insertAction(uuid, new Action(time, Actions.FIRST_SESSION, "Online: " + playersOnline + " Players")); } catch (SQLException e) { Log.toLog(this.getClass().getName(), e);