UserInfo now registered properly

This commit is contained in:
Rsl1122 2017-08-24 17:46:52 +03:00
parent 44bae9899f
commit a67e8a989e
3 changed files with 16 additions and 2 deletions

View File

@ -1,8 +1,10 @@
package main.java.com.djrapitops.plan.systems.cache;
import main.java.com.djrapitops.plan.Log;
import main.java.com.djrapitops.plan.Plan;
import main.java.com.djrapitops.plan.database.Database;
import java.sql.SQLException;
import java.util.*;
/**
@ -52,7 +54,17 @@ public class DataCache extends SessionCache {
}
public String getDisplayName(UUID uuid) {
return displayNames.get(uuid);
String cached = displayNames.get(uuid);
if (cached == null) {
List<String> nicknames = null;
try {
nicknames = db.getNicknamesTable().getNicknames(uuid);
return nicknames.get(nicknames.size() - 1);
} catch (SQLException e) {
Log.toLog(this.getClass().getName(), e);
}
}
return cached;
}
public void addFirstLeaveCheck(UUID uuid) {

View File

@ -40,6 +40,8 @@ public class NameProcessor extends PlayerProcessor {
return;
}
Database db = plugin.getDB();
try {
db.getUsersTable().updateName(uuid, playerName);

View File

@ -41,7 +41,7 @@ public class RegisterProcessor extends PlayerProcessor {
}
plugin.getDataCache().addFirstLeaveCheck(uuid);
try {
db.getUsersTable().registerUser(uuid, time, name);
db.getUserInfoTable().registerUserInfo(uuid, time);
db.getActionsTable().insertAction(uuid, new Action(time, Actions.REGISTERED, "Online: " + playersOnline + " Players"));
} catch (SQLException e) {
Log.toLog(this.getClass().getName(), e);