Fixed UserInfoTable being cleared on V8->10 transfer

This commit is contained in:
Rsl1122 2017-09-21 13:34:02 +03:00
parent d7e26f03bc
commit 63f8482c4b
4 changed files with 18 additions and 6 deletions

View File

@ -299,7 +299,8 @@ public class SessionsTable extends UserIDTable {
columnServerID +
" FROM " + tableName +
" WHERE " + columnSessionStart + ">?" +
" AND " + columnUserID + "=" + usersTable.statementSelectID);
" AND " + columnUserID + "=" + usersTable.statementSelectID +
" GROUP BY " + columnServerID);
statement.setLong(1, afterDate);
statement.setString(2, uuid.toString());
set = statement.executeQuery();

View File

@ -54,6 +54,7 @@ public class Version8TransferTable extends Table {
copyTPS();
execute(dropTableSql("plan_user_info"));
copyUsers();
execute(dropTableSql("plan_ips"));
@ -62,10 +63,10 @@ public class Version8TransferTable extends Table {
execute(dropTableSql("plan_worlds"));
db.getWorldTable().createTable();
db.getWorldTimesTable().createTable();
execute(dropTableSql("plan_user_info"));
execute(dropTableSql("plan_actions"));
db.getActionsTable().createTable();
db.getUserInfoTable().createTable();
execute(dropTableSql("plan_gamemodetimes"));
execute(dropTableSql("temp_nicks"));
execute(dropTableSql("temp_kills"));

View File

@ -63,8 +63,13 @@ public class InspectPageParser extends PageParser {
addValue("version", MiscUtils.getPlanVersion());
addValue("timeZone", MiscUtils.getTimeZoneOffsetHours());
addValue("playerName", userInfo.getName());
addValue("registered", FormatUtils.formatTimeStampYear(userInfo.getRegistered()));
if (userInfo != null) {
addValue("playerName", userInfo.getName());
addValue("registered", FormatUtils.formatTimeStampYear(userInfo.getRegistered()));
} else {
addValue("playerName", "Error occurred.");
addValue("registered", "Error occurred.");
}
long lastSeen = sessionsTable.getLastSeen(uuid);
if (lastSeen != 0) {
addValue("lastSeen", FormatUtils.formatTimeStampYear(lastSeen));
@ -171,6 +176,7 @@ public class InspectPageParser extends PageParser {
return HtmlUtils.replacePlaceholders(FileUtil.getStringFromResource("player.html"), placeHolders);
} catch (Exception e) {
Log.toLog(this.getClass().getName(), e);
throw new ParseException(e);
}
}

View File

@ -166,7 +166,11 @@ public abstract class WebAPI {
}
protected Response fail(String reason) {
return PageCache.loadPage("fail", () -> new NotFoundResponse(reason));
return PageCache.loadPage("fail", () -> {
NotFoundResponse notFoundResponse = new NotFoundResponse("");
notFoundResponse.setContent(reason);
return notFoundResponse;
});
}
protected Response badRequest(String error) {