Skip to content
This repository was archived by the owner on Dec 10, 2025. It is now read-only.

Commit 1fde975

Browse files
committed
feat: enhance bootstrap process with loader checks and support for folia
1 parent 1cd82f9 commit 1fde975

File tree

5 files changed

+21
-2
lines changed

5 files changed

+21
-2
lines changed

.idea/misc.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

surf-cloud-bukkit/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ surfPaperPluginApi {
1111
bootstrapper("dev.slne.surf.cloud.bukkit.PaperBootstrap")
1212
authors.add("twisti")
1313
generateLibraryLoader(false)
14+
foliaSupported(true)
1415

1516
serverDependencies {
1617
registerRequired("LuckPerms")

surf-cloud-bukkit/src/main/kotlin/dev/slne/surf/cloud/bukkit/PaperBootstrap.kt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import dev.slne.surf.cloud.core.common.handleEventuallyFatalError
66
import io.papermc.paper.plugin.bootstrap.BootstrapContext
77
import io.papermc.paper.plugin.bootstrap.PluginBootstrap
88
import io.papermc.paper.plugin.bootstrap.PluginProviderContext
9+
import io.papermc.paper.plugin.provider.classloader.ConfiguredPluginClassLoader
910
import kotlinx.coroutines.runBlocking
1011
import org.bukkit.plugin.java.JavaPlugin
1112
import kotlin.system.exitProcess
@@ -14,6 +15,15 @@ import kotlin.system.exitProcess
1415
class PaperBootstrap : PluginBootstrap {
1516

1617
override fun bootstrap(context: BootstrapContext): Unit = runBlocking {
18+
val loader = net.kyori.adventure.nbt.CompoundBinaryTag::class.java.getClassLoader()
19+
context.logger.info("Cloud sees CBTN from: $loader")
20+
21+
if (loader is ConfiguredPluginClassLoader) {
22+
context.logger.info("CBTN is loaded by ConfiguredPluginClassLoader, all is good: ${loader.configuration.name}")
23+
} else {
24+
context.logger.warn("CBTN is NOT loaded by ConfiguredPluginClassLoader, things may go wrong!")
25+
}
26+
1727
try {
1828
coreCloudInstance.bootstrap(
1929
BootstrapData(

surf-cloud-bukkit/src/main/kotlin/dev/slne/surf/cloud/bukkit/PaperMain.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import kotlin.contracts.contract
2626

2727
class PaperMain : SuspendingJavaPlugin() {
2828
override suspend fun onLoadAsync() {
29+
2930
try {
3031
coreCloudInstance.onLoad()
3132
} catch (t: Throwable) {
@@ -34,6 +35,7 @@ class PaperMain : SuspendingJavaPlugin() {
3435
}
3536

3637
override suspend fun onEnableAsync() {
38+
3739
try {
3840
coreCloudInstance.onEnable()
3941
} catch (t: Throwable) {

surf-cloud-bukkit/src/main/kotlin/dev/slne/surf/cloud/bukkit/netty/network/BukkitSpecificPacketListenerExtension.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,19 @@ import kotlinx.coroutines.future.await
2525
import net.kyori.adventure.text.Component
2626
import org.bukkit.Bukkit
2727
import java.net.InetSocketAddress
28+
import java.net.URI
2829
import java.util.*
2930
import org.springframework.stereotype.Component as SpringComponent
3031

3132
@SpringComponent
3233
class BukkitSpecificPacketListenerExtension : PlatformSpecificPacketListenerExtension {
3334
@OptIn(NmsUseWithCaution::class)
34-
override val playAddress: InetSocketAddress by lazy { nmsCommonBridge.getServerIp() }
35+
override val playAddress: InetSocketAddress by lazy {
36+
InetSocketAddress.createUnresolved(
37+
URI("https://checkip.amazonaws.com").toURL().readText().trim(),
38+
server.port
39+
)
40+
}
3541

3642
override fun isServerManagedByThisProxy(address: InetSocketAddress): Boolean {
3743
error("Requested wrong server! This packet can only be acknowledged on a proxy!")

0 commit comments

Comments
 (0)