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);
}