Allow enabling sand duping (#10191)

Because this exploit has been widely known for years and has not been fixed by Mojang, we decided that it was worth allowing people to toggle it on/off due to how easy it is to make it configurable.

It should be noted that this decision does not promise all future exploits will be configurable.
This commit is contained in:
Owen1212055 2024-03-03 17:05:34 -05:00
parent ae0c893174
commit 7415dcf70e
3 changed files with 8 additions and 40 deletions

View file

@ -55,7 +55,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
this.processPortalCooldown();
+ this.tickEndPortal(); // Paper - make end portalling safe
+ if (!io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.allowUnsafeEndPortalTeleportation) this.tickEndPortal(); // Paper - make end portalling safe
}
}
@ -74,12 +74,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- if (entity instanceof ServerPlayer) {
- ((ServerPlayer) entity).changeDimension(worldserver, PlayerTeleportEvent.TeleportCause.END_PORTAL);
- return;
- }
- // CraftBukkit end
- entity.changeDimension(worldserver);
+ // Paper start - move all of this logic into portal tick
+ entity.portalWorld = ((ServerLevel)world);
+ entity.portalBlock = pos.immutable();
+ if (io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.allowUnsafeEndPortalTeleportation) {
+ entity.tickEndPortal();
}
- // CraftBukkit end
- entity.changeDimension(worldserver);
+ // Paper end - move all of this logic into portal tick
}

View file

@ -1,36 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
Date: Fri, 12 Jun 2020 13:33:19 -0700
Subject: [PATCH] Fix sand duping
If the falling block dies during teleportation (entity#move), then we need
to detect that by placing a check after the move.
diff --git a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
+++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
@@ -0,0 +0,0 @@ public class FallingBlockEntity extends Entity {
@Override
public void tick() {
+ // Paper start - fix sand duping
+ if (this.isRemoved()) {
+ return;
+ }
+ // Paper end - fix sand duping
if (this.blockState.isAir()) {
this.discard(EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause
} else {
@@ -0,0 +0,0 @@ public class FallingBlockEntity extends Entity {
}
this.move(MoverType.SELF, this.getDeltaMovement());
+ // Paper start - fix sand duping
+ if (this.isRemoved()) {
+ return;
+ }
+ // Paper end - fix sand duping
// Paper start - Configurable falling blocks height nerf
if (this.level().paperConfig().fixes.fallingBlockHeightNerf.test(v -> this.getY() > v)) {
if (this.dropItem && this.level().getGameRules().getBoolean(GameRules.RULE_DOENTITYDROPS)) {

View file

@ -635,6 +635,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ public UnsupportedSettings unsupportedSettings;
+
+ public class UnsupportedSettings extends ConfigurationPart {
+ @Comment("This setting allows for exploits related to end portals, for example sand duping")
+ public boolean allowUnsafeEndPortalTeleportation = false;
+ @Comment("This setting controls if players should be able to break bedrock, end portals and other intended to be permanent blocks.")
+ public boolean allowPermanentBlockBreakExploits = false;
+ @Comment("This setting controls if player should be able to use TNT duplication, but this also allows duplicating carpet, rails and potentially other items")