Handle null report closers.

This commit is contained in:
Keir 2015-10-27 22:08:42 +00:00
parent bc3a119a22
commit 53f2356cba
2 changed files with 3 additions and 4 deletions

View File

@ -74,7 +74,7 @@ public class ReportManager {
reportRepository.removeElement(String.valueOf(reportId)); // Remove report from redis database reportRepository.removeElement(String.valueOf(reportId)); // Remove report from redis database
removeActiveReport(reportId); removeActiveReport(reportId);
int closerId = getPlayerAccount(reportCloser).getAccountId(); int closerId = reportCloser != null ? getPlayerAccount(reportCloser).getAccountId() : -1;
String playerName = getReport(reportId).getPlayerName(); String playerName = getReport(reportId).getPlayerName();
int playerId = getPlayerAccount(playerName).getAccountId(); int playerId = getPlayerAccount(playerName).getAccountId();
String server = null; // TODO: Get current server name String server = null; // TODO: Get current server name
@ -155,8 +155,6 @@ public class ReportManager {
{ {
int reportId = getActiveReport(player.getName()); int reportId = getActiveReport(player.getName());
this.closeReport(reportId, null, "Player Quit", ReportResult.UNDETERMINED); this.closeReport(reportId, null, "Player Quit", ReportResult.UNDETERMINED);
// TODO: Handle 'null' report closer in closeReport metohd for NPEs.
sendReportNotification(String.format("[Report %d] %s has left the game.", reportId, player.getName())); sendReportNotification(String.format("[Report %d] %s has left the game.", reportId, player.getName()));
} }
} }

View File

@ -31,6 +31,7 @@ id, date, reportId, accountId of Staff
This will be used to determine if staff are handling This will be used to determine if staff are handling
*/ */
// todo include category
private static String CREATE_TICKET_TABLE = "CREATE TABLE IF NOT EXISTS reportTickets (reportId INT NOT NULL, date LONG, eventDate LONG, playerId INT NOT NULL, server VARCHAR(50), closerId INT NOT NULL, result VARCHAR(25), reason VARCHAR(100), PRIMARY KEY (reportId), INDEX playerIdIndex (playerId), INDEX closerIdIndex (closerId));"; private static String CREATE_TICKET_TABLE = "CREATE TABLE IF NOT EXISTS reportTickets (reportId INT NOT NULL, date LONG, eventDate LONG, playerId INT NOT NULL, server VARCHAR(50), closerId INT NOT NULL, result VARCHAR(25), reason VARCHAR(100), PRIMARY KEY (reportId), INDEX playerIdIndex (playerId), INDEX closerIdIndex (closerId));";
private static String CREATE_HANDLER_TABLE = "CREATE TABLE IF NOT EXISTS reportHandlers (id INT NOT NULL AUTO_INCREMENT, reportId INT NOT NULL, eventDate LONG, handlerId INT NOT NULL, PRIMARY KEY (id), INDEX handlerIdIndex (handlerId) );"; private static String CREATE_HANDLER_TABLE = "CREATE TABLE IF NOT EXISTS reportHandlers (id INT NOT NULL AUTO_INCREMENT, reportId INT NOT NULL, eventDate LONG, handlerId INT NOT NULL, PRIMARY KEY (id), INDEX handlerIdIndex (handlerId) );";
private static String CREATE_REPORTERS_TABLE = "CREATE TABLE IF NOT EXISTS reportSenders (id INT NOT NULL AUTO_INCREMENT, reportId INT NOT NULL, eventDate LONG, reporterId INT NOT NULL, reason VARCHAR(100), PRIMARY KEY (id), INDEX reporterIdIndex (reporterId));"; private static String CREATE_REPORTERS_TABLE = "CREATE TABLE IF NOT EXISTS reportSenders (id INT NOT NULL AUTO_INCREMENT, reportId INT NOT NULL, eventDate LONG, reporterId INT NOT NULL, reason VARCHAR(100), PRIMARY KEY (id), INDEX reporterIdIndex (reporterId));";