diff --git a/CHANGELOG.md b/CHANGELOG.md index c10971e..2648851 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,3 @@ -- Some bug fixes + optimizations. -- Added better debug. -- Added new configuration properties. +- Fix ugly error message when the message receiver is offline. + +- Fix startup error when restarting a Javelin server. diff --git a/plugin.json b/plugin.json index 499d73e..b678284 100644 --- a/plugin.json +++ b/plugin.json @@ -3,7 +3,7 @@ "displayName": "Xpdustry Javelin", "author": "Xpdustry", "description": "A plugin for cross server communication.", - "version": "0.2.0", + "version": "0.2.1", "minGameVersion": "v126.2", "hidden": true, "java": true, diff --git a/src/main/kotlin/fr/xpdustry/javelin/JavelinServer.kt b/src/main/kotlin/fr/xpdustry/javelin/JavelinServer.kt index 76ff655..c5ad8f8 100644 --- a/src/main/kotlin/fr/xpdustry/javelin/JavelinServer.kt +++ b/src/main/kotlin/fr/xpdustry/javelin/JavelinServer.kt @@ -41,6 +41,10 @@ private class SimpleJavelinServer @Inject constructor( val AUTHORIZATION_REGEX = Regex("^Bearer .+$") } + init { + isReuseAddr = true + } + private val verifier = JWT.require(algorithm).build() private val gson = GsonBuilder() diff --git a/src/main/kotlin/fr/xpdustry/javelin/whisper/WhisperCommand.kt b/src/main/kotlin/fr/xpdustry/javelin/whisper/WhisperCommand.kt index 18e94c6..460fba4 100644 --- a/src/main/kotlin/fr/xpdustry/javelin/whisper/WhisperCommand.kt +++ b/src/main/kotlin/fr/xpdustry/javelin/whisper/WhisperCommand.kt @@ -55,11 +55,16 @@ class WhisperCommand { private fun ArcCommandSender.whisper(receiver: String, message: String) { val context = WhisperContext(player.name(), receiver, message) replies[player] = receiver - val result = servicePipeline.pump(context).through(typeToken()).result - if (result == State.ACCEPTED) { - player.sendMessage(WhisperFormatter.instance.format(context)) - } else { - sendMessage(clientMessageFormatter.format("The player $receiver can't be found on.", MessageIntent.ERROR)) - } + + servicePipeline + .pump(context) + .through(typeToken()) + .getResult { result, _ -> + if (result == State.ACCEPTED) { + player.sendMessage(WhisperFormatter.instance.format(context)) + } else { + sendMessage(clientMessageFormatter.format("The player $receiver is not online.", MessageIntent.ERROR)) + } + } } }