Rewriten how dependency is handled

This commit is contained in:
alexcrea 2024-06-16 12:58:44 +02:00
parent b512d8f732
commit aad9974baf
No known key found for this signature in database
GPG key ID: 43FD265DB0DBF91F
10 changed files with 56 additions and 19 deletions

View file

@ -0,0 +1,29 @@
package xyz.alexcrea.cuanvil.dependency
import org.bukkit.Bukkit
import xyz.alexcrea.cuanvil.dependency.protocolib.NoProtocoLib
import xyz.alexcrea.cuanvil.dependency.protocolib.PacketManager
import xyz.alexcrea.cuanvil.dependency.protocolib.ProtocoLibWrapper
object DependencyManager {
lateinit var packetManager: PacketManager
var enchantmentSquaredCompatibility: EnchantmentSquaredDependency? = null;
fun loadDependency(){
val pluginManager = Bukkit.getPluginManager();
// ProtocolLib dependency
packetManager =
if(pluginManager.isPluginEnabled("ProtocolLib")) ProtocoLibWrapper();
else NoProtocoLib();
// Enchantment Squared dependency
enchantmentSquaredCompatibility =
if(pluginManager.isPluginEnabled("EnchantsSquared")) EnchantmentSquaredDependency()
else null
}
}