Command enum type does not show up
I am trying to implement a /give command, and I want to have the suffix of the itemType be 'item' so it would look like <itemType: Item>
However, no matter what I do it always seems to be string.

My command looks like this
type Give struct {
Player []cmd.Target
Item Item `cmd:"itemType,Item"`
Count cmd.Optional[uint]
Data cmd.Optional[int16]
}
and the Item enum type like this
type Item string
func (i Item) Type() string {
return "Item"
}
func (i Item) Options(source cmd.Source) []string {
return []string{"apple"}
}
Neither the suffix in the struct field tag nor the one returned in Type() seem to have any effect.
Just to clarify, the suffix doesn't change the parameter type. It allows something like this:
/xp <level: int>L, where L is the suffix. That said, this suffix doesn't seem to be showing up, so this is still an issue.
And, as you mentioned, the type from Type() not showing up is also an issue.
After some investigating:
- It seems the issue of the enum type showing up as
stringis because we use soft enums for all enums (these can be changed at runtime). Commands in vanilla that use soft enums also have enums that show up asstring. Not sure if and how we can resolve this, given we can't make any assurances the options returned by an enum implementations won't change at runtime. - Parameter suffixes I have not been able to get working either. It seems under some circumstances the client even crashes with a suffix. Maybe the constant we have for this is not correct (anymore)?
- Enum collapsing doesn't seem to be working at all anymore. The builtin enum dragonfly has for
booldoes not get collapsed anymore and instead now shows up as <true|false|1|0>. This enum is not a soft enum, so that cannot be the reason here. Maybe the constant we have for this is not correct anymore?
I think a solution to this would be to make all enums normal enums by default, and only mark them as a dynamic enum if a change was detected. In this case, we could send an AvailableCommands packet to replace the commands in question and change the normal enum to a dynamic enum client-side.