mirror of
https://github.com/PlayPro/CoreProtect.git
synced 2024-11-28 12:55: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 {
|
class PlayerChatProcess {
|
||||||
|
|
||||||
static void process(PreparedStatement preparedStmt, int batchCount, int processId, int id, Object[] object, String user) {
|
static void process(PreparedStatement preparedStmt, int batchCount, int processId, int id, Object object, String user) {
|
||||||
if (object[1] instanceof Location) {
|
if (!(object instanceof Object[])) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Object[] data = (Object[]) object;
|
||||||
|
if (data[1] instanceof Location) {
|
||||||
Map<Integer, String> strings = Consumer.consumerStrings.get(processId);
|
Map<Integer, String> strings = Consumer.consumerStrings.get(processId);
|
||||||
if (strings.get(id) != null) {
|
if (strings.get(id) != null) {
|
||||||
String message = strings.get(id);
|
String message = strings.get(id);
|
||||||
Long timestamp = (Long) object[0];
|
Long timestamp = (Long) data[0];
|
||||||
Location location = (Location) object[1];
|
Location location = (Location) data[1];
|
||||||
ChatLogger.log(preparedStmt, batchCount, timestamp, location, user, message);
|
ChatLogger.log(preparedStmt, batchCount, timestamp, location, user, message);
|
||||||
strings.remove(id);
|
strings.remove(id);
|
||||||
}
|
}
|
||||||
|
@ -10,13 +10,18 @@ import net.coreprotect.database.logger.CommandLogger;
|
|||||||
|
|
||||||
class PlayerCommandProcess {
|
class PlayerCommandProcess {
|
||||||
|
|
||||||
static void process(PreparedStatement preparedStmt, int batchCount, int processId, int id, Object[] object, String user) {
|
static void process(PreparedStatement preparedStmt, int batchCount, int processId, int id, Object object, String user) {
|
||||||
if (object[1] instanceof Location) {
|
if (!(object instanceof Object[])) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Object[] data = (Object[]) object;
|
||||||
|
if (data[1] instanceof Location) {
|
||||||
Map<Integer, String> strings = Consumer.consumerStrings.get(processId);
|
Map<Integer, String> strings = Consumer.consumerStrings.get(processId);
|
||||||
if (strings.get(id) != null) {
|
if (strings.get(id) != null) {
|
||||||
String message = strings.get(id);
|
String message = strings.get(id);
|
||||||
Long timestamp = (Long) object[0];
|
Long timestamp = (Long) data[0];
|
||||||
Location location = (Location) object[1];
|
Location location = (Location) data[1];
|
||||||
CommandLogger.log(preparedStmt, batchCount, timestamp, location, user, message);
|
CommandLogger.log(preparedStmt, batchCount, timestamp, location, user, message);
|
||||||
strings.remove(id);
|
strings.remove(id);
|
||||||
}
|
}
|
||||||
|
@ -195,10 +195,10 @@ public class Process {
|
|||||||
SkullUpdateProcess.process(statement, object, forceData);
|
SkullUpdateProcess.process(statement, object, forceData);
|
||||||
break;
|
break;
|
||||||
case Process.PLAYER_CHAT:
|
case Process.PLAYER_CHAT:
|
||||||
PlayerChatProcess.process(preparedStmtChat, i, processId, id, (Object[]) object, user);
|
PlayerChatProcess.process(preparedStmtChat, i, processId, id, object, user);
|
||||||
break;
|
break;
|
||||||
case Process.PLAYER_COMMAND:
|
case Process.PLAYER_COMMAND:
|
||||||
PlayerCommandProcess.process(preparedStmtCommand, i, processId, id, (Object[]) object, user);
|
PlayerCommandProcess.process(preparedStmtCommand, i, processId, id, object, user);
|
||||||
break;
|
break;
|
||||||
case Process.PLAYER_LOGIN:
|
case Process.PLAYER_LOGIN:
|
||||||
PlayerLoginProcess.process(connection, preparedStmtSession, i, processId, id, object, blockData, replaceData, forceData, user);
|
PlayerLoginProcess.process(connection, preparedStmtSession, i, processId, id, object, blockData, replaceData, forceData, user);
|
||||||
|
Loading…
Reference in New Issue
Block a user