Added:
- Creeper Disable Fuse Setting
This commit is contained in:
BigPappa committed 2026-09-20 14:27:33 -05:00
1 parent c5ce14ffbb
commit 196dc123e7
11 files changed
+1061 -141

No files matched your search

@@ -5,6 +5,7 @@ import com.rsscripting.serveradmin.RSServerAdmin;
import java.io.File;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
@@ -50,7 +51,8 @@ public class DatabaseManager {
private void createTables() throws SQLException {
try (Statement statement = connection.createStatement()) {
try (Statement statement =
connection.createStatement()) {
statement.execute("""
CREATE TABLE IF NOT EXISTS settings (
@@ -62,10 +64,10 @@ public class DatabaseManager {
""");
statement.execute("""
CREATE TABLE IF NOT EXISTS worlds (
world_name TEXT PRIMARY KEY
)
""");
CREATE TABLE IF NOT EXISTS worlds (
world_name TEXT PRIMARY KEY
)
""");
statement.execute("""
CREATE TABLE IF NOT EXISTS defaults (
@@ -74,28 +76,25 @@ public class DatabaseManager {
)
""");
statement.execute(
"""
CREATE TABLE IF NOT EXISTS keep_inventory
(
statement.execute("""
CREATE TABLE IF NOT EXISTS keep_inventory (
world_name TEXT PRIMARY KEY,
enabled INTEGER NOT NULL
)
"""
);
""");
statement.execute(
"""
statement.execute("""
CREATE TABLE IF NOT EXISTS creeper_settings (
world_name TEXT PRIMARY KEY,
block_damage INTEGER NOT NULL,
entity_damage INTEGER NOT NULL
entity_damage INTEGER NOT NULL,
disable_fuse INTEGER NOT NULL DEFAULT 0
)
"""
);
""");
statement.execute(
"""
addDisableFuseColumnIfNeeded();
statement.execute("""
CREATE TABLE IF NOT EXISTS equipment_drop_settings (
world_name TEXT PRIMARY KEY,
helmet INTEGER NOT NULL,
@@ -105,18 +104,60 @@ public class DatabaseManager {
main_hand INTEGER NOT NULL,
off_hand INTEGER NOT NULL
)
"""
);
""");
statement.execute(
"""
statement.execute("""
CREATE TABLE IF NOT EXISTS peaceful_mobs (
world_name TEXT PRIMARY KEY,
enabled INTEGER NOT NULL
)
"""
);
""");
}
}
private void addDisableFuseColumnIfNeeded()
throws SQLException {
boolean columnExists = false;
try (Statement statement =
connection.createStatement();
ResultSet resultSet =
statement.executeQuery(
"PRAGMA table_info(creeper_settings)"
)) {
while (resultSet.next()) {
String columnName =
resultSet.getString("name");
if ("disable_fuse".equalsIgnoreCase(
columnName
)) {
columnExists = true;
break;
}
}
}
if (!columnExists) {
try (Statement statement =
connection.createStatement()) {
statement.execute(
"""
ALTER TABLE creeper_settings
ADD COLUMN disable_fuse
INTEGER NOT NULL DEFAULT 0
"""
);
}
}
}