3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-15 04:20:04 +01:00

Expand NBT filtering from last commit

cc GH-478
Dieser Commit ist enthalten in:
Zach Brown 2016-11-13 19:36:23 -06:00
Ursprung dec715e07b
Commit bd503d35b0
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: CC9DA35FC5450B76

Datei anzeigen

@ -1,28 +1,63 @@
From e7490178a70a45f8e3a641ae338d65c4a04620eb Mon Sep 17 00:00:00 2001
From 27f801bd116e4387e6b7b1696b23adf140940e4a 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 9d361cb..651f23e 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -403,4 +403,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/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java
index dcfdd31..f62fdde 100644
--- a/src/main/java/net/minecraft/server/EntityFallingBlock.java
+++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java
@@ -250,6 +250,12 @@ public class EntityFallingBlock extends Entity {
this.block = Block.getById(nbttagcompound.getByte("Tile") & 255).fromLegacyData(i);
}
+ // Paper start - Block FallingBlocks with Command Blocks
+ if (this.world.paperConfig.filterNBTFromSpawnEgg && this.block.getBlock() == Blocks.COMMAND_BLOCK) {
+ this.block = Blocks.STONE.getBlockData();
+ }
+ // Paper end
+
this.ticksLived = nbttagcompound.getInt("Time");
Block block = this.block.getBlock();
diff --git a/src/main/java/net/minecraft/server/ItemMonsterEgg.java b/src/main/java/net/minecraft/server/ItemMonsterEgg.java
index 6317cba..06149e8 100644
index 6317cba..1b3816f 100644
--- a/src/main/java/net/minecraft/server/ItemMonsterEgg.java
+++ b/src/main/java/net/minecraft/server/ItemMonsterEgg.java
@@ -82,8 +82,12 @@ public class ItemMonsterEgg extends Item {
@@ -83,7 +83,14 @@ public class ItemMonsterEgg extends Item {
NBTTagCompound nbttagcompound1 = entity.e(new NBTTagCompound());
UUID uuid = entity.getUniqueID();
-
- nbttagcompound1.a(nbttagcompound.getCompound("EntityTag"));
+ // Paper start - Filter out position and motion information
+ final NBTTagCompound entityTag = nbttagcompound.getCompound("EntityTag");
+ entityTag.remove("Pos");
+ entityTag.remove("Motion");
+ if (world.paperConfig.filterNBTFromSpawnEgg) {
+ entityTag.remove("Pos");
+ entityTag.remove("Motion");
+ }
+ nbttagcompound1.a(entityTag);
+ // Paper end
entity.a(uuid);
entity.f(nbttagcompound1);
}
--
2.10.2.windows.1
2.10.2