forked from LogBlock/LogBlock
use long when accessing id columns
This commit is contained in:
@ -62,7 +62,7 @@ public class BlockChange implements LookupCacheElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public BlockChange(ResultSet rs, QueryParams p) throws SQLException {
|
public BlockChange(ResultSet rs, QueryParams p) throws SQLException {
|
||||||
id = p.needId ? rs.getInt("id") : 0;
|
id = p.needId ? rs.getLong("id") : 0;
|
||||||
date = p.needDate ? rs.getTimestamp("date").getTime() : 0;
|
date = p.needDate ? rs.getTimestamp("date").getTime() : 0;
|
||||||
loc = p.needCoords ? new Location(p.world, rs.getInt("x"), rs.getInt("y"), rs.getInt("z")) : null;
|
loc = p.needCoords ? new Location(p.world, rs.getInt("x"), rs.getInt("y"), rs.getInt("z")) : null;
|
||||||
actor = p.needPlayer ? new Actor(rs) : null;
|
actor = p.needPlayer ? new Actor(rs) : null;
|
||||||
|
@ -26,7 +26,7 @@ public class ChatMessage implements LookupCacheElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ChatMessage(ResultSet rs, QueryParams p) throws SQLException {
|
public ChatMessage(ResultSet rs, QueryParams p) throws SQLException {
|
||||||
id = p.needId ? rs.getInt("id") : 0;
|
id = p.needId ? rs.getLong("id") : 0;
|
||||||
date = p.needDate ? rs.getTimestamp("date").getTime() : 0;
|
date = p.needDate ? rs.getTimestamp("date").getTime() : 0;
|
||||||
player = p.needPlayer ? new Actor(rs) : null;
|
player = p.needPlayer ? new Actor(rs) : null;
|
||||||
playerName = p.needPlayer ? rs.getString("playername") : null;
|
playerName = p.needPlayer ? rs.getString("playername") : null;
|
||||||
|
@ -965,14 +965,14 @@ public class CommandsHandler implements CommandExecutor {
|
|||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
if (params.bct == BlockChangeType.CHAT) {
|
if (params.bct == BlockChangeType.CHAT) {
|
||||||
sb.append("INSERT INTO `lb-chat` (`id`, `date`, `playerid`, `message`) VALUES (");
|
sb.append("INSERT INTO `lb-chat` (`id`, `date`, `playerid`, `message`) VALUES (");
|
||||||
sb.append(rs.getInt("id")).append(", FROM_UNIXTIME(");
|
sb.append(rs.getLong("id")).append(", FROM_UNIXTIME(");
|
||||||
sb.append(rs.getTimestamp("date").getTime() / 1000).append("), ");
|
sb.append(rs.getTimestamp("date").getTime() / 1000).append("), ");
|
||||||
sb.append(rs.getInt("playerid")).append(", '");
|
sb.append(rs.getInt("playerid")).append(", '");
|
||||||
sb.append(Utils.mysqlTextEscape(rs.getString("message")));
|
sb.append(Utils.mysqlTextEscape(rs.getString("message")));
|
||||||
sb.append("');\n");
|
sb.append("');\n");
|
||||||
} else if (params.bct == BlockChangeType.KILLS) {
|
} else if (params.bct == BlockChangeType.KILLS) {
|
||||||
sb.append("INSERT INTO `").append(tableBase).append("-kills` (`id`, `date`, `killer`, `victim`, `weapon`, `x`, `y`, `z`) VALUES (");
|
sb.append("INSERT INTO `").append(tableBase).append("-kills` (`id`, `date`, `killer`, `victim`, `weapon`, `x`, `y`, `z`) VALUES (");
|
||||||
sb.append(rs.getInt("id")).append(", FROM_UNIXTIME(");
|
sb.append(rs.getLong("id")).append(", FROM_UNIXTIME(");
|
||||||
sb.append(rs.getTimestamp("date").getTime() / 1000).append("), ");
|
sb.append(rs.getTimestamp("date").getTime() / 1000).append("), ");
|
||||||
sb.append(rs.getInt("killerid")).append(", ");
|
sb.append(rs.getInt("killerid")).append(", ");
|
||||||
sb.append(rs.getInt("victimid")).append(", ");
|
sb.append(rs.getInt("victimid")).append(", ");
|
||||||
@ -985,7 +985,7 @@ public class CommandsHandler implements CommandExecutor {
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
sb.append("INSERT INTO `").append(tableBase).append("-blocks` (`id`, `date`, `playerid`, `replaced`, `replacedData`, `type`, `typeData`, `x`, `y`, `z`) VALUES (");
|
sb.append("INSERT INTO `").append(tableBase).append("-blocks` (`id`, `date`, `playerid`, `replaced`, `replacedData`, `type`, `typeData`, `x`, `y`, `z`) VALUES (");
|
||||||
sb.append(rs.getInt("id")).append(", FROM_UNIXTIME(");
|
sb.append(rs.getLong("id")).append(", FROM_UNIXTIME(");
|
||||||
sb.append(rs.getTimestamp("date").getTime() / 1000).append("), ");
|
sb.append(rs.getTimestamp("date").getTime() / 1000).append("), ");
|
||||||
sb.append(rs.getInt("playerid")).append(", ");
|
sb.append(rs.getInt("playerid")).append(", ");
|
||||||
sb.append(rs.getInt("replaced")).append(", ");
|
sb.append(rs.getInt("replaced")).append(", ");
|
||||||
@ -1000,7 +1000,7 @@ public class CommandsHandler implements CommandExecutor {
|
|||||||
byte[] typeState = rs.getBytes("typeState");
|
byte[] typeState = rs.getBytes("typeState");
|
||||||
if (replacedState != null || typeState != null) {
|
if (replacedState != null || typeState != null) {
|
||||||
sb.append("INSERT INTO `").append(tableBase).append("-state` (`id`, `replacedState`, `typeState`) VALUES (");
|
sb.append("INSERT INTO `").append(tableBase).append("-state` (`id`, `replacedState`, `typeState`) VALUES (");
|
||||||
sb.append(rs.getInt("id")).append(", ");
|
sb.append(rs.getLong("id")).append(", ");
|
||||||
sb.append(Utils.mysqlPrepareBytesForInsertAllowNull(replacedState)).append(", ");
|
sb.append(Utils.mysqlPrepareBytesForInsertAllowNull(replacedState)).append(", ");
|
||||||
sb.append(Utils.mysqlPrepareBytesForInsertAllowNull(typeState));
|
sb.append(Utils.mysqlPrepareBytesForInsertAllowNull(typeState));
|
||||||
sb.append(");\n");
|
sb.append(");\n");
|
||||||
@ -1008,7 +1008,7 @@ public class CommandsHandler implements CommandExecutor {
|
|||||||
byte[] item = rs.getBytes("item");
|
byte[] item = rs.getBytes("item");
|
||||||
if (item != null) {
|
if (item != null) {
|
||||||
sb.append("INSERT INTO `").append(tableBase).append("-chestdata` (`id`, `item`, `itemremove`, `itemtype`) VALUES (");
|
sb.append("INSERT INTO `").append(tableBase).append("-chestdata` (`id`, `item`, `itemremove`, `itemtype`) VALUES (");
|
||||||
sb.append(rs.getInt("id")).append(", ");
|
sb.append(rs.getLong("id")).append(", ");
|
||||||
sb.append(Utils.mysqlPrepareBytesForInsertAllowNull(item)).append(", ");
|
sb.append(Utils.mysqlPrepareBytesForInsertAllowNull(item)).append(", ");
|
||||||
sb.append(rs.getInt("itemremove")).append(", ");
|
sb.append(rs.getInt("itemremove")).append(", ");
|
||||||
sb.append(rs.getInt("itemtype"));
|
sb.append(rs.getInt("itemtype"));
|
||||||
|
@ -67,7 +67,7 @@ public class Consumer extends Thread {
|
|||||||
private final LogBlock logblock;
|
private final LogBlock logblock;
|
||||||
private final Map<Actor, Integer> playerIds = new HashMap<>();
|
private final Map<Actor, Integer> playerIds = new HashMap<>();
|
||||||
private final Map<Actor, Integer> uncommitedPlayerIds = new HashMap<>();
|
private final Map<Actor, Integer> uncommitedPlayerIds = new HashMap<>();
|
||||||
private final Map<World, Map<UUID, Integer>> uncommitedEntityIds = new HashMap<>();
|
private final Map<World, Map<UUID, Long>> uncommitedEntityIds = new HashMap<>();
|
||||||
|
|
||||||
private long addEntryCounter;
|
private long addEntryCounter;
|
||||||
private long nextWarnCounter;
|
private long nextWarnCounter;
|
||||||
@ -650,13 +650,13 @@ public class Consumer extends Thread {
|
|||||||
return uncommitedPlayerIds.containsKey(actor);
|
return uncommitedPlayerIds.containsKey(actor);
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getEntityUUID(Connection conn, World world, UUID uuid) throws SQLException {
|
private long getEntityUUID(Connection conn, World world, UUID uuid) throws SQLException {
|
||||||
Map<UUID, Integer> uncommitedEntityIdsHere = uncommitedEntityIds.get(world);
|
Map<UUID, Long> uncommitedEntityIdsHere = uncommitedEntityIds.get(world);
|
||||||
if (uncommitedEntityIdsHere == null) {
|
if (uncommitedEntityIdsHere == null) {
|
||||||
uncommitedEntityIdsHere = new HashMap<>();
|
uncommitedEntityIdsHere = new HashMap<>();
|
||||||
uncommitedEntityIds.put(world, uncommitedEntityIdsHere);
|
uncommitedEntityIds.put(world, uncommitedEntityIdsHere);
|
||||||
}
|
}
|
||||||
Integer existing = uncommitedEntityIdsHere.get(uuid);
|
Long existing = uncommitedEntityIdsHere.get(uuid);
|
||||||
if (existing != null) {
|
if (existing != null) {
|
||||||
return existing;
|
return existing;
|
||||||
}
|
}
|
||||||
@ -670,7 +670,7 @@ public class Consumer extends Thread {
|
|||||||
int q1Result = state.executeUpdate(q1);
|
int q1Result = state.executeUpdate(q1);
|
||||||
ResultSet rs = state.executeQuery(q2);
|
ResultSet rs = state.executeQuery(q2);
|
||||||
if (rs.next()) {
|
if (rs.next()) {
|
||||||
uncommitedEntityIdsHere.put(uuid, rs.getInt(1));
|
uncommitedEntityIdsHere.put(uuid, rs.getLong(1));
|
||||||
}
|
}
|
||||||
rs.close();
|
rs.close();
|
||||||
// if there was not any row in the table the query above does not work, so we need to try this one
|
// if there was not any row in the table the query above does not work, so we need to try this one
|
||||||
@ -678,7 +678,7 @@ public class Consumer extends Thread {
|
|||||||
state.executeUpdate("INSERT IGNORE INTO `" + table + "-entityids` (entityuuid) VALUES ('" + mysqlTextEscape(uuidString) + "')");
|
state.executeUpdate("INSERT IGNORE INTO `" + table + "-entityids` (entityuuid) VALUES ('" + mysqlTextEscape(uuidString) + "')");
|
||||||
rs = state.executeQuery(q2);
|
rs = state.executeQuery(q2);
|
||||||
if (rs.next()) {
|
if (rs.next()) {
|
||||||
uncommitedEntityIdsHere.put(uuid, rs.getInt(1));
|
uncommitedEntityIdsHere.put(uuid, rs.getLong(1));
|
||||||
} else {
|
} else {
|
||||||
logblock.getLogger().warning("[Consumer] Failed to add entity uuid " + uuidString.toString());
|
logblock.getLogger().warning("[Consumer] Failed to add entity uuid " + uuidString.toString());
|
||||||
logblock.getLogger().warning("[Consumer-Debug] World: " + world.getName());
|
logblock.getLogger().warning("[Consumer-Debug] World: " + world.getName());
|
||||||
@ -881,22 +881,22 @@ public class Consumer extends Thread {
|
|||||||
smt.setInt(8, safeY(loc));
|
smt.setInt(8, safeY(loc));
|
||||||
smt.setInt(9, loc.getBlockZ());
|
smt.setInt(9, loc.getBlockZ());
|
||||||
batchHelper.addUncommitedBlockActorId(loc, sourceActor);
|
batchHelper.addUncommitedBlockActorId(loc, sourceActor);
|
||||||
batchHelper.addBatch(smt, new IntCallback() {
|
batchHelper.addBatch(smt, new LongCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void call(int id) throws SQLException {
|
public void call(long id) throws SQLException {
|
||||||
PreparedStatement ps;
|
PreparedStatement ps;
|
||||||
if (typeState != null || replacedState != null) {
|
if (typeState != null || replacedState != null) {
|
||||||
ps = batchHelper.getOrPrepareStatement(conn, getWorldConfig(loc.getWorld()).insertBlockStateStatementString, Statement.NO_GENERATED_KEYS);
|
ps = batchHelper.getOrPrepareStatement(conn, getWorldConfig(loc.getWorld()).insertBlockStateStatementString, Statement.NO_GENERATED_KEYS);
|
||||||
ps.setBytes(1, replacedState);
|
ps.setBytes(1, replacedState);
|
||||||
ps.setBytes(2, typeState);
|
ps.setBytes(2, typeState);
|
||||||
ps.setInt(3, id);
|
ps.setLong(3, id);
|
||||||
batchHelper.addBatch(ps, null);
|
batchHelper.addBatch(ps, null);
|
||||||
}
|
}
|
||||||
if (ca != null) {
|
if (ca != null) {
|
||||||
ps = batchHelper.getOrPrepareStatement(conn, getWorldConfig(loc.getWorld()).insertBlockChestDataStatementString, Statement.NO_GENERATED_KEYS);
|
ps = batchHelper.getOrPrepareStatement(conn, getWorldConfig(loc.getWorld()).insertBlockChestDataStatementString, Statement.NO_GENERATED_KEYS);
|
||||||
ps.setBytes(1, finalSerializedItemStack);
|
ps.setBytes(1, finalSerializedItemStack);
|
||||||
ps.setInt(2, ca.remove ? 1 : 0);
|
ps.setInt(2, ca.remove ? 1 : 0);
|
||||||
ps.setInt(3, id);
|
ps.setLong(3, id);
|
||||||
ps.setInt(4, ca.itemType);
|
ps.setInt(4, ca.itemType);
|
||||||
batchHelper.addBatch(ps, null);
|
batchHelper.addBatch(ps, null);
|
||||||
}
|
}
|
||||||
@ -1108,7 +1108,7 @@ public class Consumer extends Thread {
|
|||||||
PreparedStatement smt = batchHelper.getOrPrepareStatement(conn, statementString, Statement.NO_GENERATED_KEYS);
|
PreparedStatement smt = batchHelper.getOrPrepareStatement(conn, statementString, Statement.NO_GENERATED_KEYS);
|
||||||
smt.setLong(1, date);
|
smt.setLong(1, date);
|
||||||
smt.setInt(2, sourceActor);
|
smt.setInt(2, sourceActor);
|
||||||
smt.setInt(3, getEntityUUID(conn, loc.getWorld(), entityUUID));
|
smt.setLong(3, getEntityUUID(conn, loc.getWorld(), entityUUID));
|
||||||
smt.setInt(4, EntityTypeConverter.getOrAddEntityTypeId(type));
|
smt.setInt(4, EntityTypeConverter.getOrAddEntityTypeId(type));
|
||||||
smt.setInt(5, loc.getBlockX());
|
smt.setInt(5, loc.getBlockX());
|
||||||
smt.setInt(6, safeY(loc));
|
smt.setInt(6, safeY(loc));
|
||||||
@ -1121,11 +1121,11 @@ public class Consumer extends Thread {
|
|||||||
|
|
||||||
private class EntityUUIDChange implements Row {
|
private class EntityUUIDChange implements Row {
|
||||||
private final World world;
|
private final World world;
|
||||||
private final int entityId;
|
private final long entityId;
|
||||||
private final UUID entityUUID;
|
private final UUID entityUUID;
|
||||||
final String updateEntityUUIDString;
|
final String updateEntityUUIDString;
|
||||||
|
|
||||||
public EntityUUIDChange(World world, int entityId, UUID entityUUID) {
|
public EntityUUIDChange(World world, long entityId, UUID entityUUID) {
|
||||||
this.world = world;
|
this.world = world;
|
||||||
this.entityId = entityId;
|
this.entityId = entityId;
|
||||||
this.entityUUID = entityUUID;
|
this.entityUUID = entityUUID;
|
||||||
@ -1150,7 +1150,7 @@ public class Consumer extends Thread {
|
|||||||
public void process(Connection conn, BatchHelper batchHelper) throws SQLException {
|
public void process(Connection conn, BatchHelper batchHelper) throws SQLException {
|
||||||
PreparedStatement smt = batchHelper.getOrPrepareStatement(conn, updateEntityUUIDString, Statement.NO_GENERATED_KEYS);
|
PreparedStatement smt = batchHelper.getOrPrepareStatement(conn, updateEntityUUIDString, Statement.NO_GENERATED_KEYS);
|
||||||
smt.setString(1, entityUUID.toString());
|
smt.setString(1, entityUUID.toString());
|
||||||
smt.setInt(2, entityId);
|
smt.setLong(2, entityId);
|
||||||
smt.executeUpdate();
|
smt.executeUpdate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1169,7 +1169,7 @@ public class Consumer extends Thread {
|
|||||||
private class BatchHelper {
|
private class BatchHelper {
|
||||||
private HashMap<String, PreparedStatement> preparedStatements = new HashMap<>();
|
private HashMap<String, PreparedStatement> preparedStatements = new HashMap<>();
|
||||||
private HashSet<PreparedStatement> preparedStatementsWithGeneratedKeys = new HashSet<>();
|
private HashSet<PreparedStatement> preparedStatementsWithGeneratedKeys = new HashSet<>();
|
||||||
private LinkedHashMap<PreparedStatement, ArrayList<IntCallback>> generatedKeyHandler = new LinkedHashMap<>();
|
private LinkedHashMap<PreparedStatement, ArrayList<LongCallback>> generatedKeyHandler = new LinkedHashMap<>();
|
||||||
private HashMap<Location, Integer> uncommitedBlockActors = new HashMap<>();
|
private HashMap<Location, Integer> uncommitedBlockActors = new HashMap<>();
|
||||||
|
|
||||||
public void reset() {
|
public void reset() {
|
||||||
@ -1189,21 +1189,21 @@ public class Consumer extends Thread {
|
|||||||
|
|
||||||
public void processStatements(Connection conn) throws SQLException {
|
public void processStatements(Connection conn) throws SQLException {
|
||||||
while (!generatedKeyHandler.isEmpty()) {
|
while (!generatedKeyHandler.isEmpty()) {
|
||||||
Entry<PreparedStatement, ArrayList<IntCallback>> entry = generatedKeyHandler.entrySet().iterator().next();
|
Entry<PreparedStatement, ArrayList<LongCallback>> entry = generatedKeyHandler.entrySet().iterator().next();
|
||||||
PreparedStatement smt = entry.getKey();
|
PreparedStatement smt = entry.getKey();
|
||||||
ArrayList<IntCallback> callbackList = entry.getValue();
|
ArrayList<LongCallback> callbackList = entry.getValue();
|
||||||
generatedKeyHandler.remove(smt);
|
generatedKeyHandler.remove(smt);
|
||||||
smt.executeBatch();
|
smt.executeBatch();
|
||||||
if (preparedStatementsWithGeneratedKeys.contains(smt)) {
|
if (preparedStatementsWithGeneratedKeys.contains(smt)) {
|
||||||
ResultSet keys = smt.getGeneratedKeys();
|
ResultSet keys = smt.getGeneratedKeys();
|
||||||
int[] results = new int[callbackList.size()];
|
long[] results = new long[callbackList.size()];
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
while (keys.next() && pos < results.length) {
|
while (keys.next() && pos < results.length) {
|
||||||
results[pos++] = keys.getInt(1);
|
results[pos++] = keys.getLong(1);
|
||||||
}
|
}
|
||||||
keys.close();
|
keys.close();
|
||||||
for (int i = 0; i < results.length; i++) {
|
for (int i = 0; i < results.length; i++) {
|
||||||
IntCallback callback = callbackList.get(i);
|
LongCallback callback = callbackList.get(i);
|
||||||
if (callback != null) {
|
if (callback != null) {
|
||||||
callback.call(results[i]);
|
callback.call(results[i]);
|
||||||
}
|
}
|
||||||
@ -1225,9 +1225,9 @@ public class Consumer extends Thread {
|
|||||||
return smt;
|
return smt;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addBatch(PreparedStatement smt, IntCallback generatedKeysCallback) throws SQLException {
|
public void addBatch(PreparedStatement smt, LongCallback generatedKeysCallback) throws SQLException {
|
||||||
smt.addBatch();
|
smt.addBatch();
|
||||||
ArrayList<IntCallback> callbackList = generatedKeyHandler.get(smt);
|
ArrayList<LongCallback> callbackList = generatedKeyHandler.get(smt);
|
||||||
if (callbackList == null) {
|
if (callbackList == null) {
|
||||||
callbackList = new ArrayList<>();
|
callbackList = new ArrayList<>();
|
||||||
generatedKeyHandler.put(smt, callbackList);
|
generatedKeyHandler.put(smt, callbackList);
|
||||||
@ -1236,7 +1236,7 @@ public class Consumer extends Thread {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected interface IntCallback {
|
protected interface LongCallback {
|
||||||
public void call(int value) throws SQLException;
|
public void call(long value) throws SQLException;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ public class EntityChange implements LookupCacheElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public EntityChange(ResultSet rs, QueryParams p) throws SQLException {
|
public EntityChange(ResultSet rs, QueryParams p) throws SQLException {
|
||||||
id = p.needId ? rs.getInt("id") : 0;
|
id = p.needId ? rs.getLong("id") : 0;
|
||||||
date = p.needDate ? rs.getTimestamp("date").getTime() : 0;
|
date = p.needDate ? rs.getTimestamp("date").getTime() : 0;
|
||||||
loc = p.needCoords ? new Location(p.world, rs.getInt("x"), rs.getInt("y"), rs.getInt("z")) : null;
|
loc = p.needCoords ? new Location(p.world, rs.getInt("x"), rs.getInt("y"), rs.getInt("z")) : null;
|
||||||
actor = p.needPlayer ? new Actor(rs) : null;
|
actor = p.needPlayer ? new Actor(rs) : null;
|
||||||
|
@ -30,7 +30,7 @@ public class Kill implements LookupCacheElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Kill(ResultSet rs, QueryParams p) throws SQLException {
|
public Kill(ResultSet rs, QueryParams p) throws SQLException {
|
||||||
id = p.needId ? rs.getInt("id") : 0;
|
id = p.needId ? rs.getLong("id") : 0;
|
||||||
date = p.needDate ? rs.getTimestamp("date").getTime() : 0;
|
date = p.needDate ? rs.getTimestamp("date").getTime() : 0;
|
||||||
loc = p.needCoords ? new Location(p.world, rs.getInt("x"), rs.getInt("y"), rs.getInt("z")) : null;
|
loc = p.needCoords ? new Location(p.world, rs.getInt("x"), rs.getInt("y"), rs.getInt("z")) : null;
|
||||||
killerName = p.needKiller ? rs.getString("killer") : null;
|
killerName = p.needKiller ? rs.getString("killer") : null;
|
||||||
|
@ -439,7 +439,7 @@ class Updater {
|
|||||||
ResultSet entries = st.executeQuery("SELECT id, date, playerid, replaced, type, data, x, y, z FROM `" + wcfg.table + "` ORDER BY id ASC LIMIT " + BLOCKS_CONVERT_BATCH_SIZE);
|
ResultSet entries = st.executeQuery("SELECT id, date, playerid, replaced, type, data, x, y, z FROM `" + wcfg.table + "` ORDER BY id ASC LIMIT " + BLOCKS_CONVERT_BATCH_SIZE);
|
||||||
while (entries.next()) {
|
while (entries.next()) {
|
||||||
hadRow = true;
|
hadRow = true;
|
||||||
int id = entries.getInt("id");
|
long id = entries.getLong("id");
|
||||||
Timestamp date = entries.getTimestamp("date");
|
Timestamp date = entries.getTimestamp("date");
|
||||||
int playerid = entries.getInt("playerid");
|
int playerid = entries.getInt("playerid");
|
||||||
int replaced = entries.getInt("replaced");
|
int replaced = entries.getInt("replaced");
|
||||||
@ -462,7 +462,7 @@ class Updater {
|
|||||||
int newSetId = MaterialConverter.getOrAddMaterialId(setBlockData);
|
int newSetId = MaterialConverter.getOrAddMaterialId(setBlockData);
|
||||||
int newSetData = MaterialConverter.getOrAddBlockStateId(setBlockData);
|
int newSetData = MaterialConverter.getOrAddBlockStateId(setBlockData);
|
||||||
|
|
||||||
insertStatement.setInt(1, id);
|
insertStatement.setLong(1, id);
|
||||||
insertStatement.setTimestamp(2, date);
|
insertStatement.setTimestamp(2, date);
|
||||||
insertStatement.setInt(3, playerid);
|
insertStatement.setInt(3, playerid);
|
||||||
insertStatement.setInt(4, newReplacedId);
|
insertStatement.setInt(4, newReplacedId);
|
||||||
@ -476,7 +476,7 @@ class Updater {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logblock.getLogger().info("Exception in entry " + id + " (" + replaced + ":" + data + "->" + type + ":" + data + "): " + e.getMessage());
|
logblock.getLogger().info("Exception in entry " + id + " (" + replaced + ":" + data + "->" + type + ":" + data + "): " + e.getMessage());
|
||||||
}
|
}
|
||||||
deleteStatement.setInt(1, id);
|
deleteStatement.setLong(1, id);
|
||||||
deleteStatement.addBatch();
|
deleteStatement.addBatch();
|
||||||
|
|
||||||
done++;
|
done++;
|
||||||
@ -522,7 +522,7 @@ class Updater {
|
|||||||
boolean anyRow = false;
|
boolean anyRow = false;
|
||||||
while (rs.next()) {
|
while (rs.next()) {
|
||||||
anyRow = true;
|
anyRow = true;
|
||||||
int id = rs.getInt("id");
|
long id = rs.getLong("id");
|
||||||
int itemtype = rs.getInt("itemtype");
|
int itemtype = rs.getInt("itemtype");
|
||||||
int itemdata = rs.getInt("itemdata");
|
int itemdata = rs.getInt("itemdata");
|
||||||
int amount = rs.getInt("itemamount");
|
int amount = rs.getInt("itemamount");
|
||||||
@ -532,13 +532,13 @@ class Updater {
|
|||||||
}
|
}
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
ItemStack stack = weaponMaterial.getMaxDurability() > 0 ? new ItemStack(weaponMaterial, Math.abs(amount), (short) itemdata) : new ItemStack(weaponMaterial, Math.abs(amount));
|
ItemStack stack = weaponMaterial.getMaxDurability() > 0 ? new ItemStack(weaponMaterial, Math.abs(amount), (short) itemdata) : new ItemStack(weaponMaterial, Math.abs(amount));
|
||||||
insertChestData.setInt(1, id);
|
insertChestData.setLong(1, id);
|
||||||
insertChestData.setBytes(2, Utils.saveItemStack(stack));
|
insertChestData.setBytes(2, Utils.saveItemStack(stack));
|
||||||
insertChestData.setInt(3, amount >= 0 ? 0 : 1);
|
insertChestData.setInt(3, amount >= 0 ? 0 : 1);
|
||||||
insertChestData.setInt(4, MaterialConverter.getOrAddMaterialId(weaponMaterial));
|
insertChestData.setInt(4, MaterialConverter.getOrAddMaterialId(weaponMaterial));
|
||||||
insertChestData.addBatch();
|
insertChestData.addBatch();
|
||||||
|
|
||||||
deleteChest.setInt(1, id);
|
deleteChest.setLong(1, id);
|
||||||
deleteChest.addBatch();
|
deleteChest.addBatch();
|
||||||
done++;
|
done++;
|
||||||
}
|
}
|
||||||
@ -585,7 +585,7 @@ class Updater {
|
|||||||
boolean anyRow = false;
|
boolean anyRow = false;
|
||||||
while (rs.next()) {
|
while (rs.next()) {
|
||||||
anyRow = true;
|
anyRow = true;
|
||||||
int id = rs.getInt("id");
|
long id = rs.getLong("id");
|
||||||
int weapon = rs.getInt("weapon");
|
int weapon = rs.getInt("weapon");
|
||||||
Material weaponMaterial = materialUpdater.getMaterial(weapon, 0);
|
Material weaponMaterial = materialUpdater.getMaterial(weapon, 0);
|
||||||
if (weaponMaterial == null) {
|
if (weaponMaterial == null) {
|
||||||
@ -595,7 +595,7 @@ class Updater {
|
|||||||
if (newWeapon != weapon) {
|
if (newWeapon != weapon) {
|
||||||
anyUpdate = true;
|
anyUpdate = true;
|
||||||
updateWeaponStatement.setInt(1, newWeapon);
|
updateWeaponStatement.setInt(1, newWeapon);
|
||||||
updateWeaponStatement.setInt(2, id);
|
updateWeaponStatement.setLong(2, id);
|
||||||
updateWeaponStatement.addBatch();
|
updateWeaponStatement.addBatch();
|
||||||
}
|
}
|
||||||
done++;
|
done++;
|
||||||
@ -666,7 +666,7 @@ class Updater {
|
|||||||
boolean anyRow = false;
|
boolean anyRow = false;
|
||||||
while (rs.next()) {
|
while (rs.next()) {
|
||||||
anyRow = true;
|
anyRow = true;
|
||||||
int id = rs.getInt("id");
|
long id = rs.getLong("id");
|
||||||
String signText = rs.getString("signtext");
|
String signText = rs.getString("signtext");
|
||||||
int replaced = rs.getInt("replaced");
|
int replaced = rs.getInt("replaced");
|
||||||
boolean nullBlock = rs.wasNull();
|
boolean nullBlock = rs.wasNull();
|
||||||
@ -681,13 +681,13 @@ class Updater {
|
|||||||
boolean wasSign = replacedMaterial == Material.OAK_SIGN || replacedMaterial == Material.OAK_WALL_SIGN;
|
boolean wasSign = replacedMaterial == Material.OAK_SIGN || replacedMaterial == Material.OAK_WALL_SIGN;
|
||||||
boolean isSign = typeMaterial == Material.OAK_SIGN || typeMaterial == Material.OAK_WALL_SIGN;
|
boolean isSign = typeMaterial == Material.OAK_SIGN || typeMaterial == Material.OAK_WALL_SIGN;
|
||||||
|
|
||||||
insertSignState.setInt(1, id);
|
insertSignState.setLong(1, id);
|
||||||
insertSignState.setBytes(2, wasSign ? bytes : null);
|
insertSignState.setBytes(2, wasSign ? bytes : null);
|
||||||
insertSignState.setBytes(3, isSign ? bytes : null);
|
insertSignState.setBytes(3, isSign ? bytes : null);
|
||||||
insertSignState.addBatch();
|
insertSignState.addBatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteSign.setInt(1, id);
|
deleteSign.setLong(1, id);
|
||||||
deleteSign.addBatch();
|
deleteSign.addBatch();
|
||||||
done++;
|
done++;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user