Thanks, Labo!
I know how to export extension file in Java.
But when I do the same in Kotlin, I cannot add this extension to zone in server beccause I could not find out Main class
There are what I do:
1. Create Kotlin project and Write an extension class:
Code: Select all
import com.smartfoxserver.v2.core.ISFSEvent
import com.smartfoxserver.v2.core.SFSEventType
import com.smartfoxserver.v2.extensions.BaseServerEventHandler
import com.smartfoxserver.v2.extensions.SFSExtension
class EventHandler : BaseServerEventHandler()
{
override fun handleServerEvent(event: ISFSEvent?)
{
trace("Event received >> " + event?.type)
}
}
class KotlinEclipseExtension : SFSExtension()
{
override fun init()
{
trace("Kotlin Extension running in Zone: " + parentZone.toString())
// Add server event handler
addEventHandler(SFSEventType.SERVER_READY, EventHandler())
}
override fun destroy()
{
super.destroy()
trace("Extension shutting down");
}
}
2. Export to jar file which name: "KotlinEclipseExtension.jar" and put to extension folder
3. Open the admin side and add a zone. But could not find extension name and Main class
By another way, when Export I include the "kotlin_bin" folder
Then I can find "extension name" and "Main class". I can Submit this new zone but it cannot start
Reach this error when start server
Sorry if this post too long.