diff --git a/src/main/java/one/devos/nautical/teabridge/discord/Discord.java b/src/main/java/one/devos/nautical/teabridge/discord/Discord.java index 5bc02cc..49dda5f 100644 --- a/src/main/java/one/devos/nautical/teabridge/discord/Discord.java +++ b/src/main/java/one/devos/nautical/teabridge/discord/Discord.java @@ -3,7 +3,6 @@ import java.net.URI; import java.net.http.HttpRequest; import java.net.http.HttpResponse; -import java.util.List; import java.util.Optional; import java.util.concurrent.LinkedBlockingQueue; import java.util.function.Supplier; @@ -21,12 +20,19 @@ public class Discord { private static JDA jda; - private static long guild; + private static long guildId; public static long selfId; private static Member cachedSelfMember; private static Supplier cachingSelfMemberGet = () -> { - if (cachedSelfMember == null) cachedSelfMember = jda.getGuildById(guild).getSelfMember(); + if (cachedSelfMember == null) { + var guild = jda.getGuildById(guildId); + if (guild != null) { + cachedSelfMember = guild.getSelfMember(); + } else { + throw new RuntimeException("Guild is null. This most likely means you are missing the message content intent, please enable it within the app's settings in the discord developer portal."); + } + } return cachedSelfMember; }; @@ -58,11 +64,11 @@ public static void start() { if (response.statusCode() / 100 != 2) throw new Exception("Non-success status code from request " + response); var webHookDataResponse = JsonUtils.GSON.fromJson(response.body(), WebHookDataResponse.class); if (Config.INSTANCE.debug) TeaBridge.LOGGER.warn("Webhook response : " + response.body()); - guild = Long.parseLong(webHookDataResponse.guildId); + guildId = Long.parseLong(webHookDataResponse.guildId); ChannelListener.INSTANCE.setChannel(Long.parseLong(webHookDataResponse.channelId)); jda = JDABuilder.createDefault(Config.INSTANCE.discord.token) - .enableIntents(List.of(GatewayIntent.MESSAGE_CONTENT)) + .enableIntents(GatewayIntent.MESSAGE_CONTENT) .addEventListeners(ChannelListener.INSTANCE, CommandUtils.INSTANCE) .build(); diff --git a/src/main/java/one/devos/nautical/teabridge/mixin/ServerPlayerMixin.java b/src/main/java/one/devos/nautical/teabridge/mixin/ServerPlayerMixin.java index ce8760b..d664120 100644 --- a/src/main/java/one/devos/nautical/teabridge/mixin/ServerPlayerMixin.java +++ b/src/main/java/one/devos/nautical/teabridge/mixin/ServerPlayerMixin.java @@ -19,7 +19,7 @@ public abstract class ServerPlayerMixin implements PlayerWebHook { () -> { ServerPlayer self = (ServerPlayer) (Object) this; if (Config.INSTANCE.avatars.useTextureId) { - MinecraftProfileTexture skin = self.getServer().getSessionService().getTextures(self.getGameProfile(), true).get(MinecraftProfileTexture.Type.SKIN); + MinecraftProfileTexture skin = self.getServer().getSessionService().getTextures(self.getGameProfile(), false).get(MinecraftProfileTexture.Type.SKIN); if (skin != null) return Config.INSTANCE.avatars.avatarUrl.formatted(skin.getHash()); } return Config.INSTANCE.avatars.avatarUrl.formatted(self.getStringUUID());