diff --git a/pom.xml b/pom.xml
index e592d07..5d2a8e5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
4.0.0
edu.whimc
WHIMC-PositionTracker
- 3.2.0
+ 3.2.4
WHIMC Position Tracker
Track player positions to a database
diff --git a/src/main/java/edu/whimc/positiontracker/sql/entries/RegionEntry.java b/src/main/java/edu/whimc/positiontracker/sql/entries/RegionEntry.java
index 6baa673..1af199e 100644
--- a/src/main/java/edu/whimc/positiontracker/sql/entries/RegionEntry.java
+++ b/src/main/java/edu/whimc/positiontracker/sql/entries/RegionEntry.java
@@ -7,6 +7,8 @@
import java.sql.SQLException;
import java.sql.Timestamp;
import java.util.UUID;
+
+import org.bukkit.Bukkit;
import org.bukkit.Location;
public class RegionEntry extends DataEntry {
@@ -52,7 +54,14 @@ public class RegionEntry extends DataEntry {
public RegionEntry(RegionEvent event) {
Location loc = event.getLocation();
this.regionName = event.getRegion().getId();
- this.regionMembers = String.join(",", event.getRegion().getMembers().getPlayers());
+ this.regionMembers = String.join(",",
+ event.getRegion().getMembers().getUniqueIds().stream()
+ .map(uuid -> {
+ String name = Bukkit.getOfflinePlayer(uuid).getName(); //convert UUID to username
+ return (name != null) ? name : uuid.toString(); // fallback if name unknown
+ })
+ .toList()
+ );
this.trigger = event.getTrigger();
this.isEnter = event instanceof RegionLeaveEvent;
this.x = loc.getBlockX();
diff --git a/src/main/java/edu/whimc/positiontracker/sql/migration/SchemaManager.java b/src/main/java/edu/whimc/positiontracker/sql/migration/SchemaManager.java
index 8fe83f7..7088eaf 100644
--- a/src/main/java/edu/whimc/positiontracker/sql/migration/SchemaManager.java
+++ b/src/main/java/edu/whimc/positiontracker/sql/migration/SchemaManager.java
@@ -52,8 +52,13 @@ public boolean initialize() {
if (schema.getVersion() > curVersion) {
this.plugin.getLogger().info("Migrating to schema " + schema.getVersion() + "...");
if (!schema.migrate(this)) {
+ this.plugin.getLogger().severe("Migration to schema " + schema.getVersion() + " failed.");
return false;
+ } else {
+ this.plugin.getLogger().info("Migration to schema " + schema.getVersion() + " completed.");
}
+ } else {
+ this.plugin.getLogger().info("Skipping schema " + schema.getVersion() + ", already applied.");
}
schema = schema.getNextSchema();
}
diff --git a/src/main/java/edu/whimc/positiontracker/sql/migration/schemas/Schema_2.java b/src/main/java/edu/whimc/positiontracker/sql/migration/schemas/Schema_2.java
index ecdba0f..0a50d03 100644
--- a/src/main/java/edu/whimc/positiontracker/sql/migration/schemas/Schema_2.java
+++ b/src/main/java/edu/whimc/positiontracker/sql/migration/schemas/Schema_2.java
@@ -8,7 +8,7 @@
public class Schema_2 extends SchemaVersion {
private static final String ADD_GAMEMODE =
- "ALTER TABLE whimc_player_positions ADD COLUMN gamemode VARCHAR(16);";
+ "ALTER TABLE whimc_player_positions ADD COLUMN gamemode VARCHAR(16) AFTER username;";
public Schema_2() {
super(2, new Schema_3());
diff --git a/src/main/java/edu/whimc/positiontracker/sql/migration/schemas/Schema_3.java b/src/main/java/edu/whimc/positiontracker/sql/migration/schemas/Schema_3.java
index 886fdfe..9bcf0b3 100644
--- a/src/main/java/edu/whimc/positiontracker/sql/migration/schemas/Schema_3.java
+++ b/src/main/java/edu/whimc/positiontracker/sql/migration/schemas/Schema_3.java
@@ -19,7 +19,7 @@ public class Schema_3 extends SchemaVersion {
private static final String ADD_REGION_PITCH =
"ALTER TABLE whimc_player_region_events ADD COLUMN pitch FLOAT AFTER yaw;";
private static final String ADD_REGION_MEMBERS =
- "ALTER TABLE whimc_player_region_events ADD COLUMN region-members VARCHAR(64) AFTER region;";
+ "ALTER TABLE whimc_player_region_events ADD COLUMN region_members TEXT AFTER region;";
public Schema_3() {
super(3, null); // No newer schema after this one (yet)
@@ -36,14 +36,18 @@ protected void migrateRoutine(Connection connection) throws SQLException {
}
// Update player_region_events table
- try (PreparedStatement addRegionYaw = connection.prepareStatement(ADD_REGION_YAW)) {
- addRegionYaw.execute();
+ try (PreparedStatement addYaw = connection.prepareStatement(ADD_POS_YAW)) {
+ addYaw.execute();
+ System.out.println("✓ Adding Yaw, Pitch and Region Members");
+ } catch (SQLException e) {
+ System.err.println("✗ Could not add to whimc_player_positions: " + e.getMessage());
}
+
try (PreparedStatement addRegionPitch = connection.prepareStatement(ADD_REGION_PITCH)) {
addRegionPitch.execute();
}
- try (PreparedStatement addRegionPitch = connection.prepareStatement(ADD_REGION_MEMBERS)) {
- addRegionPitch.execute();
+ try (PreparedStatement addRegionMembers = connection.prepareStatement(ADD_REGION_MEMBERS)) {
+ addRegionMembers.execute();
}
}
}