fix test issue

This commit is contained in:
alexcrea 2026-07-11 13:56:29 +02:00
parent ae28c64647
commit 52a58acd28
Signed by: alexcrea
GPG key ID: E59DF23EE2A2266C
5 changed files with 6 additions and 3 deletions

View file

@ -204,7 +204,8 @@ open class CustomAnvil : JavaPlugin() {
private fun legacyCheck() {
val currentVersion = UpdateUtils.currentMinecraftVersion()
if (currentVersion.greaterEqual(Version(1, 21, 0))) {
if (currentVersion.greaterEqual(Version(1, 21, 0))
&& !DependencyManager.inTesting) {
logger.warning("You are running a Minecraft version above or equal to 1.21.0")
logger.warning("Please use CustomAnvil v2 instead if you wish to use the plugin with this version.")
Bukkit.getPluginManager().disablePlugin(this)

View file

@ -42,6 +42,8 @@ object DependencyManager {
lateinit var packetManager: PacketManager
var externGuiTester: GenericExternGuiTester = GenericExternGuiTester()
val inTesting = externGuiTester.isInTest()
var enchantmentSquaredCompatibility: EnchantmentSquaredDependency? = null
var ecoEnchantCompatibility: EcoEnchantDependency? = null
var excellentEnchantsCompatibility: ExcellentEnchantsDependency? = null

View file

@ -12,7 +12,7 @@ object PacketManagerSelector {
fun selectPacketManager(forceProtocolib: Boolean): PacketManager {
// Try to find version
if(DependencyManager.externGuiTester.isInTest())
if(DependencyManager.inTesting)
return NoPacketManager()
return if (forceProtocolib)

View file

@ -18,7 +18,7 @@ object MetricsUtil {
private var FAST_STATS_METRICS: BukkitContext? = null
fun loadMetrics(plugin: CustomAnvil) {
if(DependencyManager.externGuiTester.isInTest()) return
if(DependencyManager.inTesting) return
val config = ConfigHolder.DEFAULT_CONFIG.config
val metricString = config.getString(ConfigOptions.METRIC_TYPE, MetricType.AUTO.value)!!