Fix entity selector permission check to check original source (#8995)

Permission checks should be against the command source and not the
target entity, as is done in vanilla.

Fixes #8994
This commit is contained in:
sciwhiz12 authored and GitHub committed 2022-08-25 11:42:11 -07:00
1 parent b5d5855559
commit d7b137d144
2 files changed
+2 -1

No files matched your search

@@ -1498,7 +1498,7 @@ public class ForgeHooks
public static boolean canUseEntitySelectors(SharedSuggestionProvider provider)
{
if (provider instanceof CommandSourceStack source && source.getEntity() instanceof ServerPlayer player)
if (provider instanceof CommandSourceStack source && source.source instanceof ServerPlayer player)
{
return PermissionAPI.getPermission(player, ForgeMod.USE_SELECTORS_PERMISSION);
}
@@ -139,6 +139,7 @@ protected net.minecraft.client.resources.model.ModelBakery f_119243_ # resourceM
protected net.minecraft.client.resources.model.ModelBakery m_119364_(Lnet/minecraft/resources/ResourceLocation;)Lnet/minecraft/client/renderer/block/model/BlockModel; # loadBlockModel
public net.minecraft.client.resources.model.SimpleBakedModel$Builder <init>(ZZZLnet/minecraft/client/renderer/block/model/ItemTransforms;Lnet/minecraft/client/renderer/block/model/ItemOverrides;)V # constructor
public net.minecraft.client.sounds.SoundEngine f_120217_ # soundManager
public net.minecraft.commands.CommandSourceStack f_81288_ # source
public net.minecraft.commands.arguments.selector.EntitySelectorParser m_121229_()V # finalizePredicates
public net.minecraft.commands.arguments.selector.EntitySelectorParser m_121317_()V # parseOptions
public net.minecraft.commands.arguments.selector.options.EntitySelectorOptions m_121453_(Ljava/lang/String;Lnet/minecraft/commands/arguments/selector/options/EntitySelectorOptions$Modifier;Ljava/util/function/Predicate;Lnet/minecraft/network/chat/Component;)V # register