Initial Development
- bluemap integration for adding/removing stops working.
This commit is contained in:
1 parent
f1ab19f003
commit
0219183fe6
12 files changed
+375
-7
No files matched your search
@@ -22,6 +22,17 @@ public final class StopManager {
|
||||
public record StopEntry(String name, String icon) {
|
||||
}
|
||||
|
||||
public record StopLocation(
|
||||
String name,
|
||||
String world,
|
||||
double x,
|
||||
double y,
|
||||
double z,
|
||||
float yaw,
|
||||
float pitch
|
||||
) {
|
||||
}
|
||||
|
||||
public boolean exists(String name) throws SQLException {
|
||||
String sql = "SELECT 1 FROM stops WHERE name = ?";
|
||||
|
||||
@@ -36,6 +47,39 @@ public final class StopManager {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public StopLocation getStopLocation(String name)
|
||||
throws SQLException {
|
||||
|
||||
String sql = """
|
||||
SELECT name, world, x, y, z, yaw, pitch
|
||||
FROM stops
|
||||
WHERE name = ?
|
||||
""";
|
||||
|
||||
try (PreparedStatement statement = connection()
|
||||
.prepareStatement(sql)) {
|
||||
|
||||
statement.setString(1, name);
|
||||
|
||||
try (ResultSet results = statement.executeQuery()) {
|
||||
if (!results.next()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new StopLocation(
|
||||
results.getString("name"),
|
||||
results.getString("world"),
|
||||
results.getDouble("x"),
|
||||
results.getDouble("y"),
|
||||
results.getDouble("z"),
|
||||
results.getFloat("yaw"),
|
||||
results.getFloat("pitch")
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean delete(String name) throws SQLException {
|
||||
String sql = "DELETE FROM stops WHERE name = ?";
|
||||
|
||||
|
||||
Reference in new issue
Block a user