diff options
Diffstat (limited to 'src/main/java')
| -rw-r--r-- | src/main/java/dev/plutorocks/IrcClient.java | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/main/java/dev/plutorocks/IrcClient.java b/src/main/java/dev/plutorocks/IrcClient.java index a7b8c7f..703c0c1 100644 --- a/src/main/java/dev/plutorocks/IrcClient.java +++ b/src/main/java/dev/plutorocks/IrcClient.java @@ -138,6 +138,16 @@ public class IrcClient { ); return; } + if ("432".equals(code)) { + sendClientChat( + Text.literal("[IRC] ").formatted(Formatting.AQUA) + .append(Text.literal("Nick " + nick + " is invalid on this server (e.g. too long).") + .formatted(Formatting.GRAY)) + ); + MinecraftIRC.LOGGER.warn("[IRC] Nick {} rejected with 432", nick); + running = false; + return; + } if ("433".equals(code)) { sendClientChat( Text.literal("[IRC] ").formatted(Formatting.AQUA) @@ -145,6 +155,16 @@ public class IrcClient { .formatted(Formatting.GRAY)) ); MinecraftIRC.LOGGER.warn("[IRC] Nick {} already in use (433)", nick); + running = false; + return; + } + if ("451".equals(code)) { + sendClientChat( + Text.literal("[IRC] ").formatted(Formatting.AQUA) + .append(Text.literal("Server says connection is not registered (451).") + .formatted(Formatting.GRAY)) + ); + MinecraftIRC.LOGGER.warn("[IRC] Received 451 (connection not registered)"); return; } } @@ -211,6 +231,15 @@ public class IrcClient { MinecraftIRC.LOGGER.info("[IRC] Ignoring sendChannelMessage while not connected: {}", message); return; } + if (!registered) { + MinecraftIRC.LOGGER.info("[IRC] Ignoring sendChannelMessage while not registered: {}", message); + sendClientChat( + Text.literal("[IRC] ").formatted(Formatting.AQUA) + .append(Text.literal("Cannot send message yet; IRC connection is not fully registered.") + .formatted(Formatting.GRAY)) + ); + return; + } sendRaw("PRIVMSG " + channel + " :" + message); } |
