mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-29 07:48:53 +01:00
Expand NBT filtering from last commit
cc GH-478
This commit is contained in:
parent
dec715e07b
commit
bd503d35b0
1 changed files with 43 additions and 8 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue