diff --git a/gradle.properties b/gradle.properties index 37ae86b..4dcbef4 100644 --- a/gradle.properties +++ b/gradle.properties @@ -53,7 +53,7 @@ mod_name=Zontreck's Library Mod # The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default. mod_license=GPLv3 # The mod version. See https://semver.org/ -mod_version=1201.13.042424.0045 +mod_version=1201.13.042424.0126 # The group ID for the mod. It is only important when publishing as an artifact to a Maven repository. # This should match the base package used for the mod sources. # See https://maven.apache.org/guides/mini/guide-naming-conventions.html diff --git a/src/main/java/dev/zontreck/libzontreck/memory/world/BlockRestoreQueue.java b/src/main/java/dev/zontreck/libzontreck/memory/world/BlockRestoreQueue.java index 44ab47d..8bf0c9e 100644 --- a/src/main/java/dev/zontreck/libzontreck/memory/world/BlockRestoreQueue.java +++ b/src/main/java/dev/zontreck/libzontreck/memory/world/BlockRestoreQueue.java @@ -83,15 +83,15 @@ public abstract class BlockRestoreQueue PreparedStatement pstmt = null; try { pstmt = DatabaseWrapper.get().prepareStatement("INSERT INTO `blocks` (queueName, posX, posY, posZ, snapshotID, block) VALUES (?, ?, ?, ?, ?, ?);"); - pstmt.setString(0, getRestoreQueueName()); - pstmt.setInt(1, block.position.getX()); - pstmt.setInt(2, block.position.getY()); - pstmt.setInt(3, block.position.getZ()); - pstmt.setInt(4, 0); + pstmt.setString(1, getRestoreQueueName()); + pstmt.setInt(2, block.position.getX()); + pstmt.setInt(3, block.position.getY()); + pstmt.setInt(4, block.position.getZ()); + pstmt.setInt(5, 0); ByteArrayOutputStream blockState = new ByteArrayOutputStream(); DataOutputStream dos0 = new DataOutputStream(blockState); NbtIo.write(block.serialize(), dos0); - pstmt.setBytes(5, blockState.toByteArray()); + pstmt.setBytes(6, blockState.toByteArray()); DatabaseWrapper.get().executePreparedStatement(pstmt); @@ -124,7 +124,7 @@ public abstract class BlockRestoreQueue } else sel = DatabaseWrapper.get().prepareStatement("SELECT * FROM `blocks` WHERE queueName=? LIMIT 1;"); - sel.setString(0, getRestoreQueueName()); + sel.setString(1, getRestoreQueueName()); ResultSet res = DatabaseWrapper.get().executePreparedStatementQuery(sel); // Now retrieve the block from the database if (res.next()) { @@ -141,10 +141,10 @@ public abstract class BlockRestoreQueue } } catch (SQLException e001) { PreparedStatement pstat = DatabaseWrapper.get().prepareStatement("DELETE FROM `blocks` WHERE queueName=? AND posX=? AND posY=? AND posZ=?;"); - pstat.setString(0, getRestoreQueueName()); - pstat.setInt(1, block.position.getX()); - pstat.setInt(2, block.position.getY()); - pstat.setInt(3, block.position.getZ()); + pstat.setString(1, getRestoreQueueName()); + pstat.setInt(2, block.position.getX()); + pstat.setInt(3, block.position.getY()); + pstat.setInt(4, block.position.getZ()); DatabaseWrapper.get().executePreparedStatement(pstat); } diff --git a/src/main/java/dev/zontreck/libzontreck/memory/world/DatabaseMigrations.java b/src/main/java/dev/zontreck/libzontreck/memory/world/DatabaseMigrations.java index 82c8128..b507c2d 100644 --- a/src/main/java/dev/zontreck/libzontreck/memory/world/DatabaseMigrations.java +++ b/src/main/java/dev/zontreck/libzontreck/memory/world/DatabaseMigrations.java @@ -73,8 +73,8 @@ public class DatabaseMigrations try { PreparedStatement pstat = DatabaseWrapper.get().prepareStatement("REPLACE INTO `migrations` (tableID, version) VALUES (?,?);"); - pstat.setString(0, tableID); - pstat.setInt(1, version); + pstat.setString(1, tableID); + pstat.setInt(2, version); pstat.execute(); } catch (SQLException ex) @@ -162,7 +162,7 @@ public class DatabaseMigrations { try{ PreparedStatement pst = DatabaseWrapper.get().prepareStatement("SELECT * FROM `migrations` WHERE tableID=?;"); - pst.setString(0, tableID); + pst.setString(1, tableID); var result = pst.executeQuery(); if(!result.next())