CounterListType: add List for easy extending counters#10213
CounterListType: add List for easy extending counters#10213
Conversation
|
Might be interesting if we can add some Icons for such List Counters too like MTGO has Icons for these: https://mtg.wiki/page/Page_counter |
|
@tool4ever most of the remaining enum types are used for AI in i might try to move them into another text files too, or what's your opinion? |
|
hmn, binding them to Enum to enforce the correct types at compile time has some advantages like not having to worry about String typos or them drifting apart 🤔 I'm not sure giving that up would be worth it? |
| @@ -16,12 +16,17 @@ static CounterType getType(String name) { | |||
| try { | |||
| return CounterEnumType.getType(name); | |||
| } catch (final IllegalArgumentException ex) { | |||
There was a problem hiding this comment.
I hate this control flow by exception handling anti-pattern:
we should really try to get rid of it instead of relying even more on it
There was a problem hiding this comment.
That's just the way for Enums
even apache-commons use it for their EnumUtils:
https://github.com/apache/commons-lang/blob/71bd23bb9ec4d27d314ca80ad289821e42e41f72/src/main/java/org/apache/commons/lang3/EnumUtils.java#L219-L228
Typos already happens anyway, they are just treated as CounterKeywordType which is the fallback anyway also, we can't really support custom-types without allowing typos |
Part of #10076
adds an easy extendable List for Counters where colors can be defined