mirror of
https://github.com/BX-Team/DivineMC.git
synced 2025-12-19 14:59:25 +00:00
49 lines
3.8 KiB
Diff
49 lines
3.8 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
|
Date: Mon, 24 Jun 2024 14:05:44 +0300
|
|
Subject: [PATCH] Remove vanilla username check
|
|
|
|
|
|
diff --git a/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java b/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java
|
|
index 8849862b45ccbbc635a1c316e9870bca81e55c04..85b7c7742a2cc678aec317487fc811b9680e87d6 100644
|
|
--- a/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java
|
|
+++ b/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java
|
|
@@ -295,7 +295,7 @@ public class CraftPlayerProfile implements PlayerProfile, SharedPlayerProfile {
|
|
|
|
private static GameProfile createAuthLibProfile(UUID uniqueId, String name) {
|
|
Preconditions.checkArgument(name == null || name.length() <= 16, "Name cannot be longer than 16 characters");
|
|
- Preconditions.checkArgument(name == null || StringUtil.isValidPlayerName(name), "The name of the profile contains invalid characters: %s", name);
|
|
+ Preconditions.checkArgument(name == null || space.bxteam.divinemc.configuration.DivineConfig.removeVanillaUsernameCheck || StringUtil.isValidPlayerName(name), "The name of the profile contains invalid characters: %s", name); // DivineMC - Remove vanilla username check
|
|
return new GameProfile(
|
|
uniqueId != null ? uniqueId : Util.NIL_UUID,
|
|
name != null ? name : ""
|
|
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
|
index 16069b9cbf6c7679c28a2e9a54e77d23cd10e541..1b33f08b1d4730b28f61435488a1e1c04051c8dc 100644
|
|
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
|
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
|
@@ -174,7 +174,8 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
|
|
public void handleHello(ServerboundHelloPacket packet) {
|
|
Validate.validState(this.state == ServerLoginPacketListenerImpl.State.HELLO, "Unexpected hello packet", new Object[0]);
|
|
// Paper start - Validate usernames
|
|
- if (io.papermc.paper.configuration.GlobalConfiguration.get().proxies.isProxyOnlineMode()
|
|
+ if (!space.bxteam.divinemc.configuration.DivineConfig.removeVanillaUsernameCheck // DivineMC - Remove vanilla username check
|
|
+ && io.papermc.paper.configuration.GlobalConfiguration.get().proxies.isProxyOnlineMode()
|
|
&& io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.performUsernameValidation
|
|
&& !this.iKnowThisMayNotBeTheBestIdeaButPleaseDisableUsernameValidation) {
|
|
Validate.validState(StringUtil.isReasonablePlayerName(packet.name()), "Invalid characters in username", new Object[0]);
|
|
diff --git a/src/main/java/space/bxteam/divinemc/configuration/DivineConfig.java b/src/main/java/space/bxteam/divinemc/configuration/DivineConfig.java
|
|
index 261a55a4a5171f4ceb57fda8532bc1f795dc30ed..028589d94e04828686ff09e6a6b1a8fc71f054a0 100644
|
|
--- a/src/main/java/space/bxteam/divinemc/configuration/DivineConfig.java
|
|
+++ b/src/main/java/space/bxteam/divinemc/configuration/DivineConfig.java
|
|
@@ -156,8 +156,10 @@ public class DivineConfig {
|
|
}
|
|
|
|
public static boolean disableNonEditableSignWarning = true;
|
|
+ public static boolean removeVanillaUsernameCheck = false;
|
|
private static void miscSettings() {
|
|
disableNonEditableSignWarning = getBoolean("settings.misc.disable-non-editable-sign-warning", disableNonEditableSignWarning);
|
|
+ removeVanillaUsernameCheck = getBoolean("settings.misc.remove-vanilla-username-check", removeVanillaUsernameCheck);
|
|
}
|
|
|
|
public static boolean biomeManagerOptimization = true;
|