mirror of
https://github.com/PlayPro/CoreProtect.git
synced 2024-12-27 17:37:34 +01:00
Fixed ClassCastException when logging chat and command messages
This commit is contained in:
parent
a61df070e6
commit
69184302c9
@ -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<Integer, String> 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);
|
||||
}
|
||||
|
@ -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<Integer, String> 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);
|
||||
}
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user