mirror of
https://github.com/BX-Team/DivineMC.git
synced 2026-01-04 15:31:43 +00:00
two new patches
This commit is contained in:
43
patches/server/0021-Allow-any-username.patch
Normal file
43
patches/server/0021-Allow-any-username.patch
Normal file
@@ -0,0 +1,43 @@
|
||||
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())) {
|
||||
28
patches/server/0022-Fix-memory-leak.patch
Normal file
28
patches/server/0022-Fix-memory-leak.patch
Normal file
@@ -0,0 +1,28 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
||||
Date: Tue, 4 Apr 2023 00:01:34 +0300
|
||||
Subject: [PATCH] Fix memory leak
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/biome/Biome.java b/src/main/java/net/minecraft/world/level/biome/Biome.java
|
||||
index ed439b7e94646141c93a7dd3704d1cdeb5c27e16..064b6340c67b0680763ed70e0d6dd51d16ed5529 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/biome/Biome.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/biome/Biome.java
|
||||
@@ -67,7 +67,7 @@ public final class Biome {
|
||||
private final MobSpawnSettings mobSettings;
|
||||
private final BiomeSpecialEffects specialEffects;
|
||||
// Pufferfish start - use our cache
|
||||
- private final ThreadLocal<gg.airplane.structs.Long2FloatAgingCache> temperatureCache = ThreadLocal.withInitial(() -> {
|
||||
+ private static final ThreadLocal<gg.airplane.structs.Long2FloatAgingCache> temperatureCache = ThreadLocal.withInitial(() -> { // DivineMC - fix memory leak
|
||||
return Util.make(() -> {
|
||||
/*
|
||||
Long2FloatLinkedOpenHashMap long2FloatLinkedOpenHashMap = new Long2FloatLinkedOpenHashMap(1024, 0.25F) {
|
||||
@@ -125,7 +125,7 @@ public final class Biome {
|
||||
public float getTemperature(BlockPos blockPos) {
|
||||
long l = blockPos.asLong();
|
||||
// Pufferfish start
|
||||
- gg.airplane.structs.Long2FloatAgingCache cache = this.temperatureCache.get();
|
||||
+ gg.airplane.structs.Long2FloatAgingCache cache = temperatureCache.get(); // DivineMC - fix memory leak
|
||||
float f = cache.getValue(l);
|
||||
if (!Float.isNaN(f)) {
|
||||
return f;
|
||||
Reference in New Issue
Block a user