chore: bump to 1.20.2
ci/woodpecker/push/jfmod Pipeline was successful
Details
ci/woodpecker/push/jfmod Pipeline was successful
Details
This commit is contained in:
parent
e04cfaaf93
commit
88d44b6737
|
@ -5,12 +5,12 @@ plugins {
|
|||
allprojects { group = "io.gitlab.jfronny" }
|
||||
base.archivesName = "google-chat"
|
||||
|
||||
val fabricVersion = "0.83.0+1.20"
|
||||
val fabricVersion = "0.89.1+1.20.2"
|
||||
jfMod {
|
||||
minecraftVersion = "1.20.1"
|
||||
yarn("build.9")
|
||||
loaderVersion = "0.14.21"
|
||||
libJfVersion = "3.10.2"
|
||||
minecraftVersion = "1.20.2"
|
||||
yarn("build.1")
|
||||
loaderVersion = "0.14.22"
|
||||
libJfVersion = "3.13.1"
|
||||
|
||||
modrinth {
|
||||
projectId = "google-chat"
|
||||
|
@ -25,12 +25,12 @@ jfMod {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
modImplementation("io.gitlab.jfronny.libjf:libjf-config-core-v1:${jfMod.libJfVersion.get()}")
|
||||
modImplementation("io.gitlab.jfronny.libjf:libjf-config-core-v2:${jfMod.libJfVersion.get()}")
|
||||
modImplementation("io.gitlab.jfronny.libjf:libjf-translate-v1:${jfMod.libJfVersion.get()}")
|
||||
include(modImplementation(fabricApi.module("fabric-message-api-v1", fabricVersion))!!)
|
||||
|
||||
// Dev env
|
||||
modLocalRuntime("io.gitlab.jfronny.libjf:libjf-config-ui-tiny-v1:${jfMod.libJfVersion.get()}")
|
||||
modLocalRuntime("io.gitlab.jfronny.libjf:libjf-config-ui-tiny:${jfMod.libJfVersion.get()}")
|
||||
modLocalRuntime("io.gitlab.jfronny.libjf:libjf-devutil:${jfMod.libJfVersion.get()}")
|
||||
modLocalRuntime("com.terraformersmc:modmenu:7.1.0")
|
||||
modLocalRuntime("com.terraformersmc:modmenu:8.0.0-beta.2")
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package io.gitlab.jfronny.googlechat;
|
||||
|
||||
import io.gitlab.jfronny.commons.cache.FixedSizeMap;
|
||||
import io.gitlab.jfronny.commons.log.Logger;
|
||||
import io.gitlab.jfronny.commons.io.cache.FixedSizeMap;
|
||||
import io.gitlab.jfronny.commons.logging.Logger;
|
||||
import io.gitlab.jfronny.libjf.translate.api.Language;
|
||||
import io.gitlab.jfronny.libjf.translate.api.TranslateService;
|
||||
import net.fabricmc.api.EnvType;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package io.gitlab.jfronny.googlechat;
|
||||
|
||||
import io.gitlab.jfronny.commons.serialize.gson.api.v1.Ignore;
|
||||
import io.gitlab.jfronny.libjf.config.api.v1.*;
|
||||
import io.gitlab.jfronny.libjf.config.api.v1.dsl.ConfigBuilder;
|
||||
import io.gitlab.jfronny.commons.serialize.gson.api.v2.Ignore;
|
||||
import io.gitlab.jfronny.libjf.config.api.v2.*;
|
||||
import io.gitlab.jfronny.libjf.config.api.v2.dsl.ConfigBuilder;
|
||||
import net.fabricmc.api.*;
|
||||
import net.fabricmc.loader.api.*;
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package io.gitlab.jfronny.googlechat.server;
|
||||
|
||||
import io.gitlab.jfronny.googlechat.GoogleChatConfig;
|
||||
import io.gitlab.jfronny.googlechat.TranslationDirection;
|
||||
import io.gitlab.jfronny.googlechat.*;
|
||||
import net.fabricmc.api.DedicatedServerModInitializer;
|
||||
import net.fabricmc.fabric.api.event.Event;
|
||||
import net.fabricmc.fabric.api.message.v1.ServerMessageDecoratorEvent;
|
||||
|
@ -11,6 +10,7 @@ import net.minecraft.text.Text;
|
|||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
public class GoogleChatServer implements DedicatedServerModInitializer, MessageDecorator {
|
||||
@Override
|
||||
|
@ -22,12 +22,23 @@ public class GoogleChatServer implements DedicatedServerModInitializer, MessageD
|
|||
}
|
||||
|
||||
@Override
|
||||
public CompletableFuture<Text> decorate(@Nullable ServerPlayerEntity sender, Text original) {
|
||||
final CompletableFuture<Text> future = CompletableFuture.completedFuture(original);
|
||||
if (!GoogleChatConfig.General.enabled) return future;
|
||||
return GoogleChatConfig.Advanced.async
|
||||
? decorate(sender, new TranslatableContainer.Async(future)).text()
|
||||
: CompletableFuture.completedFuture(decorate(sender, new TranslatableContainer.Sync(original)).text());
|
||||
public Text decorate(@Nullable ServerPlayerEntity sender, Text original) {
|
||||
if (!GoogleChatConfig.General.enabled) return original;
|
||||
if (!GoogleChatConfig.Advanced.async) {
|
||||
return decorate(sender, new TranslatableContainer.Sync(original)).text();
|
||||
}
|
||||
try {
|
||||
return decorate(sender, new TranslatableContainer.Async(CompletableFuture.completedFuture(original)))
|
||||
.text()
|
||||
.exceptionally(e -> {
|
||||
GoogleChat.LOGGER.error("Could not compute translation", e);
|
||||
return original;
|
||||
})
|
||||
.get();
|
||||
} catch (InterruptedException | ExecutionException e) {
|
||||
GoogleChat.LOGGER.error("Could not synchronize async translation for synchronous decorator", e);
|
||||
return original;
|
||||
}
|
||||
}
|
||||
|
||||
private <K, T extends TranslatableContainer<K, T>> T decorate(@Nullable ServerPlayerEntity sender, T original) {
|
||||
|
|
Loading…
Reference in New Issue