diff --git a/src/main/java/net/slipcor/pvparena/commands/PAA_Set.java b/src/main/java/net/slipcor/pvparena/commands/PAA_Set.java index dac63e4d..628df260 100644 --- a/src/main/java/net/slipcor/pvparena/commands/PAA_Set.java +++ b/src/main/java/net/slipcor/pvparena/commands/PAA_Set.java @@ -7,6 +7,7 @@ import net.slipcor.pvparena.core.Language; import net.slipcor.pvparena.core.Language.MSG; import org.bukkit.ChatColor; +import org.bukkit.GameMode; import org.bukkit.Material; import org.bukkit.command.CommandSender; import org.bukkit.configuration.file.YamlConfiguration; @@ -18,6 +19,7 @@ import java.util.List; import java.util.Map; import java.util.Optional; +import java.util.stream.Stream; import static net.slipcor.pvparena.core.Utils.getSerializableItemStacks; @@ -117,6 +119,13 @@ private void set(final CommandSender player, final Arena arena, final String nod } else if (type == ConfigNodeType.STRING) { arena.getConfig().setManually(node, String.valueOf(value)); arena.msg(player, Language.parse(MSG.SET_DONE, node, value)); + } else if (type == ConfigNodeType.GAMEMODE) { + if(Stream.of(GameMode.values()).anyMatch(gm -> gm.name().equalsIgnoreCase(value))) { + arena.getConfig().setManually(node, value); + arena.msg(player, Language.parse(MSG.SET_DONE, node, value)); + } else { + arena.msg(player, Language.parse(MSG.ERROR_ARGUMENT_TYPE, value, "Gamemode (e.g. SURVIVAL)")); + } } else if (type == ConfigNodeType.INT) { final int iValue; diff --git a/src/main/java/net/slipcor/pvparena/managers/TabManager.java b/src/main/java/net/slipcor/pvparena/managers/TabManager.java index 53b16d1a..03aa79b4 100644 --- a/src/main/java/net/slipcor/pvparena/managers/TabManager.java +++ b/src/main/java/net/slipcor/pvparena/managers/TabManager.java @@ -294,6 +294,8 @@ private static List getKeyMatchesInsideDefinition(final String key, fina } else if ("{EntityType}".equals(definition)) { final EntityType[] entityTypes = EntityType.values(); addEnumMatchesToList(result, key, asList(entityTypes)); + } else if ("{GameMode}".equals(definition)) { + addEnumMatchesToList(result, key, asList(GameMode.values())); } } return result;