aikar / aikar/commands

Parameter Switches

未关闭
#150 12 条评论 2 个 reaction 已指派 0 人 在 GitHub 查看
core help wanted
主要语言
Java
星标
628
派生
150
PR 合并指标
30 天内没有已合并 PR

描述

Implement @Switch("res") to be used such as:

```java
@Subcommand("set")
public void onResInfo(Player player, @Switch("r,res") Residence res, Permission perm, PermissionState value) {
res.getPermissions().setState(perm, value);
}
```

With this, the following commands should work:
```
/res set 1111 build true
/res set build -res 1111 true
/res set -r 1111 build true
/res set build true -r 1111
```

When a parameter has a switch, it can be "Supplied" at any location of parameters (but not before the subcommands)

Switches should process command replacements

We can achieve this by first pre-parsing all switches during context resolution, marking what parameters have been satisfied, and then iterating the remainder of unsatisfied to complete them in order.

No new registration of switches needs to occur.

Switches should use - prefix by default, but the manager should allow customizing switch prefixes.

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。