mirror of
https://github.com/PaperMC/Paper.git
synced 2024-08-30 16:49:42 +02:00
47 lines
2.5 KiB
Diff
47 lines
2.5 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Zach Brown <zach.brown@destroystokyo.com>
|
|
Date: Sat, 12 Nov 2016 23:25:22 -0600
|
|
Subject: [PATCH] Filter bad data from ArmorStand and SpawnEgg items
|
|
|
|
|
|
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
index 097991f2dd8d35fd5bc62e23e7361d47e70da493..4bda78d36a64e89bc68885a2a10b40a759720d1a 100644
|
|
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
@@ -347,4 +347,12 @@ public class PaperWorldConfig {
|
|
private void removeCorruptTEs() {
|
|
removeCorruptTEs = getBoolean("remove-corrupt-tile-entities", false);
|
|
}
|
|
+
|
|
+ public boolean filterNBTFromSpawnEgg = true;
|
|
+ private void fitlerNBTFromSpawnEgg() {
|
|
+ filterNBTFromSpawnEgg = getBoolean("filter-nbt-data-from-spawn-eggs-and-related", true);
|
|
+ if (!filterNBTFromSpawnEgg) {
|
|
+ Bukkit.getLogger().warning("Spawn Egg and Armor Stand NBT filtering disabled, this is a potential security risk");
|
|
+ }
|
|
+ }
|
|
}
|
|
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 0366303a986ae6da8e95ed3051610c432a790194..a8a9cbcece45c3480120cb2fa0fa03523a87d317 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
|
@@ -324,6 +324,18 @@ public class FallingBlockEntity extends Entity {
|
|
@Override
|
|
protected void readAdditionalSaveData(CompoundTag nbt) {
|
|
this.blockState = NbtUtils.readBlockState(nbt.getCompound("BlockState"));
|
|
+ // Paper start - Block FallingBlocks with Command Blocks
|
|
+ final Block b = this.blockState.getBlock();
|
|
+ if (this.level.paperConfig.filterNBTFromSpawnEgg
|
|
+ && (b == Blocks.COMMAND_BLOCK
|
|
+ || b == Blocks.REPEATING_COMMAND_BLOCK
|
|
+ || b == Blocks.CHAIN_COMMAND_BLOCK
|
|
+ || b == Blocks.JIGSAW
|
|
+ || b == Blocks.STRUCTURE_BLOCK
|
|
+ || b instanceof net.minecraft.world.level.block.GameMasterBlock)) {
|
|
+ this.blockState = Blocks.STONE.defaultBlockState();
|
|
+ }
|
|
+ // Paper end
|
|
this.time = nbt.getInt("Time");
|
|
if (nbt.contains("HurtEntities", 99)) {
|
|
this.hurtEntities = nbt.getBoolean("HurtEntities");
|