Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6f74026514 | ||
|
|
eb77193fbd | ||
|
|
2c65d88c62 | ||
|
|
627205d39a | ||
|
|
3f7796772e |
@@ -9,8 +9,12 @@ It hooks into MobArena's command handler to provide commands for querying and ma
|
||||
|
||||
## Getting Started
|
||||
|
||||
Download a copy of the latest MobArenaStats build and place it in your server's `plugins` folder.
|
||||
You can grab a build from the _Artifacts_ section of the latest run of the [build workflow](https://github.com/mobarena/MobArenaStats/actions/workflows/build.yml) in GitHub Actions, or you can join the MobArena Discord server and grab one from the `#test-builds` channel.
|
||||
Download a copy of MobArenaStats from one of these release channels:
|
||||
|
||||
- Stable (recommended): [Latest release](https://github.com/mobarena/MobArenaStats/releases/latest)
|
||||
- Dev (experimental): [Latest build](https://github.com/mobarena/MobArenaStats/actions/workflows/build.yml)
|
||||
|
||||
Place the jar-file in your server's `plugins` folder like you would any other plugin.
|
||||
|
||||
Start your server and let the plugin load.
|
||||
It will generate a default `config.yml` file and set up a default SQLite data store.
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>org.mobarena</groupId>
|
||||
<artifactId>mobarena-stats</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<version>1.0</version>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
@@ -86,7 +86,7 @@
|
||||
<dependency>
|
||||
<groupId>org.mockito</groupId>
|
||||
<artifactId>mockito-junit-jupiter</artifactId>
|
||||
<version>3.11.2</version>
|
||||
<version>3.12.2</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
@@ -70,8 +70,10 @@ class SchemaMigrator {
|
||||
// (available via the underlying JDBC connection object) to find
|
||||
// out if the schema migrations table exists.
|
||||
Connection connection = handle.getConnection();
|
||||
String catalog = connection.getCatalog();
|
||||
String schema = connection.getSchema();
|
||||
DatabaseMetaData meta = connection.getMetaData();
|
||||
try (ResultSet tables = meta.getTables(null, null, "schema_migrations", null)) {
|
||||
try (ResultSet tables = meta.getTables(catalog, schema, "schema_migrations", null)) {
|
||||
while (tables.next()) {
|
||||
String name = tables.getString("TABLE_NAME");
|
||||
if (name.equals("schema_migrations")) {
|
||||
|
||||
@@ -29,11 +29,11 @@ public class MariadbStatsStore {
|
||||
String host = config.getString("host", "localhost");
|
||||
int port = config.getInt("port", 3306);
|
||||
String database = config.getString("database", "mobarena_stats");
|
||||
boolean ssl = config.getBoolean("ssl", false);
|
||||
String ssl = config.getString("ssl", "");
|
||||
|
||||
String params = "useSSL=" + ssl;
|
||||
String url = "jdbc:mariadb://" + host + ":" + port + "/" + database;
|
||||
|
||||
return "jdbc:mariadb://" + host + ":" + port + "/" + database + "?" + params;
|
||||
return ssl.isEmpty() ? url : url + "?" + ssl;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -27,11 +27,11 @@ public class MysqlStatsStore {
|
||||
String host = config.getString("host", "localhost");
|
||||
int port = config.getInt("port", 3306);
|
||||
String database = config.getString("database", "mobarena_stats");
|
||||
boolean ssl = config.getBoolean("ssl", false);
|
||||
String ssl = config.getString("ssl", "");
|
||||
|
||||
String params = "useSSL=" + ssl;
|
||||
String url = "jdbc:mysql://" + host + ":" + port + "/" + database;
|
||||
|
||||
return "jdbc:mysql://" + host + ":" + port + "/" + database + "?" + params;
|
||||
return ssl.isEmpty() ? url : url + "?" + ssl;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -38,14 +38,15 @@ store:
|
||||
# - database: name of the database (must exist!)
|
||||
# - username: username of a valid database user
|
||||
# - password: password of a valid database user
|
||||
# - ssl: whether to use SSL for database connections
|
||||
# - ssl: extra JDBC connection parameters, appended to the URL as-is
|
||||
# (e.g. 'verifyServerCertificate=false&sslmode=required')
|
||||
#
|
||||
#host: localhost
|
||||
#port: 3306
|
||||
#database: ''
|
||||
#username: ''
|
||||
#password: ''
|
||||
#ssl: false
|
||||
#ssl: ''
|
||||
#--------------------------------------------------------------------
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
|
||||
@@ -16,7 +16,7 @@ class MariadbStatsStoreTest {
|
||||
|
||||
String result = MariadbStatsStore.getUrl(config);
|
||||
|
||||
String expected = "jdbc:mariadb://localhost:3306/mobarena_stats?useSSL=false";
|
||||
String expected = "jdbc:mariadb://localhost:3306/mobarena_stats";
|
||||
assertThat(result, equalTo(expected));
|
||||
}
|
||||
|
||||
@@ -26,11 +26,11 @@ class MariadbStatsStoreTest {
|
||||
config.set("host", "stats.example.com");
|
||||
config.set("port", 1337);
|
||||
config.set("database", "mastats");
|
||||
config.set("ssl", true);
|
||||
config.set("ssl", "verifyServerCertificate=false&sslmode=required");
|
||||
|
||||
String result = MariadbStatsStore.getUrl(config);
|
||||
|
||||
String expected = "jdbc:mariadb://stats.example.com:1337/mastats?useSSL=true";
|
||||
String expected = "jdbc:mariadb://stats.example.com:1337/mastats?verifyServerCertificate=false&sslmode=required";
|
||||
assertThat(result, equalTo(expected));
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ class MysqlStatsStoreTest {
|
||||
|
||||
String result = MysqlStatsStore.getUrl(config);
|
||||
|
||||
String expected = "jdbc:mysql://localhost:3306/mobarena_stats?useSSL=false";
|
||||
String expected = "jdbc:mysql://localhost:3306/mobarena_stats";
|
||||
assertThat(result, equalTo(expected));
|
||||
}
|
||||
|
||||
@@ -26,11 +26,11 @@ class MysqlStatsStoreTest {
|
||||
config.set("host", "stats.example.com");
|
||||
config.set("port", 1337);
|
||||
config.set("database", "mastats");
|
||||
config.set("ssl", true);
|
||||
config.set("ssl", "verifyServerCertificate=false&sslmode=required");
|
||||
|
||||
String result = MysqlStatsStore.getUrl(config);
|
||||
|
||||
String expected = "jdbc:mysql://stats.example.com:1337/mastats?useSSL=true";
|
||||
String expected = "jdbc:mysql://stats.example.com:1337/mastats?verifyServerCertificate=false&sslmode=required";
|
||||
assertThat(result, equalTo(expected));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user