Compare commits
4 Commits
0.6
...
fix-space2
| Author | SHA1 | Date | |
|---|---|---|---|
| c009654c5c | |||
| ab2c9bf1d6 | |||
| 7aec608825 | |||
| e980768210 |
@@ -197,7 +197,11 @@ public class GriefAlert extends JavaPlugin implements Listener {
|
|||||||
try {
|
try {
|
||||||
connection = DriverManager.getConnection(jdbcUrl);
|
connection = DriverManager.getConnection(jdbcUrl);
|
||||||
Statement stmt = connection.createStatement();
|
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();
|
stmt.close();
|
||||||
getLogger().info("Connected to "+jdbcUrl);
|
getLogger().info("Connected to "+jdbcUrl);
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
@@ -778,7 +782,7 @@ public class GriefAlert extends JavaPlugin implements Listener {
|
|||||||
action = "error 404 check with kleedje30";
|
action = "error 404 check with kleedje30";
|
||||||
}
|
}
|
||||||
|
|
||||||
String message = ChatColor.GRAY + player.getName() + action + " Copper " + " at " + x + " " + y + " " + z + getHumanWorldName(world);
|
String message = ChatColor.GRAY + player.getName() + " " + action + " Copper" + " at " + x + " " + y + " " + z + getHumanWorldName(world);
|
||||||
alert(message, player.getName(), "[Map Link](" + MAP_LINK + "/?worldname=" + world + "&zoom=7&x=" + x + "&y=" + y + "&z=" + z + ")", target, x, y, z, world);
|
alert(message, player.getName(), "[Map Link](" + MAP_LINK + "/?worldname=" + world + "&zoom=7&x=" + x + "&y=" + y + "&z=" + z + ")", target, x, y, z, world);
|
||||||
|
|
||||||
}, 1L);
|
}, 1L);
|
||||||
|
|||||||
68
src/main/java/net/ardakaz/griefalert/Migrations.java
Normal file
68
src/main/java/net/ardakaz/griefalert/Migrations.java
Normal file
@@ -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'" +
|
||||||
|
")";
|
||||||
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
# Ignore all stealing?
|
# Ignore all stealing?
|
||||||
allow-stealing: false
|
allow-stealing: false
|
||||||
|
|
||||||
jdbc-url: ""
|
jdbc-url: "./plugins/GriefAlert/database.db"
|
||||||
|
|
||||||
# Breaking these blocks don't cause alerts. (Material)
|
# Breaking these blocks don't cause alerts. (Material)
|
||||||
excluded-blocks:
|
excluded-blocks:
|
||||||
|
|||||||
Reference in New Issue
Block a user