mirror of
https://github.com/BX-Team/DivineMC.git
synced 2025-12-20 07:19:23 +00:00
44 lines
2.9 KiB
Diff
44 lines
2.9 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
|
Date: Mon, 3 Apr 2023 23:52:44 +0300
|
|
Subject: [PATCH] Allow any username
|
|
|
|
|
|
diff --git a/src/main/java/gq/bxteam/divinemc/configuration/DivineConfig.java b/src/main/java/gq/bxteam/divinemc/configuration/DivineConfig.java
|
|
index abf8ddccce6ec9d893038d1fafdca617ce0eae4d..2744315c62f99b48cb689dd90fdfffac405b1bcc 100644
|
|
--- a/src/main/java/gq/bxteam/divinemc/configuration/DivineConfig.java
|
|
+++ b/src/main/java/gq/bxteam/divinemc/configuration/DivineConfig.java
|
|
@@ -157,4 +157,9 @@ public class DivineConfig {
|
|
private static void fallbackToDimensionIfWorldUUIDUnknown() {
|
|
fallbackToDimensionIfWorldUUIDUnknown = getBoolean("settings.fallback-to-dimension-if-world-uuid-unknown", fallbackToDimensionIfWorldUUIDUnknown);
|
|
}
|
|
+
|
|
+ public static boolean allowAnyUsername = false;
|
|
+ private static void allowAnyUsername() {
|
|
+ allowAnyUsername = getBoolean("settings.player.allow-any-username", allowAnyUsername);
|
|
+ }
|
|
}
|
|
\ No newline at end of file
|
|
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
|
index f719f8aafe7c75e2ef8fcb05f556a8d6bd94b9a0..66dd73064e515986bebf57c6d293aa74cef88693 100644
|
|
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
|
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
|
@@ -14,6 +14,8 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|
import javax.annotation.Nullable;
|
|
import javax.crypto.Cipher;
|
|
import javax.crypto.SecretKey;
|
|
+
|
|
+import gq.bxteam.divinemc.configuration.DivineConfig;
|
|
import net.minecraft.DefaultUncaughtExceptionHandler;
|
|
import net.minecraft.core.UUIDUtil;
|
|
import net.minecraft.network.Connection;
|
|
@@ -239,7 +241,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
|
|
@Override
|
|
public void handleHello(ServerboundHelloPacket packet) {
|
|
Validate.validState(this.state == ServerLoginPacketListenerImpl.State.HELLO, "Unexpected hello packet", new Object[0]);
|
|
- Validate.validState(ServerLoginPacketListenerImpl.isValidUsername(packet.name()), "Invalid characters in username", new Object[0]);
|
|
+ if (!DivineConfig.allowAnyUsername) Validate.validState(ServerLoginPacketListenerImpl.isValidUsername(packet.name()), "Invalid characters in username", new Object[0]); // DivineMC - Allow any username
|
|
// Paper start - validate usernames
|
|
if (io.papermc.paper.configuration.GlobalConfiguration.get().proxies.isProxyOnlineMode() && io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.performUsernameValidation) {
|
|
if (!this.iKnowThisMayNotBeTheBestIdeaButPleaseDisableUsernameValidation && !validateUsername(packet.name())) {
|