0.1.0 - Added
- Clickable /cab list - Clickable /cab search xxxx
This commit is contained in:
1 parent
a7fba84cd3
commit
2e8b4b19c8
15 files changed
+218
-49
No files matched your search
@@ -19,8 +19,11 @@ public final class StopManager {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
public record StopEntry(String name, String icon) {
|
||||
}
|
||||
public record StopEntry(
|
||||
String name,
|
||||
String icon,
|
||||
String world
|
||||
) {}
|
||||
|
||||
public record StopLocation(
|
||||
String name,
|
||||
@@ -34,6 +37,40 @@ public final class StopManager {
|
||||
) {
|
||||
}
|
||||
|
||||
public StopLocation getStopLocation(String name, String world)
|
||||
throws SQLException {
|
||||
|
||||
String sql = """
|
||||
SELECT name, icon, world, x, y, z, yaw, pitch
|
||||
FROM stops
|
||||
WHERE name = ? AND world = ?
|
||||
""";
|
||||
|
||||
try (PreparedStatement statement = connection()
|
||||
.prepareStatement(sql)) {
|
||||
|
||||
statement.setString(1, name);
|
||||
statement.setString(2, world);
|
||||
|
||||
try (ResultSet results = statement.executeQuery()) {
|
||||
if (!results.next()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new StopLocation(
|
||||
results.getString("name"),
|
||||
results.getString("icon"),
|
||||
results.getString("world"),
|
||||
results.getDouble("x"),
|
||||
results.getDouble("y"),
|
||||
results.getDouble("z"),
|
||||
results.getFloat("yaw"),
|
||||
results.getFloat("pitch")
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean exists(String name) throws SQLException {
|
||||
String sql = "SELECT 1 FROM stops WHERE name = ?";
|
||||
|
||||
@@ -126,7 +163,7 @@ public final class StopManager {
|
||||
|
||||
public List<StopEntry> getAllStops() throws SQLException {
|
||||
String sql = """
|
||||
SELECT name, icon
|
||||
SELECT name, icon, world
|
||||
FROM stops
|
||||
ORDER BY name COLLATE NOCASE
|
||||
""";
|
||||
@@ -140,7 +177,8 @@ public final class StopManager {
|
||||
while (results.next()) {
|
||||
stops.add(new StopEntry(
|
||||
results.getString("name"),
|
||||
results.getString("icon")
|
||||
results.getString("icon"),
|
||||
results.getString("world")
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -153,9 +191,9 @@ public final class StopManager {
|
||||
throws SQLException {
|
||||
|
||||
String sql = """
|
||||
SELECT name, icon
|
||||
SELECT name, icon, world
|
||||
FROM stops
|
||||
WHERE name LIKE ? ESCAPE '\\'
|
||||
WHERE LOWER(name) LIKE LOWER(?)
|
||||
ORDER BY name COLLATE NOCASE
|
||||
""";
|
||||
|
||||
@@ -175,7 +213,8 @@ public final class StopManager {
|
||||
while (results.next()) {
|
||||
stops.add(new StopEntry(
|
||||
results.getString("name"),
|
||||
results.getString("icon")
|
||||
results.getString("icon"),
|
||||
results.getString("world")
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -188,9 +227,9 @@ public final class StopManager {
|
||||
throws SQLException {
|
||||
|
||||
String sql = """
|
||||
SELECT name, icon
|
||||
SELECT name, icon, world
|
||||
FROM stops
|
||||
WHERE icon = ?
|
||||
WHERE LOWER(icon) = LOWER(?)
|
||||
ORDER BY name COLLATE NOCASE
|
||||
""";
|
||||
|
||||
@@ -205,7 +244,8 @@ public final class StopManager {
|
||||
while (results.next()) {
|
||||
stops.add(new StopEntry(
|
||||
results.getString("name"),
|
||||
results.getString("icon")
|
||||
results.getString("icon"),
|
||||
results.getString("world")
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user