Scissors/patches/server/0024-Don-t-query-player-data-in-the-nbt-component.patch

28 lines
1.6 KiB
Diff
Raw Normal View History

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Video <videogamesm12@gmail.com>
Date: Sat, 9 Apr 2022 13:00:27 -0600
Subject: [PATCH] Don't query player data in the `nbt` component
diff --git a/src/main/java/net/minecraft/network/chat/NbtComponent.java b/src/main/java/net/minecraft/network/chat/NbtComponent.java
index f5f2ec1192303bc55a64dce3e0457e4531a35ba7..62613d9fccd74fe16512fe1fe703dc6db0166b28 100644
--- a/src/main/java/net/minecraft/network/chat/NbtComponent.java
+++ b/src/main/java/net/minecraft/network/chat/NbtComponent.java
@@ -22,6 +22,7 @@ import net.minecraft.nbt.Tag;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.entity.Entity;
+import net.minecraft.world.entity.player.Player;
import net.minecraft.world.level.block.entity.BlockEntity;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -218,7 +219,7 @@ public abstract class NbtComponent extends BaseComponent implements ContextAware
protected Stream<CompoundTag> getData(CommandSourceStack source) throws CommandSyntaxException {
if (this.compiledSelector != null) {
List<? extends Entity> list = this.compiledSelector.findEntities(source);
- return list.stream().map(NbtPredicate::getEntityTagToCompare);
+ return list.stream().filter((entity) -> !(entity instanceof Player)).map(NbtPredicate::getEntityTagToCompare); // Scissors - Don't query NBT from players
} else {
return Stream.empty();
}