EngineHub / Piston

A generic command system, with tie-ins to many Minecraft platforms such as Bukkit, Forge, and Sponge.
GNU General Public License v3.0
17 stars 3 forks source link

Duplicate flags should result in an understandable error #30

Closed octylFractal closed 4 years ago

octylFractal commented 4 years ago

Currently, repeating a flag results in a non-obvious error:

java.lang.IllegalArgumentException: Multiple entries with same key: ArgAcceptingCommandFlag{description=TextComponentImpl{content=Set the include mask, non-matching blocks become air, children=[], style=Style{color=null, obfuscated=null, bold=null, strikethrough=null, underlined=null, italic=null, clickEvent=null, hoverEvent=null, insertion=null}}, name=m, argumentName=TranslatableComponentImpl{key=mask, args=[], children=[], style=Style{color=null, obfuscated=null, bold=null, strikethrough=null, underlined=null, italic=null, clickEvent=null, hoverEvent=null, insertion=null}}, types=[Key{type=com.sk89q.worldedit.function.mask.Mask, annotationWrapper=NullAnnotationWrapper}], defaults=[]}=CommandValueImpl{manager=org.enginehub.piston.impl.CommandManagerImpl@577deb, commandContextSupplier=org.enginehub.piston.impl.CommandParser$$Lambda$4051/414638444@1da2f0c6, partContext=ArgAcceptingCommandFlag{description=TextComponentImpl{content=Set the include mask, (...)

This should instead result in a message such as "Flag already present"