From 97c82fad15f12fb4032909827b3d0bd3509468eb Mon Sep 17 00:00:00 2001 From: mbax Date: Tue, 2 Jul 2019 15:36:30 -0400 Subject: [PATCH] Actually fix previously mentioned nick change issue --- .../library/defaults/listener/DefaultNickListener.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/kitteh/irc/client/library/defaults/listener/DefaultNickListener.java b/src/main/java/org/kitteh/irc/client/library/defaults/listener/DefaultNickListener.java index 4417a18f1..8613d97bb 100644 --- a/src/main/java/org/kitteh/irc/client/library/defaults/listener/DefaultNickListener.java +++ b/src/main/java/org/kitteh/irc/client/library/defaults/listener/DefaultNickListener.java @@ -58,21 +58,22 @@ public void nick(ClientReceiveCommandEvent event) { return; } boolean isSelf = ((User) event.getActor()).getNick().equals(this.getClient().getNick()); + String newNick = event.getParameters().get(0); Optional user = this.getTracker().getTrackedUser(((User) event.getActor()).getNick()); if (!user.isPresent()) { if (isSelf) { - this.getClient().setCurrentNick(event.getParameters().get(0)); + this.getClient().setCurrentNick(newNick); return; // Don't fail if NICK changes while not in a channel! } this.trackException(event, "NICK message sent for user not in tracked channels"); return; } User oldUser = user.get(); - this.getTracker().trackUserNickChange(user.get().getNick(), event.getParameters().get(0)); - User newUser = this.getTracker().getTrackedUser(((User) event.getActor()).getNick()).get(); + this.getTracker().trackUserNickChange(user.get().getNick(), newNick); + User newUser = this.getTracker().getTrackedUser(newNick).get(); this.fire(new UserNickChangeEvent(this.getClient(), event.getSource(), oldUser, newUser)); if (isSelf) { - this.getClient().setCurrentNick(event.getParameters().get(0)); + this.getClient().setCurrentNick(newNick); } } }