8000 Add Option for Automatic Exception on Empty EntitySelectorArgument Lists · Issue #495 · CommandAPI/CommandAPI · GitHub
[go: up one dir, main page]

Skip to content
Add Option for Automatic Exception on Empty EntitySelectorArgument Lists #495
Closed
@learliet

Description

@learliet

Description

There should be an option available when utilizing the EntitySelectorArgument to trigger an exception automatically when the resulting list is empty. This behavior mirrors the default implementation where argument.entity.notfound.entity or argument.entity.notfound.player is respectively returned.

Expected code

val myCommand = CommandAPICommand("myCommand")
  .withArguments(EntitySelectorArgument.ManyPlayers("players", false)) // allowEmpty flag
  .executes(CommandExecutor { sender, args ->
      // automatically returns "argument.entity.notfound.player" if empty
      val players = args[0] as List<Player> 
      // [...]
  })

Extra details

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestimplemented for next releaseThis has been implemented in the current dev build for the next public release

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0