mirror of
https://github.com/2006-Scape/2006Scape.git
synced 2026-12-06 19:01:23 +00:00
- Remove synchronous website integration execution from the GameEngine 600ms tick loop - Decouple website credentials and toggles from ConfigLoader, secrets.json, and Constants.WEBSITE_INTEGRATION - Introduce modular "website" configuration group with independent toggles for players_online and registered_accounts - Consolidate background tasks onto a single daemon ScheduledExecutorService with graceful lifecycle management via ServerStartupEvent and ServerShutdownEvent - Optimize character directory counting with Java NIO streaming to prevent heap allocations - Add UTF-8 URL encoding, User-Agent headers, safe stream handling, and network exception throttling
27 lines
1022 B
Kotlin
27 lines
1022 B
Kotlin
package plugin.integration.website
|
|
|
|
import com.rs2.event.EventContext
|
|
import com.rs2.event.EventSubscriber
|
|
import com.rs2.event.SubscribesTo
|
|
import com.rs2.event.impl.ServerConfigEvent
|
|
import com.rs2.game.players.Player
|
|
|
|
@SubscribesTo(ServerConfigEvent::class)
|
|
class WebsiteConfig : EventSubscriber<ServerConfigEvent> {
|
|
|
|
companion object {
|
|
var password: String = ""
|
|
var playersOnline: Boolean = false
|
|
var registeredAccounts: Boolean = false
|
|
}
|
|
|
|
override fun subscribe(context: EventContext, player: Player?, event: ServerConfigEvent) {
|
|
val legacyMaster = event.getBoolean("website_integration", false)
|
|
event.group("website") { g ->
|
|
g.registerString("password", password, "websitepass") { password = it }
|
|
g.registerBoolean("players_online", legacyMaster, "website_players_online") { playersOnline = it }
|
|
g.registerBoolean("registered_accounts", legacyMaster, "website_registered_accounts") { registeredAccounts = it }
|
|
}
|
|
}
|
|
}
|