Skip to content

Commit

Permalink
Merge pull request #123 from Simba98/forge-pr
Browse files Browse the repository at this point in the history
Forge PR
  • Loading branch information
cnlimiter authored Dec 16, 2023
2 parents 68f11e4 + 642d6c0 commit a1ed8bd
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 2 additions & 0 deletions forge/src/main/java/cn/evole/mods/mcbot/IMcBot.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import cn.evole.mods.mcbot.init.event.IPlayerEvent;
import cn.evole.mods.mcbot.init.event.ITickEvent;
import cn.evole.mods.mcbot.init.handler.CustomCmdHandler;
import cn.evole.mods.mcbot.util.locale.I18n;
import cn.evole.onebot.client.connection.ConnectFactory;
import cn.evole.onebot.client.core.Bot;
import cn.evole.onebot.client.handler.EventBus;
Expand Down Expand Up @@ -44,6 +45,7 @@ public void init(Path config_dir) {
CONFIG_FOLDER = Const.configDir.resolve("mcbot");
FileUtils.checkFolder(CONFIG_FOLDER);
CONFIG_FILE = CONFIG_FOLDER.resolve("config.toml");
I18n.init(config_dir);
Runtime.getRuntime().addShutdownHook(new Thread(IMcBot::killOutThreads));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,12 @@ public static Queue<String> getSendQueue() {
public static void register(MinecraftServer server) {
String toSend = SEND_QUEUE.poll();
if (ModConfig.INSTANCE != null
&& server != null
&& server.isDedicatedServer()
&& toSend != null
) {
//#if MC >= 11900
server.getPlayerList().broadcastSystemMessage(Component.literal(toSend), false);
server.getPlayerList().broadcastSystemMessage(Component.literal(toSend), false);
//#elseif MC <= 11502
//$$ server.getPlayerList().broadcastMessage(new TextComponent(toSend), false);
//#else
Expand Down
4 changes: 2 additions & 2 deletions forge/src/main/java/cn/evole/mods/mcbot/util/locale/I18n.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ public static void init(Path folder) {
translations = new HashMap<>();
LANG_FOLDER = folder.resolve("lang");
FileUtils.checkFolder(LANG_FOLDER);
LANG_FILE = "/lang/" + ModConfig.INSTANCE.getCommon().getLanguageSelect() + ".json";
DEFAULT_LANG_FILE = "/lang/en_us.json";
LANG_FILE = "assets/mcbot/lang/" + ModConfig.INSTANCE.getCommon().getLanguageSelect() + ".json";
DEFAULT_LANG_FILE = "assets/mcbot/lang/en_us.json";

Path optional = FMLLoader.getLoadingModList().getModFileById("mcbot").getFile().findResource(LANG_FILE);

Expand Down

0 comments on commit a1ed8bd

Please sign in to comment.