diff --git a/src/main/java/net/coreprotect/consumer/process/PlayerChatProcess.java b/src/main/java/net/coreprotect/consumer/process/PlayerChatProcess.java index f4b8629..369edee 100644 --- a/src/main/java/net/coreprotect/consumer/process/PlayerChatProcess.java +++ b/src/main/java/net/coreprotect/consumer/process/PlayerChatProcess.java @@ -10,13 +10,18 @@ import net.coreprotect.database.logger.ChatLogger; class PlayerChatProcess { - static void process(PreparedStatement preparedStmt, int batchCount, int processId, int id, Object[] object, String user) { - if (object[1] instanceof Location) { + static void process(PreparedStatement preparedStmt, int batchCount, int processId, int id, Object object, String user) { + if (!(object instanceof Object[])) { + return; + } + + Object[] data = (Object[]) object; + if (data[1] instanceof Location) { Map strings = Consumer.consumerStrings.get(processId); if (strings.get(id) != null) { String message = strings.get(id); - Long timestamp = (Long) object[0]; - Location location = (Location) object[1]; + Long timestamp = (Long) data[0]; + Location location = (Location) data[1]; ChatLogger.log(preparedStmt, batchCount, timestamp, location, user, message); strings.remove(id); } diff --git a/src/main/java/net/coreprotect/consumer/process/PlayerCommandProcess.java b/src/main/java/net/coreprotect/consumer/process/PlayerCommandProcess.java index 69b1a1b..863777f 100644 --- a/src/main/java/net/coreprotect/consumer/process/PlayerCommandProcess.java +++ b/src/main/java/net/coreprotect/consumer/process/PlayerCommandProcess.java @@ -10,13 +10,18 @@ import net.coreprotect.database.logger.CommandLogger; class PlayerCommandProcess { - static void process(PreparedStatement preparedStmt, int batchCount, int processId, int id, Object[] object, String user) { - if (object[1] instanceof Location) { + static void process(PreparedStatement preparedStmt, int batchCount, int processId, int id, Object object, String user) { + if (!(object instanceof Object[])) { + return; + } + + Object[] data = (Object[]) object; + if (data[1] instanceof Location) { Map strings = Consumer.consumerStrings.get(processId); if (strings.get(id) != null) { String message = strings.get(id); - Long timestamp = (Long) object[0]; - Location location = (Location) object[1]; + Long timestamp = (Long) data[0]; + Location location = (Location) data[1]; CommandLogger.log(preparedStmt, batchCount, timestamp, location, user, message); strings.remove(id); } diff --git a/src/main/java/net/coreprotect/consumer/process/Process.java b/src/main/java/net/coreprotect/consumer/process/Process.java index 17457ce..42ccefb 100755 --- a/src/main/java/net/coreprotect/consumer/process/Process.java +++ b/src/main/java/net/coreprotect/consumer/process/Process.java @@ -195,10 +195,10 @@ public class Process { SkullUpdateProcess.process(statement, object, forceData); break; case Process.PLAYER_CHAT: - PlayerChatProcess.process(preparedStmtChat, i, processId, id, (Object[]) object, user); + PlayerChatProcess.process(preparedStmtChat, i, processId, id, object, user); break; case Process.PLAYER_COMMAND: - PlayerCommandProcess.process(preparedStmtCommand, i, processId, id, (Object[]) object, user); + PlayerCommandProcess.process(preparedStmtCommand, i, processId, id, object, user); break; case Process.PLAYER_LOGIN: PlayerLoginProcess.process(connection, preparedStmtSession, i, processId, id, object, blockData, replaceData, forceData, user);