Closed mworzala closed 8 months ago
I switched the base immediately because I wanted the ci to run and the PR has to target main for it to run :)
Will there be API for awaiting a resource pack in the configuration phase? Because as of now the server switches back to play as fast as it can without awaiting anything. Theoretically, I think I could block the AsyncPlayerConfigurationEvent until the pack is present, but I think there could be better options implemented.
Will there be API for awaiting a resource pack in the configuration phase? Because as of now the server switches back to play as fast as it can without awaiting anything. Theoretically, I think I could block the AsyncPlayerConfigurationEvent until the pack is present, but I think there could be better options implemented.
This might be especially important because of the velocity proxies shortcomings: PaperMC/Velocity#1164
Will there be API for awaiting a resource pack in the configuration phase? Because as of now the server switches back to play as fast as it can without awaiting anything. Theoretically, I think I could block the AsyncPlayerConfigurationEvent until the pack is present, but I think there could be better options implemented.
That's what I do, here's my code. But I think in any case it’s worth adding a similar API to Minestom
fun Player.setResourcePackAsync(resourcePack: ResourcePack): CompletableFuture<Unit> {
val completableFuture = CompletableFuture<Unit>()
val rpStatusListener = EventListener.builder(PlayerResourcePackStatusEvent::class.java)
.expireWhen {
val status = it.status
if (status != ResourcePackStatus.ACCEPTED && status != ResourcePackStatus.DOWNLOADED) {
completableFuture.complete(Unit)
return@expireWhen true
}
return@expireWhen false
}
.build()
val disconnectListener = EventListener.builder(PlayerDisconnectEvent::class.java).expireWhen {
completableFuture.complete(Unit)
return@expireWhen true
}.build()
eventNode().addListener(rpStatusListener)
eventNode().addListener(disconnectListener)
setResourcePack(resourcePack)
return completableFuture
}
Yeah I agree there should be an api for this.
Expanding on above: Adventure has a resource pack API in Audience now (including a callback api). I will implement this for Player.
Most likely if you want to send a resource pack without waiting you will need to send the rp push packet yourself.
@MelonHell @MenschenToaster as of https://github.com/hollow-cube/minestom-ce/pull/92/commits/489ba514711c3149203fadc4230fae88e0541883, this branch conforms to the Adventure resource pack api.
The remaining tasks before merge that I know of:
Currently based against the 1.20.2 PR, but it's just for comparison. Later I will close that PR and target main.
Closes #83