Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
154 changes: 144 additions & 10 deletions .github/workflows/run-tests.yaml
Original file line number Diff line number Diff line change
@@ -1,21 +1,155 @@
name: Maven Tests
name: Build

on: [push, pull_request]
on:
push:
pull_request:
workflow_dispatch:

jobs:
build:
name: Build BetterRTP and Addons
runs-on: ubuntu-latest
timeout-minutes: 30

steps:
- uses: actions/checkout@v2
- name: Checkout
uses: actions/checkout@v4

- name: Set up JDK 17
uses: actions/setup-java@v1
- name: Set up JDK 25
uses: actions/setup-java@v4
with:
java-version: 17
distribution: temurin
java-version: '25'
cache: maven

- name: Configure Maven settings
run: cp settings.xml $HOME/.m2/settings.xml
- name: Build and install BetterRTP
run: mvn -B -DskipTests install

- name: Build and test with Maven
run: mvn test
- name: Smoke test on Folia 26.1.2 build 8
shell: bash
run: |
set -euo pipefail

server_dir="$RUNNER_TEMP/folia-smoke"
mkdir -p "$server_dir/plugins" "$server_dir/cache"

curl --fail --location --retry 5 --retry-all-errors \
--output "$server_dir/folia.jar" \
"https://fill-data.papermc.io/v1/objects/607afd1c3320008e1ffd2eaee6780ace4419d5f8c527b75e79f259be79ebf57b/folia-26.1.2-8.jar"
echo "607afd1c3320008e1ffd2eaee6780ace4419d5f8c527b75e79f259be79ebf57b $server_dir/folia.jar" | sha256sum --check

curl --fail --location --retry 5 --retry-all-errors \
--output "$server_dir/cache/mojang_26.1.2.jar" \
"https://piston-data.mojang.com/v1/objects/97ccd4c0ed3f81bbb7bfacddd1090b0c56f9bc51/server.jar"
echo "cd47e7c38328f64768fd17af8fcd8b22496b40b63d4ffee81e71ae059fedcb42 $server_dir/cache/mojang_26.1.2.jar" | sha256sum --check

cp target/BetterRTP-*.jar "$server_dir/plugins/BetterRTP.jar"
printf 'eula=true\n' > "$server_dir/eula.txt"
printf '%s\n' \
'allow-nether=false' \
'enable-query=false' \
'enable-rcon=false' \
'enable-status=false' \
'generate-structures=false' \
'level-name=world' \
'online-mode=false' \
'server-ip=127.0.0.1' \
'server-port=25585' \
'simulation-distance=2' \
'spawn-protection=0' \
'view-distance=2' > "$server_dir/server.properties"

SERVER_DIR="$server_dir" python3 - <<'PY'
import os
import subprocess
import sys
import threading

server_dir = os.environ["SERVER_DIR"]
process = subprocess.Popen(
["java", "-Xms1G", "-Xmx1G", "-jar", "folia.jar", "--nogui"],
cwd=server_dir,
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
text=True,
bufsize=1,
)

output = []
commands_sent = False
timed_out = False

def stop_server():
if process.poll() is None:
process.stdin.write("stop\n")
process.stdin.flush()

def run_checks():
if process.poll() is None:
process.stdin.write("version\nplugins\nbrtp version\nbrtp info\n")
process.stdin.flush()
threading.Timer(5, stop_server).start()

def abort_server():
global timed_out
timed_out = True
if process.poll() is None:
process.kill()

timeout = threading.Timer(180, abort_server)
timeout.start()

for line in process.stdout:
print(line, end="")
output.append(line)
if not commands_sent and "Done (" in line:
commands_sent = True
# Folia 26.1.2 logs Done just before its console command source
# has a world. Give that source one global tick to settle.
threading.Timer(2, run_checks).start()

return_code = process.wait()
timeout.cancel()
log = "".join(output)

required = (
"Loading Folia 26.1.2-8-",
"Enabling BetterRTP v",
"[BetterRTP] Version #",
"----- BetterRTP | Info -----",
)
missing = [entry for entry in required if entry not in log]
forbidden = (
"Could not load 'plugins/BetterRTP.jar'",
"Error occurred while enabling BetterRTP",
"Thread ownership",
)
found = [entry for entry in forbidden if entry in log]

if timed_out or return_code != 0 or missing or found:
print(
f"Smoke test failed: timed_out={timed_out}, return_code={return_code}, "
f"missing={missing}, forbidden={found}",
file=sys.stderr,
)
sys.exit(1)
PY

- name: Build BetterRTPAddons
run: mvn -B -DskipTests package
working-directory: BetterRTPAddons

- name: Upload BetterRTP artifact
uses: actions/upload-artifact@v4
with:
name: BetterRTP
path: target/BetterRTP-*.jar
if-no-files-found: error

- name: Upload BetterRTPAddons artifact
uses: actions/upload-artifact@v4
with:
name: BetterRTPAddons
path: BetterRTPAddons/target/BetterRTPAddons-*.jar
if-no-files-found: error
4 changes: 3 additions & 1 deletion BetterRTPAddons/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ feel free to fork one of the language files and help translate!
## Libraries
BetterRTPAddons uses and is compiled with the following libraries:

- [PaperLib](https://github.com/PaperMC/PaperLib) (included) - Library for interfacing with PaperMC specific APIs, used for async chunk loading.
- [Folia API](https://github.com/PaperMC/Folia) (provided) - Modern Folia server API target for scheduler and teleport compatibility.

Builds targeting Folia 26.1.2+ require Java 25 or newer.

## Where's the Wiki?
The wiki is available [here](../../../wiki)!
Expand Down
109 changes: 48 additions & 61 deletions BetterRTPAddons/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,29 @@
<version>1.8.10</version>

<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.release>25</maven.compiler.release>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<profiles>
<profile>
<id>dev</id>
<build>
<plugins>
<plugin>
<!-- Local Server Building -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<outputDirectory>../../../Java/plugins</outputDirectory>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>

<build>
<resources>
<resource>
Expand All @@ -23,45 +42,22 @@
</resources>
<finalName>${project.artifactId}-${project.version}</finalName>
<plugins>
<plugin>
<!-- Shade PaperLib into project -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.1.1</version>
<configuration>
<dependencyReducedPomLocation>${project.build.directory}/dependency-reduced-pom.xml</dependencyReducedPomLocation>
<relocations>
<relocation>
<pattern>io.papermc.lib</pattern>
<shadedPattern>me.SuperRonanCraft.BetterRTPAddons.paperlib</shadedPattern>
</relocation>
</relocations>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<!-- Local Server Building -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<outputDirectory>../../../Java/plugins</outputDirectory>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<version>3.14.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<source>25</source>
<target>25</target>
<release>25</release>
<proc>full</proc>
<annotationProcessorPaths>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.38</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
</plugins>
Expand All @@ -75,61 +71,52 @@
<!-- PaperMC Repo -->
<repository>
<id>papermc</id>
<url>https://papermc.io/repo/repository/maven-public/</url>
<url>https://repo.papermc.io/repository/maven-public/</url>
</repository>
<!-- ProtocolLib Repo -->
<repository>
<id>dmulloy2-repo</id>
<url>https://repo.dmulloy2.net/nexus/repository/public/</url>
</repository>
<repository>
<id>minecodes-repository-releases</id>
<name>mineCodes Organization Repository</name>
<url>https://repository.minecodes.pl/releases</url>
</repository>
</repositories>
<dependencies>
<!--Spigot API-->
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.13.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<!-- Spigot Stuff -->
<!-- Folia API -->
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.8.8-R0.1-SNAPSHOT</version>
<groupId>dev.folia</groupId>
<artifactId>folia-api</artifactId>
<version>26.1.2.build.8-stable</version>
<scope>provided</scope>
</dependency>
<!-- Paper Library for Async Chunk/Teleport -->
<dependency>
<groupId>io.papermc</groupId>
<artifactId>paperlib</artifactId>
<version>1.0.5</version>
<scope>compile</scope>
</dependency>
<!-- BetterRTP -->
<dependency>
<groupId>me.SuperRonanCraft</groupId>
<artifactId>BetterRTP</artifactId>
<version>LATEST</version>
<version>3.6.13</version>
<scope>provided</scope>
</dependency>
<!-- ProtocolLib -->
<dependency>
<groupId>com.comphenix.protocol</groupId>
<artifactId>ProtocolLib</artifactId>
<version>4.5.0</version>
<version>5.3.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.22</version>
<version>1.18.38</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
<version>19.0.0</version>
<scope>compile</scope>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
</project>
Loading