From e9807682107da92085ded9d496f2a1c2b30f1a03 Mon Sep 17 00:00:00 2001 From: ThePindabaas Date: Wed, 15 Jul 2026 12:13:12 +0000 Subject: [PATCH 1/2] Fix lack of space after animal type (#12) Reviewed-on: https://git.ardakaz.net/ArdakazMC/GriefAlert/pulls/12 Reviewed-by: Ardakaz Co-authored-by: ThePindabaas Co-committed-by: ThePindabaas --- src/main/java/net/ardakaz/griefalert/GriefAlert.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/net/ardakaz/griefalert/GriefAlert.java b/src/main/java/net/ardakaz/griefalert/GriefAlert.java index 264c77f..031ec84 100644 --- a/src/main/java/net/ardakaz/griefalert/GriefAlert.java +++ b/src/main/java/net/ardakaz/griefalert/GriefAlert.java @@ -709,7 +709,7 @@ public class GriefAlert extends JavaPlugin implements Listener { String worldName = event.getEntity().getWorld().getName(); - String message = ChatColor.GRAY + killer.getName() + " killed" + " " + typeName + "in " + animalOwner + "'s build at " + x + " " + y + " " + z + getHumanWorldName(worldName); + String message = ChatColor.GRAY + killer.getName() + " killed" + " " + typeName + " in " + animalOwner + "'s build at " + x + " " + y + " " + z + getHumanWorldName(worldName); alert(message, killer.getName(), "[Map Link](" + MAP_LINK + "/?worldname=" + worldName + "&zoom=7&x=" + x + "&y=" + y + "&z=" + z + ")", animalOwner, x, y, z, worldName); From 7aec60882526707d4955cf2631e50132d4ecb869 Mon Sep 17 00:00:00 2001 From: ThePindabaas Date: Sat, 18 Jul 2026 18:24:26 +0000 Subject: [PATCH 2/2] add new db tables (#13) Co-authored-by: ThePindabaas <219561634+ThePindabaas@users.noreply.github.com> Co-authored-by: Ardakaz Reviewed-on: https://git.ardakaz.net/ArdakazMC/GriefAlert/pulls/13 Reviewed-by: Ardakaz Co-authored-by: ThePindabaas Co-committed-by: ThePindabaas --- .../net/ardakaz/griefalert/GriefAlert.java | 6 +- .../net/ardakaz/griefalert/Migrations.java | 68 +++++++++++++++++++ 2 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 src/main/java/net/ardakaz/griefalert/Migrations.java diff --git a/src/main/java/net/ardakaz/griefalert/GriefAlert.java b/src/main/java/net/ardakaz/griefalert/GriefAlert.java index 031ec84..59de1e5 100644 --- a/src/main/java/net/ardakaz/griefalert/GriefAlert.java +++ b/src/main/java/net/ardakaz/griefalert/GriefAlert.java @@ -197,7 +197,11 @@ public class GriefAlert extends JavaPlugin implements Listener { try { connection = DriverManager.getConnection(jdbcUrl); Statement stmt = connection.createStatement(); - stmt.executeUpdate("CREATE TABLE IF NOT EXISTS ignored_locations (x INTEGER, y INTEGER, z INTEGER, world TEXT, PRIMARY KEY (x, y, z, world))"); + stmt.executeUpdate(Migrations.CREATE_TABLE_IGNORED_LOCATIONS); + stmt.executeUpdate(Migrations.CREATE_TABLE_PLAYERS); + stmt.executeUpdate(Migrations.CREATE_TABLE_ACTIONS); + stmt.executeUpdate(Migrations.CREATE_TABLE_ALERTS); + stmt.executeUpdate(Migrations.CREATE_TABLE_REPORTS); stmt.close(); getLogger().info("Connected to "+jdbcUrl); } catch (SQLException e) { diff --git a/src/main/java/net/ardakaz/griefalert/Migrations.java b/src/main/java/net/ardakaz/griefalert/Migrations.java new file mode 100644 index 0000000..455db02 --- /dev/null +++ b/src/main/java/net/ardakaz/griefalert/Migrations.java @@ -0,0 +1,68 @@ +package net.ardakaz.griefalert; + +public class Migrations { + + public static final String CREATE_TABLE_IGNORED_LOCATIONS = + "CREATE TABLE IF NOT EXISTS ignored_locations (" + + "x INTEGER, " + + "y INTEGER, " + + "z INTEGER, " + + "world TEXT, " + + "PRIMARY KEY (x, y, z, world)" + + ")"; + + public static final String CREATE_TABLE_PLAYERS = + "CREATE TABLE IF NOT EXISTS players (" + + "id TEXT PRIMARY KEY, " + + "names TEXT NOT NULL, " + + "playtime INTEGER NOT NULL DEFAULT 0, " + + "firstseen INTEGER NOT NULL DEFAULT CURRENT_TIMESTAMP, " + + "lastseen INTEGER NOT NULL DEFAULT CURRENT_TIMESTAMP" + + ")"; + + public static final String CREATE_TABLE_ACTIONS = + "CREATE TABLE IF NOT EXISTS actions (" + + "id INTEGER PRIMARY KEY, " + + "player TEXT NOT NULL, " + + "type TEXT NOT NULL, " + + "moderator TEXT NOT NULL, " + + "reason TEXT, " + + "time TEXT, " + + "timestamp INTEGER NOT NULL DEFAULT CURRENT_TIMESTAMP, " + + "FOREIGN KEY(player) REFERENCES players(id)" + + ")"; + + public static final String CREATE_TABLE_ALERTS = + "CREATE TABLE IF NOT EXISTS alerts (" + + "id INTEGER PRIMARY KEY, " + + "player TEXT NOT NULL, " + + "action TEXT NOT NULL, " + + "target TEXT NOT NULL, " + + "target_amount INTEGER, " + + "target_player TEXT NOT NULL, " + + "x INTEGER NOT NULL, " + + "y INTEGER NOT NULL, " + + "z INTEGER NOT NULL, " + + "world TEXT NOT NULL, " + + "is_flagged INTEGER, " + + "flag_text TEXT, " + + "resolved_by TEXT, " + + "state TEXT NOT NULL DEFAULT 'UNRESOLVED', " + + "timestamp INTEGER NOT NULL DEFAULT CURRENT_TIMESTAMP, " + + "FOREIGN KEY(player) REFERENCES players(id)" + + ")"; + + public static final String CREATE_TABLE_REPORTS = + "CREATE TABLE IF NOT EXISTS reports (" + + "id INTEGER PRIMARY KEY, " + + "player TEXT NOT NULL, " + + "x INTEGER NOT NULL, " + + "y INTEGER NOT NULL, " + + "z INTEGER NOT NULL, " + + "world TEXT NOT NULL, " + + "text TEXT NOT NULL, " + + "resolved_by TEXT, " + + "timestamp INTEGER NOT NULL DEFAULT CURRENT_TIMESTAMP, " + + "state TEXT NOT NULL DEFAULT 'UNRESOLVED'" + + ")"; +}