1515import org .bukkit .event .player .PlayerMoveEvent ;
1616import org .bukkit .event .player .PlayerQuitEvent ;
1717
18+ import java .util .Arrays ;
1819import java .util .Collections ;
1920import java .util .HashMap ;
2021import java .util .HashSet ;
2122import java .util .List ;
2223import java .util .Map ;
2324import java .util .Set ;
25+ import java .util .stream .Collectors ;
2426
2527public class IllegalGameMode extends AEFModule implements Listener {
2628
@@ -35,8 +37,10 @@ public IllegalGameMode() {
3537 "Useful protection against past and future backdoor incidents." );
3638 this .shouldLog = config .getBoolean (configPath + ".log" , true );
3739
40+ String gameModesComment = "GameModes: " + Arrays .stream (GameMode .values ()).map (Enum ::name ).collect (Collectors .joining (", " ));
41+
3842 GameMode gameMode ;
39- String configuredGamemode = config .getString (configPath + ".default-gamemode" , GameMode .SURVIVAL .name ());
43+ String configuredGamemode = config .getString (configPath + ".default-gamemode" , GameMode .SURVIVAL .name (), gameModesComment );
4044 try {
4145 gameMode = GameMode .valueOf (configuredGamemode );
4246 } catch (IllegalArgumentException e ) {
@@ -50,10 +54,7 @@ public IllegalGameMode() {
5054 defaults .put ("world_nether" , GameMode .SURVIVAL .name ());
5155 defaults .put ("world_the_end" , GameMode .SURVIVAL .name ());
5256
53- ConfigSection section = config .getConfigSection (configPath + ".world-gamemodes" , defaults ,
54- "Check the paper api for correct EntityType enums:\n " +
55- "https://jd.papermc.io/paper/1.20.6/org/bukkit/entity/EntityType.html\n " +
56- "Make sure your minecraft version is matching as well." );
57+ ConfigSection section = config .getConfigSection (configPath + ".world-gamemodes" , defaults , gameModesComment );
5758 List <String > worlds = section .getKeys (false );
5859 this .worldSettings = new HashMap <>(worlds .size ());
5960 for (String world : worlds ) {
0 commit comments