mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2024-11-23 15:20:52 +01:00
Prevent adding yourself as a friend
This commit is contained in:
parent
e40d8c4f99
commit
21c87145ea
@ -214,7 +214,13 @@ public class Messenger {
|
||||
|
||||
try (ResultSet set = statement.executeQuery()) {
|
||||
while (set.next()) {
|
||||
this.friends.putIfAbsent(set.getInt("id"), new MessengerBuddy(set));
|
||||
MessengerBuddy buddy = new MessengerBuddy(set);
|
||||
|
||||
if (buddy.getId() == habbo.getHabboInfo().getId()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
this.friends.putIfAbsent(set.getInt("id"), buddy);
|
||||
}
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
|
@ -25,6 +25,10 @@ public class FriendRequestEvent extends MessageHandler {
|
||||
String username = this.packet.readString();
|
||||
Habbo habbo = Emulator.getGameServer().getGameClientManager().getHabbo(username);
|
||||
|
||||
if (habbo.getHabboInfo().getId() == this.client.getHabbo().getHabboInfo().getId()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (Emulator.getPluginManager().fireEvent(new UserRequestFriendshipEvent(this.client.getHabbo(), username, habbo)).isCancelled()) {
|
||||
this.client.sendResponse(new FriendRequestErrorComposer(2));
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user