Skip to content

Commit

Permalink
Update to 3.0.3
Browse files Browse the repository at this point in the history
Signed-off-by: ErdbeerbaerLP <[email protected]>
  • Loading branch information
ErdbeerbaerLP committed Nov 26, 2023
1 parent 152b369 commit 7ab7774
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import com.mojang.brigadier.StringReader;
import com.mojang.brigadier.exceptions.CommandSyntaxException;
import dcshadow.dev.vankka.mcdiscordreserializer.discord.DiscordSerializer;
import dcshadow.net.kyori.adventure.text.Component;
import dcshadow.net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
import de.erdbeerbaerlp.dcintegration.common.DiscordIntegration;
Expand Down Expand Up @@ -120,16 +119,16 @@ public void serverSetup(FMLDedicatedServerSetupEvent ev) {
if (DiscordIntegration.INSTANCE.getJDA() != null) {
Thread.sleep(2000); //Wait for it to cache the channels
CommandRegistry.registerDefaultCommands();
if (!Localization.instance().serverStarting.isBlank())
if (DiscordIntegration.INSTANCE.getChannel() != null) {
final MessageCreateData m;
if (Configuration.instance().embedMode.enabled && Configuration.instance().embedMode.startMessages.asEmbed)
m = new MessageCreateBuilder().setEmbeds(Configuration.instance().embedMode.startMessages.toEmbed().setDescription(Localization.instance().serverStarting).build()).build();
else
m = new MessageCreateBuilder().addContent(Localization.instance().serverStarting).build();
DiscordIntegration.startingMsg = DiscordIntegration.INSTANCE.sendMessageReturns(m, DiscordIntegration.INSTANCE.getChannel(Configuration.instance().advanced.serverChannelID));
}
}
if (!Localization.instance().serverStarting.isBlank())
if (DiscordIntegration.INSTANCE.getChannel() != null) {
final MessageCreateData m;
if (Configuration.instance().embedMode.enabled && Configuration.instance().embedMode.startMessages.asEmbed)
m = new MessageCreateBuilder().setEmbeds(Configuration.instance().embedMode.startMessages.toEmbed().setDescription(Localization.instance().serverStarting).build()).build();
else
m = new MessageCreateBuilder().addContent(Localization.instance().serverStarting).build();
DiscordIntegration.startingMsg = DiscordIntegration.INSTANCE.sendMessageReturns(m, DiscordIntegration.INSTANCE.getChannel(Configuration.instance().advanced.serverChannelID));
}
}
} catch (InterruptedException | NullPointerException ignored) {
}
}
Expand Down Expand Up @@ -227,18 +226,18 @@ public void advancement(AdvancementEvent.AdvancementEarnEvent ev) {
INSTANCE.sendMessage(new DiscordMessage(b.build()));
}
} else INSTANCE.sendMessage(Localization.instance().advancementMessage.replace("%player%",
ChatFormatting.stripFormatting(ForgeMessageUtils.formatPlayerName(ev.getEntity())))
.replace("%advName%",
ChatFormatting.stripFormatting(ev.getAdvancement()
.getDisplay()
.getTitle()
.getString()))
.replace("%advDesc%",
ChatFormatting.stripFormatting(ev.getAdvancement()
.getDisplay()
.getDescription()
.getString()))
.replace("\\n", "\n"));
ChatFormatting.stripFormatting(ForgeMessageUtils.formatPlayerName(ev.getEntity())))
.replace("%advName%",
ChatFormatting.stripFormatting(ev.getAdvancement()
.getDisplay()
.getTitle()
.getString()))
.replace("%advDesc%",
ChatFormatting.stripFormatting(ev.getAdvancement()
.getDisplay()
.getDescription()
.getString()))
.replace("\\n", "\n"));
}
}

Expand Down Expand Up @@ -273,7 +272,7 @@ public void serverStarted(final ServerStartedEvent ev) {
}
INSTANCE.startThreads();
}
UpdateChecker.runUpdateCheck("https://raw.githubusercontent.com/ErdbeerbaerLP/Discord-Chat-Integration/1.19.4/update_checker.json");
UpdateChecker.runUpdateCheck("https://raw.githubusercontent.com/ErdbeerbaerLP/Discord-Chat-Integration/1.19.2/update_checker.json");
if (ModList.get().getModContainerById("dynmap").isPresent()) {
new DynmapListener().register();
}
Expand Down Expand Up @@ -484,7 +483,7 @@ public void chat(ServerChatEvent ev) {
}
} else
INSTANCE.sendMessage(ForgeMessageUtils.formatPlayerName(ev.getPlayer()), ev.getPlayer().getUUID().toString(), new DiscordMessage(embed, text, true), channel);
if (!Configuration.instance().compatibility.disableParsingMentionsIngame) {
if(!Configuration.instance().compatibility.disableParsingMentionsIngame) {
final String json = net.minecraft.network.chat.Component.Serializer.toJson(msg);
Component comp = GsonComponentSerializer.gson().deserialize(json);
final String editedJson = GsonComponentSerializer.gson().serialize(MessageUtils.mentionsToNames(comp, channel.getGuild()));
Expand Down
2 changes: 1 addition & 1 deletion update_checker.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
},
{
"version": "3.0.0",
"changelog": "Added new event handling methods for addons\nOtherwise mostly a bug fix update\nDon't forget to use 'discord migrate' in console when updating from below 2.6.0",
"changelog": "Large discord integration rewrite adding new features and fixing long existing bugs Old configuration can be used as-is",
"type": "alpha"
},{
"version": "2.6.4",
Expand Down

0 comments on commit 7ab7774

Please sign in to comment.