small utility I forgot

This commit is contained in:
alexcrea 2025-07-04 13:38:22 +02:00
parent a8ac725ce1
commit bd17d55346
2 changed files with 10 additions and 1 deletions

View file

@ -2,6 +2,7 @@ package xyz.alexcrea.cuanvil.dependency.datapack
import io.papermc.paper.datapack.Datapack import io.papermc.paper.datapack.Datapack
import org.bukkit.Bukkit import org.bukkit.Bukkit
import org.bukkit.packs.DataPack
import java.util.* import java.util.*
object DataPackTester { object DataPackTester {
@ -21,6 +22,13 @@ object DataPackTester {
.stream().map { obj: Datapack -> obj.name } .stream().map { obj: Datapack -> obj.name }
.toList() .toList()
} catch (e: NoSuchMethodException) { } catch (e: NoSuchMethodException) {
try {
DataPack::class.java.getDeclaredMethod("getKey")
} catch (e: NoSuchMethodException) {
System.err.println("Could not find compatible datapack manager")
System.err.println("If you are using a datapack that should be compatible with CustomAnvil. It will not get detected...")
return emptyList()
}
return legacyNames return legacyNames
} catch (e: Exception){ } catch (e: Exception){
// Assume cause UnimplementedOperationException on mock server // Assume cause UnimplementedOperationException on mock server

View file

@ -23,7 +23,8 @@ object DataPackDependency {
* Map of the latest CustomAnvil update related to the pack * Map of the latest CustomAnvil update related to the pack
*/ */
private val LASTEST_VERSION = mapOf( private val LASTEST_VERSION = mapOf(
Pair("bracken", Version(1, 11, 0)) Pair("bracken", Version(1, 11, 0)),
Pair("neoenchant", Version(1, 13, 0))
) )
val enabledDatapacks: List<String> val enabledDatapacks: List<String>