Events/Connection/minified-events
CheckConnectionEvent
Gets fired when we're checking whether the user is online or not
When it fires
CheckConnectionEvent fires immediately before Minified calls NetworkUtil.ensureOnline(...) internally. You'll see it twice during a typical online launch:
- Once at the very start of
Launcher.launchMinecraft(), before anything else happens. The result decides whether the rest of the launch runs online (Forge/NeoForge installation, live version metadata, downloading the client jar) or falls back to offline mode. - Once inside
ClientDownloader.downloadClient(), right before it tries to download the client JAR. This only runs standalone if you callClientDownloaderdirectly with aLaunchContext.
The connectivity check itself (DNS lookup, a raw TCP probe, and an HTTPS HEAD request) is not part of this event. CheckConnectionEvent only marks that the check is about to happen, which is useful for showing a "Checking connection…" indicator in your UI.
Right after this event, exactly one of two things happens:
- the check succeeds and the launch continues normally, or
- the check fails and
OfflineEventfires instead.
eventBus.subscribe(CheckConnectionEvent.class, event -> {
System.out.println("Checking your connection...");
});eventBus.subscribe(CheckConnectionEvent::class.java) {
println("Checking your connection...")
}Listening
Subscribe on the EventBus the event is posted to, see Events for which bus that is.
eventBus.subscribe(CheckConnectionEvent.class, event -> {
// react to the event
});eventBus.subscribe(CheckConnectionEvent::class.java) { event ->
// react to the event
}Posted by
API reference: com.dervarex.minified.events.type.connection.CheckConnectionEvent