chore(java): added glue for version method

This commit is contained in:
zaaarf 2024-09-25 13:14:52 +02:00 committed by alemi.dev
parent 0ffcef360b
commit e0ea884b53
3 changed files with 15 additions and 1 deletions

1
.gitignore vendored
View file

@ -33,3 +33,4 @@ dist/java/bin/
dist/java/gradle/
dist/java/gradlew
dist/java/gradlew.bat
dist/java/.factorypath

View file

@ -12,7 +12,13 @@ public final class Extensions {
static final Cleaner CLEANER = Cleaner.create();
/**
* Hashes the given {@link String} using CodeMP's hashing algorithm (xxh3).
* Returns the version of the Rust crate as a String.
* @return the current version
*/
public static native String version();
/**
* Hashes the given String using CodeMP's hashing algorithm (xxh3).
* @param input the string to hash
* @return the hash
*/

View file

@ -1,5 +1,12 @@
use jni_toolbox::jni;
/// Gets the current version of the Rust crate.
#[allow(non_snake_case)]
#[jni(package = "mp.code", class = "Extensions")]
fn version() -> String {
crate::version()
}
/// Calculate the XXH3 hash for a given String.
#[jni(package = "mp.code", class = "Extensions")]
fn hash(content: String) -> i64 {