From 55a459e44045e897a4f72c6134e3f27011d8f5c0 Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Mon, 17 May 2021 23:19:27 +1200 Subject: [PATCH] Enforce name lengths on game profile --- .../disguise/utilities/reflection/ReflectionManager.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/me/libraryaddict/disguise/utilities/reflection/ReflectionManager.java b/src/main/java/me/libraryaddict/disguise/utilities/reflection/ReflectionManager.java index d87ab256..5432b56b 100644 --- a/src/main/java/me/libraryaddict/disguise/utilities/reflection/ReflectionManager.java +++ b/src/main/java/me/libraryaddict/disguise/utilities/reflection/ReflectionManager.java @@ -694,7 +694,8 @@ public class ReflectionManager { public static WrappedGameProfile getGameProfile(UUID uuid, String playerName) { try { - return new WrappedGameProfile(uuid != null ? uuid : getRandomUUID(), playerName); + return new WrappedGameProfile(uuid != null ? uuid : getRandomUUID(), + playerName == null || playerName.length() < 17 ? playerName : playerName.substring(0, 16)); } catch (Exception ex) { ex.printStackTrace(); } @@ -707,7 +708,8 @@ public class ReflectionManager { public static WrappedGameProfile getGameProfileWithThisSkin(UUID uuid, String playerName, WrappedGameProfile profileWithSkin) { try { - WrappedGameProfile gameProfile = new WrappedGameProfile(uuid != null ? uuid : getRandomUUID(), playerName); + WrappedGameProfile gameProfile = new WrappedGameProfile(uuid != null ? uuid : getRandomUUID(), + playerName == null || playerName.length() < 17 ? playerName : playerName.substring(0, 16)); if (profileWithSkin != null) { gameProfile.getProperties().putAll(profileWithSkin.getProperties());