From 6c2eed3a5324aaaac914f92cf143b6b8acf3156a Mon Sep 17 00:00:00 2001 From: PhilippvK Date: Thu, 23 Apr 2020 16:34:38 +0200 Subject: [PATCH] allow custom usernames --- .../net/packethandlers/golf/TrackTestLoginHandler.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/server/src/org/moparforia/server/net/packethandlers/golf/TrackTestLoginHandler.java b/server/src/org/moparforia/server/net/packethandlers/golf/TrackTestLoginHandler.java index 02096a44..82da1f77 100644 --- a/server/src/org/moparforia/server/net/packethandlers/golf/TrackTestLoginHandler.java +++ b/server/src/org/moparforia/server/net/packethandlers/golf/TrackTestLoginHandler.java @@ -44,7 +44,10 @@ public boolean handle(Server server, Packet packet, Matcher message) { boolean anonym = true; //!Database.getInstance().authenticateUser(username,password); if (anonym) { - username = "~anonym-" + (int) (Math.random() * 10000); + if (username.length() == 0) { + username = "~anonym-" + (int) (Math.random() * 10000); + // Warning: Currently duplicates wont get noticed... + } } Player player = (Player) packet.getChannel().getAttachment();