9
0
mirror of https://github.com/BX-Team/DivineMC.git synced 2025-12-19 14:59:25 +00:00

Updated Upstream (Purpur)

Upstream has released updates that appear to apply and compile correctly

Purpur Changes:
PurpurMC/Purpur@9efd5fc Updated Upstream (Paper)
PurpurMC/Purpur@ad910f8 Updated Upstream (Paper)
This commit is contained in:
NONPLAYT
2024-06-24 14:09:30 +03:00
parent d9db4cd26d
commit ebf82913c5
7 changed files with 57 additions and 79 deletions

View File

@@ -73,6 +73,9 @@ recipe, getting the output wool and getting the color from that.
- ##### disable-non-editable-sign-warning
- **default**: true
- **description**: This setting disables warning when player tries to change the non-editable sign
- ##### remove-vanilla-username-check
- **default**: false
- **description**: Removes vanilla username check, allowing to join the server with any characters in username
- #### region-format
##### linear
- ###### flush-frequency

View File

@@ -2,7 +2,7 @@ group = space.bxteam.divinemc
mcVersion = 1.21
version = 1.21-R0.1-SNAPSHOT
purpurRef = 21ec259c5db7796279505a6225a6d7a25ef379df
purpurRef = ad910f82105c79c3fe7b4b9c18886601d4f96fb0
org.gradle.caching = true
org.gradle.parallel = true

View File

@@ -1,44 +0,0 @@
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
Removed due Paper username check in 1.20.4?
diff --git a/src/main/java/gq/bxteam/divinemc/configuration/DivineConfig.java b/src/main/java/gq/bxteam/divinemc/configuration/DivineConfig.java
index 9e802fbe8e5f1a3c24cb6bc9254c72a2a0c3fde1..426ae4086adc0180e3f3ba06cf6c005476ca891e 100644
--- a/src/main/java/gq/bxteam/divinemc/configuration/DivineConfig.java
+++ b/src/main/java/gq/bxteam/divinemc/configuration/DivineConfig.java
@@ -152,4 +152,9 @@ public class DivineConfig {
}
return builder.build();
}
+
+ 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 3dcccca8ede9b203c24ba29b2020a583297b895c..272670750afe2d07e51f2f7589c5718a2c155ed4 100644
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
@@ -16,6 +16,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;
@@ -160,7 +162,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())) {

View File

@@ -1,29 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
Date: Sat, 10 Jun 2023 13:06:44 +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 65012a12e1430956ef55ced56773e6354ac26444..2bcd3ee3bbdf246ef429a8310ca96ba3fb4afd2c 100644
--- a/src/main/java/net/minecraft/world/level/biome/Biome.java
+++ b/src/main/java/net/minecraft/world/level/biome/Biome.java
@@ -66,7 +66,8 @@ public final class Biome {
private final BiomeGenerationSettings generationSettings;
private final MobSpawnSettings mobSettings;
private final BiomeSpecialEffects specialEffects;
- private final ThreadLocal<Long2FloatLinkedOpenHashMap> temperatureCache = ThreadLocal.withInitial(() -> {
+ private static final ThreadLocal<Long2FloatLinkedOpenHashMap> temperatureCache = ThreadLocal.withInitial(() -> { // DivineMC - fix memory leak
+
return Util.make(() -> {
Long2FloatLinkedOpenHashMap long2FloatLinkedOpenHashMap = new Long2FloatLinkedOpenHashMap(1024, 0.25F) {
protected void rehash(int i) {
@@ -118,7 +119,7 @@ public final class Biome {
@Deprecated
public float getTemperature(BlockPos blockPos) {
long l = blockPos.asLong();
- Long2FloatLinkedOpenHashMap long2FloatLinkedOpenHashMap = this.temperatureCache.get();
+ Long2FloatLinkedOpenHashMap long2FloatLinkedOpenHashMap = temperatureCache.get(); // DivineMC - fix memory leak
float f = long2FloatLinkedOpenHashMap.get(l);
if (!Float.isNaN(f)) {
return f;

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Fix MC-31819
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
index b06eebbad2b20d4c59c9163388af220594ddf6b7..b8db58d25d91bc538fb310dfb801be4f05ec0b57 100644
index 42f9a2046aa8086aecbfa2fa0b604b21c2b70754..b92dd6072d50771943cca4e96ff567b9850326a1 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -1946,6 +1946,11 @@ public abstract class Player extends LivingEntity {
@@ -1943,6 +1943,11 @@ public abstract class Player extends LivingEntity {
}
public void causeFoodExhaustion(float f, EntityExhaustionEvent.ExhaustionReason reason) {

View File

@@ -7,10 +7,10 @@ Original post on Mojira: https://bugs.mojang.com/browse/MC-2025
Fix taken from Reddit: https://redd.it/8pgd4q
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index c1d6b00c2e74cd19df9dd074a021024e0c9ac442..2892d3ad489f0fe2a1b11ef0eb7f8b5290f841a4 100644
index 4a3a05324d1c732abc344c17242368a3cbaf81f3..7f1ec9f60cdd52eb6ddb6ad00542d9fa6eed03a6 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -2482,6 +2482,17 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -2481,6 +2481,17 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
nbttagcompound.putBoolean("Purpur.FireImmune", immuneToFire);
}
// Purpur end
@@ -28,7 +28,7 @@ index c1d6b00c2e74cd19df9dd074a021024e0c9ac442..2892d3ad489f0fe2a1b11ef0eb7f8b52
return nbttagcompound;
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.forThrowable(throwable, "Saving entity NBT");
@@ -2559,6 +2570,14 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -2558,6 +2569,14 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
this.reapplyPosition();
}

View File

@@ -0,0 +1,48 @@
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 cbe2789f8a055550dd7840a7bed980efd65eb9a1..1926d365fa613d0fb3eb34cf4d2df655de71dcd9 100644
--- a/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java
+++ b/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java
@@ -271,7 +271,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 5edd8e6bcabe5714c89d4c88f672cc3130c27045..0a5156f1790f9b384ce158444f2f38037e8dd91f 100644
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
@@ -169,7 +169,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 cc056202ff619eb2524a364c0f7a03343290e7c4..dacfb8d33b17ec86d7e45b9f88ca5303741eefee 100644
--- a/src/main/java/space/bxteam/divinemc/configuration/DivineConfig.java
+++ b/src/main/java/space/bxteam/divinemc/configuration/DivineConfig.java
@@ -154,8 +154,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 recipeManagerOptimization = true;