aikar / aikar/commands

[Question] Different argument types based on previous argument

Đang mở
#242 1 bình luận 3 reaction 0 người được giao Xem trên GitHub
core question
Ngôn ngữ chính
Java
Star
628
Fork
150
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

I've recently started looking into this command framework for Spigot plugins and it's very nice. I've run into a bit of a design issue and am unsure if there's any way to get it to work using this framework.

Currently, I have the following commands:
`/rs give block `
`/rs give spawner `
`/rs give entity `

This works as I would expect it to using the following code:

```java
@CommandAlias("rs|rosestacker|stacker")
@Description("The base RoseStacker command")
public class RoseCommand extends BaseCommand {

@Subcommand("give")
@Description("Gives stacked items")
@CommandPermission("rosestacker.give")
public class GiveCommand extends BaseCommand {

@Subcommand("block")
@CommandCompletion("* @stackableBlockMaterial @amount")
public void onBlock(OnlinePlayer target, Material material, int amount) {
// TODO
}

@Subcommand("spawner")
@CommandCompletion("* @spawnableEntityType @amount")
public void onSpawner(OnlinePlayer target, EntityType entityType, int amount) {
// TODO
}

@Subcommand("entity")
@CommandCompletion("* @spawnableEntityType @amount")
public void onEntity(OnlinePlayer target, EntityType entityType, int amount) {
// TODO
}

}

}
```

However, I would like to move the player argument to before the next subcommand name like so:
`/rs give block `
`/rs give spawner `
`/rs give entity `

I haven't been able to think of a way to do this using this command framework. Is such a thing even possible? If it is, could somebody provide some insight on how I could go about doing it? Thanks in advance!

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.