PGM icon indicating copy to clipboard operation
PGM copied to clipboard

Throw a more fitting exception on unrecognized gamemodes

Open RuedigerLP opened this issue 4 years ago • 3 comments

i think id would be good if the gamemodes module would at least ignore unknown gamemodes, if a map was a new gamemode it wouldn't be possible to assign it to a correct gamemode

RuedigerLP avatar Aug 12 '21 23:08 RuedigerLP

The gamemodes for <gamemode> is defined by these two files. All the <gamemode> module does is change/force the title on the right scoreboard (in the future this should force map tags). <gamemode> doesn't allow for arbitrary gamemodes because it's supposed to be translatable. If there are other gamemode names you think should be added, you can add them on to these two files:

https://github.com/PGMDev/PGM/blob/dev/core/src/main/java/tc/oc/pgm/api/map/Gamemode.java https://github.com/PGMDev/PGM/blob/dev/util/src/main/i18n/templates/gamemode.properties

What you're looking for is already included in the <game> module, which lets you display anything.

<!-- displays "DTC and DTM" in the user's language -->
<gamemode>dtc</gamemode>
<gamemode>dtm</gamemode>

<!-- displays "Blast the Big Gold Core" to all users -->
<game>Blast the Big Gold Core</game>

CoWinkKeyDinkInc avatar Aug 12 '21 23:08 CoWinkKeyDinkInc

Right now it throws an error if an unknown gamemode is used, maybe it could just ignore the unknown ones.

RuedigerLP avatar Aug 15 '21 19:08 RuedigerLP

IMO the exception should just be a proper map loading error if you use an invalid gamemode Otherwise we're just hiding a bug in the xml

Pablete1234 avatar Sep 19 '21 07:09 Pablete1234