mirror of
https://github.com/ayunami2000/ayungee.git
synced 2024-11-09 06:36:05 -08:00
disallow duplicate usernames lol
This commit is contained in:
parent
9d45885acb
commit
36bfd5469e
|
@ -111,6 +111,10 @@ public class WebSocketProxy extends WebSocketServer {
|
|||
byte[] uname = new byte[unameLen];
|
||||
for (int i = 0; i < uname.length; i++) uname[i] = msg[5 + i * 2];
|
||||
String username = new String(uname);
|
||||
if (Main.clients.values().stream().anyMatch(client -> client.username.equals(username))) {
|
||||
conn.close();
|
||||
return;
|
||||
}
|
||||
Client selfClient = new Client(username);
|
||||
Main.clients.put(conn, selfClient);
|
||||
new Thread(() -> {
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user