Skip to content

Commit

Permalink
fix comments
Browse files Browse the repository at this point in the history
  • Loading branch information
xGinko committed Jan 1, 2025
1 parent b62f3f8 commit d31a091
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerMoveEvent;

import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;

public class IllegalGameMode extends AEFModule implements Listener {

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

String gameModesComment = "GameModes: " + Arrays.stream(GameMode.values()).map(Enum::name).collect(Collectors.joining(", "));

GameMode gameMode;
String configuredGamemode = config.getString(configPath + ".default-gamemode", GameMode.SURVIVAL.name());
String configuredGamemode = config.getString(configPath + ".default-gamemode", GameMode.SURVIVAL.name(), gameModesComment);
try {
gameMode = GameMode.valueOf(configuredGamemode);
} catch (IllegalArgumentException e) {
Expand All @@ -48,10 +52,7 @@ public IllegalGameMode() {
defaults.put("world_nether", GameMode.SURVIVAL.name());
defaults.put("world_the_end", GameMode.SURVIVAL.name());

ConfigSection section = config.getConfigSection(configPath + ".world-gamemodes", defaults,
"Check the paper api for correct EntityType enums:\n" +
"https://jd.papermc.io/paper/1.20.6/org/bukkit/entity/EntityType.html\n" +
"Make sure your minecraft version is matching as well.");
ConfigSection section = config.getConfigSection(configPath + ".world-gamemodes", defaults, gameModesComment);
List<String> worlds = section.getKeys(false);
this.worldSettings = new HashMap<>(worlds.size());
for (String world : worlds) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.event.player.PlayerQuitEvent;

import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;

public class IllegalGameMode extends AEFModule implements Listener {

Expand All @@ -35,8 +37,10 @@ public IllegalGameMode() {
"Useful protection against past and future backdoor incidents.");
this.shouldLog = config.getBoolean(configPath + ".log", true);

String gameModesComment = "GameModes: " + Arrays.stream(GameMode.values()).map(Enum::name).collect(Collectors.joining(", "));

GameMode gameMode;
String configuredGamemode = config.getString(configPath + ".default-gamemode", GameMode.SURVIVAL.name());
String configuredGamemode = config.getString(configPath + ".default-gamemode", GameMode.SURVIVAL.name(), gameModesComment);
try {
gameMode = GameMode.valueOf(configuredGamemode);
} catch (IllegalArgumentException e) {
Expand All @@ -50,10 +54,7 @@ public IllegalGameMode() {
defaults.put("world_nether", GameMode.SURVIVAL.name());
defaults.put("world_the_end", GameMode.SURVIVAL.name());

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

0 comments on commit d31a091

Please sign in to comment.