mojira.dev
MC-307125

Target selectors with duplicate `team` arguments are parsed inconsistently depending on argument order

When a target selector contains two team arguments—one inclusive and one exclusive—the command should fail to parse, because an entity cannot belong to two teams. Currently, parsing succeeds when the exclusive condition appears before the inclusive one, and incorrectly matches players.

Steps to reproduce

  1. Create a blank world and open the chat.

  2. Run the following commands in order:

    • /team add X

    • /team join X

    • /team add Y (do not join this team)

    • /say @a[team=!Y,team=X]

    • /say @a[team=X,team=!Y]

Expected result
Both commands should output the player(s) in team X who are not in team Y (i.e., the same set). The order of the team conditions should not affect the result.

Both commands should fail to parse, just as duplicate type= or name= arguments do.

Actual result

  • The first selector (@a[team=!Y,team=X]) executes without an error and outputs player(s) (incorrect behavior).

  • The second selector (@a[team=X,team=!Y]) fails to execute and returns the error:
    Option 'team' isn't applicable here

Linked issues

Attachments

Comments 3

This works as intended. It’s the same with type. The first argument that is exhaustive prevents future arguments from having any meaning, so they are rejected. Note that entities can only be on one team, so team=X is exhaustive.

Thank you for the explanation. I now understand that entities can only be on one team, so team=X is exhaustive—just like type—and any additional team argument after it should be rejected.

However, the issue I’m trying to highlight is the inconsistency in how the parser handles the order. Currently:

  • @a[team=!Y,team=X] (exhaustive team=X comes second) does not reject the duplicate argument and incorrectly matches players.

  • @a[team=X,team=!Y] (exhaustive team=X comes first) correctly rejects with Option 'team' isn't applicable here.

Since the exhaustive condition determines that no further team arguments can be meaningful, the command should fail regardless of which order the arguments appear in. The current behavior treats the two orders differently, which seems like a parser inconsistency.

Okay, yep, I can confirm that type and name prevent redundant arguments in either order, but team only prevents them in some orders. Thanks for updating, and I’ve confirmed your ticket. 🙂

Ben Ben

boq

Confirmed

Platform

Normal

Commands

26.1

26.2 Snapshot 5

Retrieved