Changed all timestamp values utilized by the API to long types

This commit is contained in:
Intelli 2021-07-26 18:00:21 -06:00
parent 3c82dc337a
commit 40b52fa321
13 changed files with 53 additions and 51 deletions

View file

@ -306,20 +306,20 @@ public class Queue {
queueStandardData(consumerId, currentConsumer, new String[] { user, null }, block);
}
protected static void queuePlayerChat(Player player, String message, int time) {
protected static void queuePlayerChat(Player player, String message, long timestamp) {
int currentConsumer = Consumer.currentConsumer;
int consumerId = Consumer.newConsumerId(currentConsumer);
addConsumer(currentConsumer, new Object[] { consumerId, Process.PLAYER_CHAT, null, 0, null, 0, time, null });
addConsumer(currentConsumer, new Object[] { consumerId, Process.PLAYER_CHAT, null, 0, null, 0, 0, null });
Consumer.consumerStrings.get(currentConsumer).put(consumerId, message);
queueStandardData(consumerId, currentConsumer, new String[] { player.getName(), null }, player.getLocation().clone());
queueStandardData(consumerId, currentConsumer, new String[] { player.getName(), null }, new Object[] { timestamp, player.getLocation().clone() });
}
protected static void queuePlayerCommand(Player player, String message, int time) {
protected static void queuePlayerCommand(Player player, String message, long timestamp) {
int currentConsumer = Consumer.currentConsumer;
int consumerId = Consumer.newConsumerId(currentConsumer);
addConsumer(currentConsumer, new Object[] { consumerId, Process.PLAYER_COMMAND, null, 0, null, 0, time, null });
addConsumer(currentConsumer, new Object[] { consumerId, Process.PLAYER_COMMAND, null, 0, null, 0, 0, null });
Consumer.consumerStrings.get(currentConsumer).put(consumerId, message);
queueStandardData(consumerId, currentConsumer, new String[] { player.getName(), null }, player.getLocation().clone());
queueStandardData(consumerId, currentConsumer, new String[] { player.getName(), null }, new Object[] { timestamp, player.getLocation().clone() });
}
protected static void queuePlayerInteraction(String user, BlockState block) {

View file

@ -10,13 +10,14 @@ import net.coreprotect.database.logger.ChatLogger;
class PlayerChatProcess {
static void process(PreparedStatement preparedStmt, int batchCount, int processId, int id, Object object, int time, String user) {
if (object instanceof Location) {
static void process(PreparedStatement preparedStmt, int batchCount, int processId, int id, Object[] object, String user) {
if (object.length == 2 && object[1] instanceof Location) {
Map<Integer, String> strings = Consumer.consumerStrings.get(processId);
if (strings.get(id) != null) {
String message = strings.get(id);
Location location = (Location) object;
ChatLogger.log(preparedStmt, batchCount, time, location, user, message);
Long timestamp = (Long) object[0];
Location location = (Location) object[1];
ChatLogger.log(preparedStmt, batchCount, timestamp, location, user, message);
strings.remove(id);
}
}

View file

@ -10,13 +10,14 @@ import net.coreprotect.database.logger.CommandLogger;
class PlayerCommandProcess {
static void process(PreparedStatement preparedStmt, int batchCount, int processId, int id, Object object, int time, String user) {
if (object instanceof Location) {
static void process(PreparedStatement preparedStmt, int batchCount, int processId, int id, Object[] object, String user) {
if (object.length == 2 && object[1] instanceof Location) {
Map<Integer, String> strings = Consumer.consumerStrings.get(processId);
if (strings.get(id) != null) {
String message = strings.get(id);
Location location = (Location) object;
CommandLogger.log(preparedStmt, batchCount, time, location, user, message);
Long timestamp = (Long) object[0];
Location location = (Location) object[1];
CommandLogger.log(preparedStmt, batchCount, timestamp, location, user, message);
strings.remove(id);
}
}

View file

@ -141,13 +141,13 @@ public class Process {
for (int i = 0; i < consumerDataSize; i++) {
Object[] data = consumerData.get(i);
if (data != null) {
int id = (Integer) data[0];
int action = (Integer) data[1];
int id = (int) data[0];
int action = (int) data[1];
Material blockType = (Material) data[2];
int blockData = (Integer) data[3];
Material replace_type = (Material) data[4];
int replaceData = (Integer) data[5];
int forceData = (Integer) data[6];
int blockData = (int) data[3];
Material replaceType = (Material) data[4];
int replaceData = (int) data[5];
int forceData = (int) data[6];
if (users.get(id) != null && consumerObject.get(id) != null) {
String user = users.get(id)[0];
@ -156,10 +156,10 @@ public class Process {
try {
switch (action) {
case Process.BLOCK_BREAK:
BlockBreakProcess.process(preparedStmtBlocks, preparedStmtSkulls, i, processId, id, blockType, blockData, replace_type, forceData, user, object, (String) data[7]);
BlockBreakProcess.process(preparedStmtBlocks, preparedStmtSkulls, i, processId, id, blockType, blockData, replaceType, forceData, user, object, (String) data[7]);
break;
case Process.BLOCK_PLACE:
BlockPlaceProcess.process(preparedStmtBlocks, preparedStmtSkulls, i, blockType, blockData, replace_type, replaceData, forceData, user, object, (String) data[7], (String) data[8]);
BlockPlaceProcess.process(preparedStmtBlocks, preparedStmtSkulls, i, blockType, blockData, replaceType, replaceData, forceData, user, object, (String) data[7], (String) data[8]);
break;
case Process.SIGN_TEXT:
SignTextProcess.process(preparedStmtSigns, i, processId, id, forceData, user, object, replaceData, blockData);
@ -195,10 +195,10 @@ public class Process {
SkullUpdateProcess.process(statement, object, forceData);
break;
case Process.PLAYER_CHAT:
PlayerChatProcess.process(preparedStmtChat, i, processId, id, object, forceData, user);
PlayerChatProcess.process(preparedStmtChat, i, processId, id, (Object[]) object, user);
break;
case Process.PLAYER_COMMAND:
PlayerCommandProcess.process(preparedStmtCommand, i, processId, id, object, forceData, user);
PlayerCommandProcess.process(preparedStmtCommand, i, processId, id, (Object[]) object, user);
break;
case Process.PLAYER_LOGIN:
PlayerLoginProcess.process(connection, preparedStmtSession, i, processId, id, object, blockData, replaceData, forceData, user);