aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/moe/nea/notenoughupdates/NotEnoughUpdates.kt
diff options
context:
space:
mode:
authornea <romangraef@gmail.com>2022-08-26 01:08:13 +0200
committernea <romangraef@gmail.com>2022-08-26 01:08:13 +0200
commit4c7bd601c4df4d03536e97e18e4b88d858330ad9 (patch)
tree328a90e5fc5a524b1c2cbba6dac60498ee2b8210 /src/main/kotlin/moe/nea/notenoughupdates/NotEnoughUpdates.kt
parent9245c261f11f907b3dd23379d81f5b9f65e6e9bb (diff)
downloadFirmament-4c7bd601c4df4d03536e97e18e4b88d858330ad9.tar.gz
Firmament-4c7bd601c4df4d03536e97e18e4b88d858330ad9.tar.bz2
Firmament-4c7bd601c4df4d03536e97e18e4b88d858330ad9.zip
Translations and DBUS???? for some reason. also make the whole thing not buildable for anyone aside from me lol
Diffstat (limited to 'src/main/kotlin/moe/nea/notenoughupdates/NotEnoughUpdates.kt')
-rw-r--r--src/main/kotlin/moe/nea/notenoughupdates/NotEnoughUpdates.kt8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/main/kotlin/moe/nea/notenoughupdates/NotEnoughUpdates.kt b/src/main/kotlin/moe/nea/notenoughupdates/NotEnoughUpdates.kt
index bede38a..125bc86 100644
--- a/src/main/kotlin/moe/nea/notenoughupdates/NotEnoughUpdates.kt
+++ b/src/main/kotlin/moe/nea/notenoughupdates/NotEnoughUpdates.kt
@@ -9,6 +9,7 @@ import io.ktor.client.plugins.contentnegotiation.*
import io.ktor.serialization.kotlinx.json.*
import kotlinx.coroutines.*
import kotlinx.serialization.json.Json
+import moe.nea.notenoughupdates.dbus.NEUDbusObject
import moe.nea.notenoughupdates.gui.repoGui
import moe.nea.notenoughupdates.repo.RepoManager
import moe.nea.notenoughupdates.util.ConfigHolder
@@ -25,6 +26,7 @@ import net.fabricmc.loader.api.metadata.ModMetadata
import net.minecraft.commands.CommandBuildContext
import net.minecraft.network.chat.Component
import org.apache.logging.log4j.LogManager
+import org.freedesktop.dbus.connections.impl.DBusConnectionBuilder
import java.nio.file.Files
import java.nio.file.Path
import kotlin.coroutines.EmptyCoroutineContext
@@ -57,6 +59,8 @@ object NotEnoughUpdates : ModInitializer, ClientModInitializer {
}
val globalJob = Job()
+ val dbusConnection = DBusConnectionBuilder.forSessionBus()
+ .build()
val coroutineScope =
CoroutineScope(EmptyCoroutineContext + CoroutineName("NotEnoughUpdates")) + SupervisorJob(globalJob)
val coroutineScopeIo = coroutineScope + Dispatchers.IO + SupervisorJob(globalJob)
@@ -73,7 +77,7 @@ object NotEnoughUpdates : ModInitializer, ClientModInitializer {
Command.SINGLE_SUCCESS
})
.executes {
- it.source.sendFeedback(Component.literal("Reloading repository from disk. This may lag a bit."))
+ it.source.sendFeedback(Component.translatable("notenoughupdates.repo.reload.disk"))
RepoManager.reload()
Command.SINGLE_SUCCESS
})
@@ -87,6 +91,8 @@ object NotEnoughUpdates : ModInitializer, ClientModInitializer {
}
override fun onInitialize() {
+ dbusConnection.requestBusName("moe.nea.notenoughupdates")
+ dbusConnection.exportObject(NEUDbusObject)
RepoManager.initialize()
ConfigHolder.registerEvents()
ClientCommandRegistrationCallback.EVENT.register(this::registerCommands)