mirror of
https://github.com/TotalFreedomMC/PlayerParticles.git
synced 2025-08-05 03:53:10 +00:00
Fix removing fixed effects/groups while using mysql
This commit is contained in:
parent
b302f36998
commit
a341870ad5
2 changed files with 7 additions and 3 deletions
|
@ -211,7 +211,7 @@ public class PlayerParticles extends JavaPlugin {
|
||||||
try (Statement createStatement = connection.createStatement()) {
|
try (Statement createStatement = connection.createStatement()) {
|
||||||
createStatement.addBatch("CREATE TABLE IF NOT EXISTS pp_particle (uuid VARCHAR(36), group_uuid VARCHAR(36), id SMALLINT, effect VARCHAR(100), style VARCHAR(100), item_material VARCHAR(100), block_material VARCHAR(100), note SMALLINT, r SMALLINT, g SMALLINT, b SMALLINT, PRIMARY KEY(uuid))");
|
createStatement.addBatch("CREATE TABLE IF NOT EXISTS pp_particle (uuid VARCHAR(36), group_uuid VARCHAR(36), id SMALLINT, effect VARCHAR(100), style VARCHAR(100), item_material VARCHAR(100), block_material VARCHAR(100), note SMALLINT, r SMALLINT, g SMALLINT, b SMALLINT, PRIMARY KEY(uuid))");
|
||||||
createStatement.addBatch("CREATE TABLE IF NOT EXISTS pp_group (uuid VARCHAR(36), owner_uuid VARCHAR(36), name VARCHAR(100), PRIMARY KEY(uuid))");
|
createStatement.addBatch("CREATE TABLE IF NOT EXISTS pp_group (uuid VARCHAR(36), owner_uuid VARCHAR(36), name VARCHAR(100), PRIMARY KEY(uuid))");
|
||||||
createStatement.addBatch("CREATE TABLE IF NOT EXISTS pp_fixed (owner_uuid VARCHAR(36), id SMALLINT, particle_uuid VARCHAR(36), world VARCHAR(100), xPos DOUBLE, yPos DOUBLE, zPos DOUBLE, PRIMARY KEY(owner_uuid, id), FOREIGN KEY(particle_uuid) REFERENCES pp_particle(uuid))");
|
createStatement.addBatch("CREATE TABLE IF NOT EXISTS pp_fixed (owner_uuid VARCHAR(36), id SMALLINT, particle_uuid VARCHAR(36), world VARCHAR(100), xPos DOUBLE, yPos DOUBLE, zPos DOUBLE, PRIMARY KEY(owner_uuid, id), FOREIGN KEY(particle_uuid) REFERENCES pp_particle(uuid) ON DELETE CASCADE)");
|
||||||
int[] results = createStatement.executeBatch();
|
int[] results = createStatement.executeBatch();
|
||||||
if (results[0] + results[1] + results[2] > 0) {
|
if (results[0] + results[1] + results[2] > 0) {
|
||||||
getLogger().warning("Updated " + (useMySql ? "MySQL" : "SQLite") + " database schema.");
|
getLogger().warning("Updated " + (useMySql ? "MySQL" : "SQLite") + " database schema.");
|
||||||
|
|
|
@ -273,7 +273,9 @@ public class DataManager {
|
||||||
statement.setString(2, group.getName());
|
statement.setString(2, group.getName());
|
||||||
|
|
||||||
ResultSet result = statement.executeQuery();
|
ResultSet result = statement.executeQuery();
|
||||||
groupUUID = result.getString("uuid");
|
if (result.next()) {
|
||||||
|
groupUUID = result.getString("uuid");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Execute particle delete update
|
// Execute particle delete update
|
||||||
|
@ -362,7 +364,9 @@ public class DataManager {
|
||||||
statement.setInt(2, id);
|
statement.setInt(2, id);
|
||||||
|
|
||||||
ResultSet result = statement.executeQuery();
|
ResultSet result = statement.executeQuery();
|
||||||
particleUUID = result.getString("particle_uuid");
|
if (result.next()) {
|
||||||
|
particleUUID = result.getString("particle_uuid");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String particleDeleteQuery = "DELETE FROM pp_particle WHERE uuid = ?";
|
String particleDeleteQuery = "DELETE FROM pp_particle WHERE uuid = ?";
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue