diff --git a/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClientManager.java b/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClientManager.java index 9db17bce6..0bc28800c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClientManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClientManager.java @@ -17,7 +17,7 @@ import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicReference; import java.util.function.BiConsumer; import java.util.function.Consumer; -import java.util.stream.Collectors; +import java.util.regex.Pattern; import org.bukkit.Bukkit; import org.bukkit.entity.Player; @@ -83,6 +83,8 @@ public class CoreClientManager extends MiniPlugin } private static final Map CLIENT_LOGIN_LOCKS = new ConcurrentHashMap<>(); + + private static final Pattern VALID_USERNAME = Pattern.compile("[a-zA-Z0-9_]{1,16}"); private JavaPlugin _plugin; private AccountRepository _repository; @@ -365,6 +367,11 @@ public class CoreClientManager extends MiniPlugin public void loadClientByName(String playerName, Consumer loadedClient) { + if (!VALID_USERNAME.matcher(playerName).find()) + { + return; + } + runAsync(() -> { AtomicReference loaded = new AtomicReference<>(); @@ -436,6 +443,11 @@ public class CoreClientManager extends MiniPlugin public void loadClientByNameSync(final String playerName, final Runnable runnable) { + if (!VALID_USERNAME.matcher(playerName).find()) + { + return; + } + try { ClientToken token = null;