Add XP cost display above 40.

Need ProtocoLib installed.
This commit is contained in:
alexcrea 2024-05-20 17:53:15 +02:00
parent 8cf84caf3c
commit de51617059
No known key found for this signature in database
GPG key ID: 43FD265DB0DBF91F
8 changed files with 119 additions and 16 deletions

View file

@ -8,6 +8,9 @@ import xyz.alexcrea.cuanvil.command.EditConfigExecutor
import xyz.alexcrea.cuanvil.command.ReloadExecutor
import xyz.alexcrea.cuanvil.config.ConfigHolder
import xyz.alexcrea.cuanvil.listener.ChatEventListener
import xyz.alexcrea.cuanvil.packet.NoProtocoLib
import xyz.alexcrea.cuanvil.packet.PacketManager
import xyz.alexcrea.cuanvil.packet.ProtocoLibWrapper
import xyz.alexcrea.cuanvil.util.Metrics
import xyz.alexcrea.cuanvil.util.MetricsUtil
import java.io.File
@ -66,14 +69,20 @@ class CustomAnvil : JavaPlugin() {
instance.logger.info(message)
}
}
}
lateinit var packetManager: PacketManager
/**
* Setup plugin for use
*/
override fun onEnable() {
instance = this
val pluginManager = Bukkit.getPluginManager();
// Disable old plugin name if exist
val potentialPlugin = Bukkit.getPluginManager().getPlugin("UnsafeEnchantsPlus")
if (potentialPlugin != null) {
@ -82,9 +91,15 @@ class CustomAnvil : JavaPlugin() {
logger.warning("Please note CustomAnvil is a more recent version of UnsafeEnchantsPlus")
}
// Load ProtocolLib dependency if exist
packetManager = if(pluginManager.isPluginEnabled("ProtocolLib"))
{ ProtocoLibWrapper(); }
else
{ NoProtocoLib(); }
// Load chat listener
chatListener = ChatEventListener()
Bukkit.getPluginManager().registerEvents(chatListener, this)
pluginManager.registerEvents(chatListener, this)
// Load config
val success = ConfigHolder.loadConfig()
@ -98,7 +113,7 @@ class CustomAnvil : JavaPlugin() {
prepareCommand()
server.pluginManager.registerEvents(
AnvilEventListener(),
AnvilEventListener(packetManager),
this
)
}