How to initialize? - OceJlot/PacketUxUi GitHub Wiki
Let's start by adding UxUi and PacketEvents to your project.
Gradle groovy DSL
repositories {
maven {'https://repo.papermc.io/repository/maven-public/'}
maven {'https://repo.codemc.io/repository/maven-releases/'}
maven { url 'TODO' }
}
dependencies {
compileOnly 'io.papermc.paper:paper-api:VERSION'
compileOnly 'com.github.retrooper:packetevents-spigot:VERSION'
implementation 'TODO'
}
or kotlin DSL
repositories {
maven("https://repo.papermc.io/repository/maven-public/")
maven("https://repo.codemc.io/repository/maven-releases/")
maven ("TODO")
}
dependencies {
compileOnly ("io.papermc.paper:paper-api:VERSION")
compileOnly ("com.github.retrooper:packetevents-spigot:VERSION")
implementation ("TODO")
}
Also use compileOnly
if you have included it as a plugin.
How to init with Kotlin?
For kotlin projects:
override fun onLoad() {
PacketEvents.setAPI(SpigotPacketEventsBuilder.build(this)) //Set api for packetevents
}
override fun onEnable() {
PacketUxUiAPI.init()
val menuService = PacketUxUiAPI.getService()
}
Or if you wanna init packetevents by yourself:
override fun onLoad() {
PacketEvents.setAPI(SpigotPacketEventsBuilder.build(this)) //Set api for packetevents
PacketEvents.getAPI().load
}
override fun onEnable() {
PacketEvents.getAPI().init
PacketUxUiAPI.init()
val menuService = PacketUxUiAPI.getService()
}
menuService is a kind of manager for working with menus, opening them to players, etc.