Compare commits
8
Commits
f07df6a556
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
81ff63a38d | ||
|
|
3e65b02d72 | ||
|
|
f8ba0e4efc | ||
|
|
6f74026514 | ||
|
|
eb77193fbd | ||
|
|
2c65d88c62 | ||
|
|
627205d39a | ||
|
|
3f7796772e |
@@ -15,19 +15,23 @@ jobs:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Cache dependencies
|
||||
uses: actions/cache@v2
|
||||
- name: Set up JDK
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
path: ~/.m2/repository
|
||||
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-maven-
|
||||
distribution: temurin
|
||||
java-version: '25'
|
||||
|
||||
- name: Checkout MobArena
|
||||
run: git clone --depth 1 https://git.tss3.us/skywalker3200/MobArena.git ../MobArena
|
||||
|
||||
- name: Publish MobArena to local Maven repo
|
||||
run: cd ../MobArena && ./gradlew publishToMavenLocal --no-daemon
|
||||
|
||||
- name: Build, test, package
|
||||
run: ./mvnw -B package --file pom.xml
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v2
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: MobArenaStats.jar
|
||||
path: target/MobArenaStats.jar
|
||||
|
||||
@@ -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>
|
||||
@@ -34,19 +34,19 @@
|
||||
<version>2.2.1</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://hub.spigotmc.org/nexus/content/groups/public/org/spigotmc/spigot-api/ -->
|
||||
<!-- https://repo.papermc.io/repository/maven-public/io/papermc/paper/paper-api/ -->
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.17-R0.1-SNAPSHOT</version>
|
||||
<groupId>io.papermc.paper</groupId>
|
||||
<artifactId>paper-api</artifactId>
|
||||
<version>26.2.build.84-stable</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- https://jitpack.io/#garbagemule/MobArena -->
|
||||
<!-- Built and installed locally from F:\skywalker3200\MobArena via `./gradlew publishToMavenLocal` -->
|
||||
<dependency>
|
||||
<groupId>com.github.garbagemule</groupId>
|
||||
<groupId>com.garbagemule</groupId>
|
||||
<artifactId>MobArena</artifactId>
|
||||
<version>b99713f1</version>
|
||||
<version>0.109.1-tss3</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -133,13 +133,8 @@
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>spigot-repo</id>
|
||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||
</repository>
|
||||
|
||||
<repository>
|
||||
<id>jitpack.io</id>
|
||||
<url>https://jitpack.io</url>
|
||||
<id>papermc</id>
|
||||
<url>https://repo.papermc.io/repository/maven-public/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
@@ -157,8 +152,7 @@
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<configuration>
|
||||
<source>11</source>
|
||||
<target>11</target>
|
||||
<release>25</release>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
@@ -171,7 +165,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.2.4</version>
|
||||
<version>3.6.2</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
#----------------------------------------------------------------------
|
||||
# The store is where all the collected data is kept. Different store
|
||||
# types are supported:
|
||||
#
|
||||
# - sqlite: stores stats in an SQLite database
|
||||
# - mysql: stores stats in a MySQL/MariaDB database
|
||||
# - csv: stores stats in local CSV files
|
||||
#
|
||||
# Stores may require configuration of additional properties, such as
|
||||
# file paths or database credentials.
|
||||
#----------------------------------------------------------------------
|
||||
store:
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Which type of store to use.
|
||||
#
|
||||
# Changing this value will _not_ result in an automatic conversion
|
||||
# of existing store data. To transfer data to a different store,
|
||||
# make an export of the current store first, then change type and
|
||||
# import the exported data.
|
||||
#
|
||||
type: mysql
|
||||
#--------------------------------------------------------------------
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# SQLite store properties
|
||||
#
|
||||
# - filename: name of the database file, relative to plugin folder
|
||||
#
|
||||
#filename: stats.db
|
||||
#--------------------------------------------------------------------
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# MySQL/MariaDB store properties
|
||||
#
|
||||
# - host: where the database instance is hosted
|
||||
# - port: database port number
|
||||
# - database: name of the database (must exist!)
|
||||
# - username: username of a valid database user
|
||||
# - password: password of a valid database user
|
||||
# - flags: extra JDBC connection parameters, appended to the URL as-is
|
||||
# (e.g. 'verifyServerCertificate=false&sslmode=required').
|
||||
# Leave blank/omit to append no extra parameters.
|
||||
#
|
||||
host: localhost
|
||||
port: 3306
|
||||
database: mobarena_stats
|
||||
username: mobarena
|
||||
password: 'change-me'
|
||||
flags: 'verifyServerCertificate=false&sslmode=required'
|
||||
#--------------------------------------------------------------------
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# CSV store properties
|
||||
#
|
||||
# - folder: where to store data files, relative to plugin folder
|
||||
# - separator: symbol to separate fields and values with
|
||||
#
|
||||
#folder: data
|
||||
#separator: ';'
|
||||
#--------------------------------------------------------------------
|
||||
@@ -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 flags = config.getString("flags", "");
|
||||
|
||||
String params = "useSSL=" + ssl;
|
||||
String url = "jdbc:mariadb://" + host + ":" + port + "/" + database;
|
||||
|
||||
return "jdbc:mariadb://" + host + ":" + port + "/" + database + "?" + params;
|
||||
return flags.isEmpty() ? url : url + "?" + flags;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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 flags = config.getString("flags", "");
|
||||
|
||||
String params = "useSSL=" + ssl;
|
||||
String url = "jdbc:mysql://" + host + ":" + port + "/" + database;
|
||||
|
||||
return "jdbc:mysql://" + host + ":" + port + "/" + database + "?" + params;
|
||||
return flags.isEmpty() ? url : url + "?" + flags;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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
|
||||
# - flags: 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
|
||||
#flags: ''
|
||||
#--------------------------------------------------------------------
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
|
||||
@@ -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("flags", "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("flags", "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