From 1503e185852e5157b5e6d06759df38a84f7931bd Mon Sep 17 00:00:00 2001 From: Johannes Schmelz Date: Mon, 2 Dec 2024 05:24:53 +0100 Subject: [PATCH] limit name length --- .../main/java/pp/monopoly/game/server/ServerGameLogic.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Projekte/monopoly/model/src/main/java/pp/monopoly/game/server/ServerGameLogic.java b/Projekte/monopoly/model/src/main/java/pp/monopoly/game/server/ServerGameLogic.java index de1aef2..02023e2 100644 --- a/Projekte/monopoly/model/src/main/java/pp/monopoly/game/server/ServerGameLogic.java +++ b/Projekte/monopoly/model/src/main/java/pp/monopoly/game/server/ServerGameLogic.java @@ -208,7 +208,9 @@ public class ServerGameLogic implements ClientInterpreter { } if (player != null) { - player.setName(msg.getName()); + String name = msg.getName(); + String truc = name.length() > 15 ? name.substring(0, 15) : name; + player.setName(truc); player.setFigure(new Figure(1, -10, -10, Rotation.LEFT, msg.getFigure())); //TODO add figure to the map playerHandler.setPlayerReady(player, true);