mojira.dev
MC-166440

/op, /deop, /ban and /pardon do not work with @s

The bug

When trying to use /op, /deop, /ban or /pardon with @s (note that @p works), the following error is shown:

Only players may be affected by this command, but the provided selector includes entities

How to reproduce

  1. Start a server

  2. Try to run the following command

    /op @s

Linked issues

Attachments

Comments 5

20w29a and all versions after 1.15 pre2 as well (even current 1.16)

To fix, this command would instead have to check while running the OP function if the entity is a player or not instead of only throwing errors when the selector is able to target a non-player entity.

Would be great if fixed for functions on data packs to control OPing players on servers which also do other things to the player/show messages in chat.

as a workaround, use @s[type=player]

Can confirm in 1.18.1.

Can confirm in 1.18.2 and 22w12a.

[media]

Can confirm in 1.19.

marcono1234

(Unassigned)

Confirmed

Platform

Low

Commands

1.15 Pre-Release 2, 1.16.2, 1.18.1, 1.18.2, 22w12a, 1.19

Retrieved