Skip to content

Commit d31a091

Browse files
committed
fix comments
1 parent b62f3f8 commit d31a091

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/modules/preventions/IllegalGameMode.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,13 @@
1414
import org.bukkit.event.player.PlayerJoinEvent;
1515
import org.bukkit.event.player.PlayerMoveEvent;
1616

17+
import java.util.Arrays;
1718
import java.util.HashMap;
1819
import java.util.HashSet;
1920
import java.util.List;
2021
import java.util.Map;
2122
import java.util.Set;
23+
import java.util.stream.Collectors;
2224

2325
public class IllegalGameMode extends AEFModule implements Listener {
2426

@@ -33,8 +35,10 @@ public IllegalGameMode() {
3335
Useful protection against past and future backdoor incidents""");
3436
this.shouldLog = config.getBoolean(configPath+".log", false);
3537

38+
String gameModesComment = "GameModes: " + Arrays.stream(GameMode.values()).map(Enum::name).collect(Collectors.joining(", "));
39+
3640
GameMode gameMode;
37-
String configuredGamemode = config.getString(configPath + ".default-gamemode", GameMode.SURVIVAL.name());
41+
String configuredGamemode = config.getString(configPath + ".default-gamemode", GameMode.SURVIVAL.name(), gameModesComment);
3842
try {
3943
gameMode = GameMode.valueOf(configuredGamemode);
4044
} catch (IllegalArgumentException e) {
@@ -48,10 +52,7 @@ public IllegalGameMode() {
4852
defaults.put("world_nether", GameMode.SURVIVAL.name());
4953
defaults.put("world_the_end", GameMode.SURVIVAL.name());
5054

51-
ConfigSection section = config.getConfigSection(configPath + ".world-gamemodes", defaults,
52-
"Check the paper api for correct EntityType enums:\n" +
53-
"https://jd.papermc.io/paper/1.20.6/org/bukkit/entity/EntityType.html\n" +
54-
"Make sure your minecraft version is matching as well.");
55+
ConfigSection section = config.getConfigSection(configPath + ".world-gamemodes", defaults, gameModesComment);
5556
List<String> worlds = section.getKeys(false);
5657
this.worldSettings = new HashMap<>(worlds.size());
5758
for (String world : worlds) {

AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/modules/preventions/IllegalGameMode.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,14 @@
1515
import org.bukkit.event.player.PlayerMoveEvent;
1616
import org.bukkit.event.player.PlayerQuitEvent;
1717

18+
import java.util.Arrays;
1819
import java.util.Collections;
1920
import java.util.HashMap;
2021
import java.util.HashSet;
2122
import java.util.List;
2223
import java.util.Map;
2324
import java.util.Set;
25+
import java.util.stream.Collectors;
2426

2527
public 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

Comments
 (0)