Przeglądaj źródła

Merge pull request #138 from RedstoneFuture/refactoring/misc

Refactoring: Implement game module system more consistently
RedstoneFuture 5 miesięcy temu
rodzic
commit
37f1559da7
72 zmienionych plików z 1130 dodań i 1202 usunięć
  1. 1 5
      missilewars-plugin/pom.xml
  2. 51 101
      missilewars-plugin/src/main/java/de/butzlabben/missilewars/MissileWars.java
  3. 2 2
      missilewars-plugin/src/main/java/de/butzlabben/missilewars/commands/MWCommandCompletions.java
  4. 50 50
      missilewars-plugin/src/main/java/de/butzlabben/missilewars/commands/MWCommands.java
  5. 56 56
      missilewars-plugin/src/main/java/de/butzlabben/missilewars/commands/SetupCommands.java
  6. 8 8
      missilewars-plugin/src/main/java/de/butzlabben/missilewars/commands/StatsCommands.java
  7. 33 33
      missilewars-plugin/src/main/java/de/butzlabben/missilewars/commands/UserCommands.java
  8. 1 1
      missilewars-plugin/src/main/java/de/butzlabben/missilewars/configuration/ActionSet.java
  9. 50 53
      missilewars-plugin/src/main/java/de/butzlabben/missilewars/configuration/Config.java
  10. 22 24
      missilewars-plugin/src/main/java/de/butzlabben/missilewars/configuration/PluginMessages.java
  11. 15 14
      missilewars-plugin/src/main/java/de/butzlabben/missilewars/configuration/arena/ArenaConfig.java
  12. 4 4
      missilewars-plugin/src/main/java/de/butzlabben/missilewars/configuration/arena/modules/AreaConfig.java
  13. 2 2
      missilewars-plugin/src/main/java/de/butzlabben/missilewars/configuration/arena/modules/ArrowConfig.java
  14. 2 2
      missilewars-plugin/src/main/java/de/butzlabben/missilewars/configuration/arena/modules/EquipmentIntervalConfig.java
  15. 2 2
      missilewars-plugin/src/main/java/de/butzlabben/missilewars/configuration/arena/modules/FallProtectionConfig.java
  16. 2 2
      missilewars-plugin/src/main/java/de/butzlabben/missilewars/configuration/arena/modules/FireballConfig.java
  17. 2 2
      missilewars-plugin/src/main/java/de/butzlabben/missilewars/configuration/arena/modules/GameRespawnConfig.java
  18. 2 2
      missilewars-plugin/src/main/java/de/butzlabben/missilewars/configuration/arena/modules/GameSpawnConfig.java
  19. 2 2
      missilewars-plugin/src/main/java/de/butzlabben/missilewars/configuration/arena/modules/MissileConfig.java
  20. 2 2
      missilewars-plugin/src/main/java/de/butzlabben/missilewars/configuration/arena/modules/MoneyConfig.java
  21. 2 2
      missilewars-plugin/src/main/java/de/butzlabben/missilewars/configuration/arena/modules/ShieldConfig.java
  22. 13 33
      missilewars-plugin/src/main/java/de/butzlabben/missilewars/configuration/game/GameConfig.java
  23. 2 2
      missilewars-plugin/src/main/java/de/butzlabben/missilewars/configuration/game/modules/GameTeamConfig.java
  24. 56 0
      missilewars-plugin/src/main/java/de/butzlabben/missilewars/configuration/game/modules/LobbyConfig.java
  25. 19 18
      missilewars-plugin/src/main/java/de/butzlabben/missilewars/game/Arenas.java
  26. 62 63
      missilewars-plugin/src/main/java/de/butzlabben/missilewars/game/Game.java
  27. 14 14
      missilewars-plugin/src/main/java/de/butzlabben/missilewars/game/GameJoinManager.java
  28. 9 7
      missilewars-plugin/src/main/java/de/butzlabben/missilewars/game/GameLeaveManager.java
  29. 53 69
      missilewars-plugin/src/main/java/de/butzlabben/missilewars/game/GameManager.java
  30. 17 17
      missilewars-plugin/src/main/java/de/butzlabben/missilewars/game/GameResultManager.java
  31. 4 4
      missilewars-plugin/src/main/java/de/butzlabben/missilewars/game/GameWorld.java
  32. 36 36
      missilewars-plugin/src/main/java/de/butzlabben/missilewars/game/MapVoting.java
  33. 2 2
      missilewars-plugin/src/main/java/de/butzlabben/missilewars/game/Team.java
  34. 6 6
      missilewars-plugin/src/main/java/de/butzlabben/missilewars/game/TeamManager.java
  35. 15 3
      missilewars-plugin/src/main/java/de/butzlabben/missilewars/game/enums/GameState.java
  36. 7 7
      missilewars-plugin/src/main/java/de/butzlabben/missilewars/game/equipment/EquipmentManager.java
  37. 17 17
      missilewars-plugin/src/main/java/de/butzlabben/missilewars/game/equipment/PlayerEquipmentRandomizer.java
  38. 2 2
      missilewars-plugin/src/main/java/de/butzlabben/missilewars/game/equipment/SchematicGameEquipment.java
  39. 4 4
      missilewars-plugin/src/main/java/de/butzlabben/missilewars/game/equipment/SpecialGameEquipment.java
  40. 55 54
      missilewars-plugin/src/main/java/de/butzlabben/missilewars/game/misc/MissileWarsPlaceholder.java
  41. 3 3
      missilewars-plugin/src/main/java/de/butzlabben/missilewars/game/misc/MotdManager.java
  42. 4 4
      missilewars-plugin/src/main/java/de/butzlabben/missilewars/game/misc/RespawnGoldBlock.java
  43. 3 5
      missilewars-plugin/src/main/java/de/butzlabben/missilewars/game/misc/ScoreboardManager.java
  44. 3 3
      missilewars-plugin/src/main/java/de/butzlabben/missilewars/game/schematics/SchematicFacing.java
  45. 3 3
      missilewars-plugin/src/main/java/de/butzlabben/missilewars/game/schematics/objects/Missile.java
  46. 2 2
      missilewars-plugin/src/main/java/de/butzlabben/missilewars/game/schematics/objects/Shield.java
  47. 0 49
      missilewars-plugin/src/main/java/de/butzlabben/missilewars/game/schematics/paste/PasteProvider.java
  48. 13 10
      missilewars-plugin/src/main/java/de/butzlabben/missilewars/game/signs/MWSign.java
  49. 1 1
      missilewars-plugin/src/main/java/de/butzlabben/missilewars/game/signs/SignRepository.java
  50. 1 1
      missilewars-plugin/src/main/java/de/butzlabben/missilewars/game/signs/SignUpdateRunnable.java
  51. 1 1
      missilewars-plugin/src/main/java/de/butzlabben/missilewars/game/stats/FightStats.java
  52. 2 2
      missilewars-plugin/src/main/java/de/butzlabben/missilewars/game/timer/EndTimer.java
  53. 7 7
      missilewars-plugin/src/main/java/de/butzlabben/missilewars/game/timer/GameTimer.java
  54. 7 7
      missilewars-plugin/src/main/java/de/butzlabben/missilewars/game/timer/LobbyTimer.java
  55. 48 0
      missilewars-plugin/src/main/java/de/butzlabben/missilewars/initialization/ConfigLoader.java
  56. 181 0
      missilewars-plugin/src/main/java/de/butzlabben/missilewars/initialization/FileManager.java
  57. 29 0
      missilewars-plugin/src/main/java/de/butzlabben/missilewars/initialization/GamesInitialization.java
  58. 5 5
      missilewars-plugin/src/main/java/de/butzlabben/missilewars/listener/PlayerListener.java
  59. 10 10
      missilewars-plugin/src/main/java/de/butzlabben/missilewars/listener/SignListener.java
  60. 8 8
      missilewars-plugin/src/main/java/de/butzlabben/missilewars/listener/game/EndListener.java
  61. 21 21
      missilewars-plugin/src/main/java/de/butzlabben/missilewars/listener/game/GameListener.java
  62. 4 4
      missilewars-plugin/src/main/java/de/butzlabben/missilewars/listener/game/LobbyListener.java
  63. 4 4
      missilewars-plugin/src/main/java/de/butzlabben/missilewars/menus/ItemRequirement.java
  64. 3 3
      missilewars-plugin/src/main/java/de/butzlabben/missilewars/menus/MenuItem.java
  65. 12 13
      missilewars-plugin/src/main/java/de/butzlabben/missilewars/menus/inventory/MapVoteMenu.java
  66. 2 2
      missilewars-plugin/src/main/java/de/butzlabben/missilewars/util/MoneyUtil.java
  67. 0 34
      missilewars-plugin/src/main/java/de/butzlabben/missilewars/util/PlayerUtil.java
  68. 0 245
      missilewars-plugin/src/main/java/de/butzlabben/missilewars/util/SetupUtil.java
  69. 4 4
      missilewars-plugin/src/main/java/de/butzlabben/missilewars/util/geometry/GameArea.java
  70. 2 2
      missilewars-plugin/src/main/java/de/butzlabben/missilewars/util/stats/PlayerGuiFactory.java
  71. 37 21
      missilewars-plugin/src/main/java/de/butzlabben/missilewars/util/version/VersionUtil.java
  72. 6 1
      pom.xml

+ 1 - 5
missilewars-plugin/pom.xml

@@ -26,7 +26,7 @@
         <version>1.0</version>
     </parent>
 
-    <version>4.8.0</version>
+    <version>5.0.0-rc.1</version>
 
     <modelVersion>4.0.0</modelVersion>
 
@@ -52,7 +52,6 @@
             <groupId>de.butzlabben</groupId>
             <artifactId>FAWE_Paster</artifactId>
             <version>1.0</version>
-            <scope>compile</scope>
         </dependency>
         <!-- Other dependencies -->
 
@@ -75,7 +74,6 @@
             <groupId>com.fasterxml.jackson.core</groupId>
             <artifactId>jackson-databind</artifactId>
             <version>2.16.2</version>
-            <scope>compile</scope>
         </dependency>
 
         <!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.dataformat/jackson-dataformat-yaml -->
@@ -83,14 +81,12 @@
             <groupId>com.fasterxml.jackson.dataformat</groupId>
             <artifactId>jackson-dataformat-yaml</artifactId>
             <version>2.16.2</version>
-            <scope>compile</scope>
         </dependency>
 
         <dependency>
             <groupId>org.bstats</groupId>
             <artifactId>bstats-bukkit</artifactId>
             <version>3.0.2</version>
-            <scope>compile</scope>
         </dependency>
 
         <!-- https://mvnrepository.com/artifact/com.github.MilkBowl/VaultAPI -->

+ 51 - 101
missilewars-plugin/src/main/java/de/butzlabben/missilewars/MissileWars.java

@@ -21,30 +21,25 @@ package de.butzlabben.missilewars;
 import co.aikar.commands.PaperCommandManager;
 import de.butzlabben.missilewars.commands.*;
 import de.butzlabben.missilewars.configuration.Config;
-import de.butzlabben.missilewars.configuration.Messages;
-import de.butzlabben.missilewars.game.Arenas;
 import de.butzlabben.missilewars.game.GameManager;
 import de.butzlabben.missilewars.game.misc.MissileWarsPlaceholder;
-import de.butzlabben.missilewars.game.signs.CheckRunnable;
+import de.butzlabben.missilewars.game.schematics.paste.FawePasteProvider;
+import de.butzlabben.missilewars.game.schematics.paste.Paster;
 import de.butzlabben.missilewars.game.signs.SignRepository;
 import de.butzlabben.missilewars.game.stats.StatsFetcher;
+import de.butzlabben.missilewars.initialization.FileManager;
+import de.butzlabben.missilewars.initialization.GamesInitialization;
 import de.butzlabben.missilewars.listener.PlayerListener;
 import de.butzlabben.missilewars.listener.SignListener;
-import de.butzlabben.missilewars.player.PlayerData;
 import de.butzlabben.missilewars.util.ConnectionHolder;
 import de.butzlabben.missilewars.util.MoneyUtil;
-import de.butzlabben.missilewars.util.SetupUtil;
 import de.butzlabben.missilewars.util.stats.PreFetcher;
 import de.butzlabben.missilewars.util.version.VersionUtil;
 import lombok.Getter;
-import org.apache.commons.io.FileUtils;
 import org.bstats.bukkit.Metrics;
 import org.bukkit.Bukkit;
-import org.bukkit.configuration.serialization.ConfigurationSerialization;
-import org.bukkit.entity.Player;
 import org.bukkit.plugin.java.JavaPlugin;
 
-import java.io.File;
 import java.util.Date;
 
 /**
@@ -60,14 +55,12 @@ public class MissileWars extends JavaPlugin {
     public final String version = getDescription().getVersion();
     private SignRepository signRepository;
     public PaperCommandManager commandManager;
-
-    private boolean foundFAWE;
-
-    @Getter
-    private PlayerListener playerListener;
-    @Getter
-    private SignListener signListener;
-
+    
+    @Getter private PlayerListener playerListener;
+    @Getter private SignListener signListener;
+    
+    @Getter private Paster schematicPaster;
+    
     public MissileWars() {
         instance = this;
     }
@@ -82,73 +75,66 @@ public class MissileWars extends JavaPlugin {
         sendPluginInfo();
 
         Logger.BOOT.log("Loading properties...");
-
-        // delete old missile wars temp-worlds from the last server session
-        deleteTempWorlds();
-
-        Config.load();
-        Messages.load();
-        SetupUtil.saveDefaultSchematics(new File(Config.getMissilesFolder()), "missiles.zip");
-        SetupUtil.saveDefaultSchematics(new File(Config.getShieldsFolder()), "shields.zip");
-
-        new File(Config.getLobbiesFolder()).mkdirs();
-
-        this.signRepository = SignRepository.load();
-
+        
+        FileManager.setupRoutine();
+        
+        signRepository = SignRepository.load();
+        
         registerEvents();
         registerCommands();
 
-        Arenas.load();
-
-        GameManager.getInstance().loadGamesOnStartup();
-
+        // special Dependency-Management:
         new Metrics(this, 3749);
-
-        // Check if FAWE is installed
-        foundFAWE = Bukkit.getPluginManager().getPlugin("FastAsyncWorldEdit") != null;
-
-        GameManager.getInstance().getGames().values().forEach(game -> {
-            for (Player player : Bukkit.getOnlinePlayers()) {
-                if (!game.isIn(player.getLocation())) continue;
-                game.teleportToLobbySpawn(player);
-            }
-        });
-
+        
+        initialWeSupport();
+        initialPapiSupport();
         MoneyUtil.giveMoney(null, -1);
-
-        Bukkit.getScheduler().runTaskTimerAsynchronously(this, new CheckRunnable(), 20, 20 * 10);
-
+        
+        GamesInitialization.initialize();
+        
+        // Warm-up for Stats:
         if (Config.isPrefetchPlayers()) {
             PreFetcher.preFetchPlayers(new StatsFetcher(new Date(0L), ""));
         }
-
-        checkPlaceholderAPI();
-
-        ConfigurationSerialization.registerClass(PlayerData.class);
-
+        
         endTime = System.currentTimeMillis();
         Logger.SUCCESS.log("MissileWars was enabled in " + (endTime - startTime) + "ms");
+        
     }
 
     @Override
     public void onDisable() {
+        
         GameManager.getInstance().disableAll();
-        deleteTempWorlds();
-
+        FileManager.shotDownRoutine();
         ConnectionHolder.close();
     }
+    
+    /**
+     * This method checks which kind of WorldEdit Solution is installed. The paste 
+     * supplier is prepared on the basis of this.
+     */
+    private void initialWeSupport() {
+        if (Bukkit.getPluginManager().getPlugin("FastAsyncWorldEdit") != null) {
+            schematicPaster = new FawePasteProvider();
+            Logger.NORMAL.log("FastAsyncWorldEdit is installed. The Schematic Paster is prepared for the behavior of FAWE.");
+        } else {
+            schematicPaster = new FawePasteProvider();
+            Logger.NORMAL.log("(Normal) WorldEdit is installed. The Schematic Paster is prepared for the behavior of WE.");
+        }
+    }
 
     /**
      * This method checks if the PlaceholderAPI is installed. When it is
      * installed, a message is sent to the log.
      */
-    private void checkPlaceholderAPI() {
+    private void initialPapiSupport() {
         if (Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) {
             new MissileWarsPlaceholder(this).register();
             Logger.NORMAL.log("The PlaceholderAPI is installed. New placeholders are provided by MissileWars.");
         }
     }
-
+    
     /**
      * This method registers all events of the MissileWars event listener.
      */
@@ -178,33 +164,7 @@ public class MissileWars extends JavaPlugin {
         commandManager.registerCommand(new UserCommands());
         commandManager.registerCommand(new SetupCommands());
     }
-
-    /**
-     * This method checks if FAWE (FastAsyncWorldEdit) is installed.
-     *
-     * @return true, if it's installed
-     */
-    public boolean foundFAWE() {
-        return foundFAWE;
-    }
-
-    /**
-     * This methode deletes the temp arena worlds of the MW game.
-     */
-    private void deleteTempWorlds() {
-        File[] dirs = Bukkit.getWorldContainer().listFiles();
-        if (dirs == null) return;
-
-        for (File dir : dirs) {
-            if (dir.getName().startsWith("mw-")) {
-                try {
-                    FileUtils.deleteDirectory(dir);
-                } catch (Exception ignored) {
-                }
-            }
-        }
-    }
-
+    
     /**
      * This method sends information about the version, version
      * warnings (if necessary) and authors in the console.
@@ -215,26 +175,16 @@ public class MissileWars extends JavaPlugin {
 
         if (VersionUtil.getVersion() < 20) {
             Logger.WARN.log("====================================================");
-            Logger.WARN.log("It seems that you are using version older than 1.20");
-            Logger.WARN.log("There is no guarantee for this to work");
-            Logger.WARN.log("Proceed with extreme caution");
+            Logger.WARN.log("It seems that you are using version older than 1.20.");
+            Logger.WARN.log("There is no guarantee for this to work.");
             Logger.WARN.log("====================================================");
         }
 
-        if (version.contains("beta")) {
-            Logger.WARN.log("NOTE: This is a beta version which means, that it may not be fully stable");
-        }
-
-        if (getDescription().getAuthors().size() > 1) {
-            StringBuilder sb = new StringBuilder();
-            for (String author : getDescription().getAuthors()) {
-                if (author.equals("Butzlabben"))
-                    continue;
-                sb.append(author);
-                sb.append(" ");
-            }
-            Logger.BOOT.log("Other authors: " + sb);
+        if (version.contains("snapshot") || version.contains("dev")) {
+            Logger.WARN.log("NOTE: This is a snapshot for testing. Errors may occur in new or revised modules. " +
+                    "Do not use this version on a production server!");
         }
+        
     }
-
+    
 }

+ 2 - 2
missilewars-plugin/src/main/java/de/butzlabben/missilewars/commands/MWCommandCompletions.java

@@ -57,7 +57,7 @@ public class MWCommandCompletions {
             Game game = GameManager.getInstance().getGame(player.getLocation());
             if (game == null) return null;
 
-            return game.getArena().getMissileConfiguration().getSchematicNames();
+            return game.getArenaConfig().getMissileConfig().getSchematicNames();
         });
     }
     
@@ -88,7 +88,7 @@ public class MWCommandCompletions {
             Game game = GameManager.getInstance().getGame(player.getLocation());
             if (game == null) return null;
 
-            return game.getLobby().getPossibleArenas();
+            return game.getGameConfig().getPossibleArenas();
         });
     }
     

+ 50 - 50
missilewars-plugin/src/main/java/de/butzlabben/missilewars/commands/MWCommands.java

@@ -23,7 +23,7 @@ import co.aikar.commands.annotation.*;
 import de.butzlabben.missilewars.Logger;
 import de.butzlabben.missilewars.MissileWars;
 import de.butzlabben.missilewars.configuration.Config;
-import de.butzlabben.missilewars.configuration.Messages;
+import de.butzlabben.missilewars.configuration.PluginMessages;
 import de.butzlabben.missilewars.game.*;
 import de.butzlabben.missilewars.game.enums.GameResult;
 import de.butzlabben.missilewars.game.enums.GameState;
@@ -31,6 +31,7 @@ import de.butzlabben.missilewars.game.enums.TeamType;
 import de.butzlabben.missilewars.game.enums.VoteState;
 import de.butzlabben.missilewars.game.schematics.objects.Missile;
 import de.butzlabben.missilewars.game.timer.LobbyTimer;
+import de.butzlabben.missilewars.initialization.ConfigLoader;
 import de.butzlabben.missilewars.player.MWPlayer;
 import de.butzlabben.missilewars.util.MaterialUtil;
 import org.bukkit.Material;
@@ -74,7 +75,7 @@ public class MWCommands extends BaseCommand {
     @CommandPermission("mw.version")
     public void versionCommand(CommandSender sender, String[] args) {
         
-        sender.sendMessage(Messages.getPrefix() + "Installed version: " + MissileWars.getInstance().version + " by RedstoneFuture & Butzlabben");
+        sender.sendMessage(PluginMessages.getPrefix() + "Installed version: " + MissileWars.getInstance().version + " by RedstoneFuture & Butzlabben");
     }
 
     @Subcommand("listgames|list|games")
@@ -82,21 +83,21 @@ public class MWCommands extends BaseCommand {
     @CommandPermission("mw.listgames")
     public void listgamesCommand(CommandSender sender, String[] args) {
 
-        sender.sendMessage(Messages.getPrefix() + "Current games:");
+        sender.sendMessage(PluginMessages.getPrefix() + "Current games:");
         
         sender.sendMessage(" ");
         
         for (Game game : GameManager.getInstance().getGames().values()) {
             TeamManager teamManager = game.getTeamManager();
             
-            sender.sendMessage("§e " + game.getLobby().getName() 
-                    + "§7 -- Name: »" + game.getLobby().getDisplayName() 
+            sender.sendMessage("§e " + game.getGameConfig().getName() 
+                    + "§7 -- Name: »" + game.getGameConfig().getDisplayName() 
                     + "§7« | Status: " + game.getState());
             
-            sender.sendMessage("§8 - §f" + "Load with startup: §7" + game.getLobby().isAutoLoad());
+            sender.sendMessage("§8 - §f" + "Load with startup: §7" + game.getGameConfig().isAutoLoad());
             
-            sender.sendMessage("§8 - §f" + "Current Arena: §7" + ((game.getArena() != null) ? game.getArena().getName() : "?") 
-                    + "§7 -- Name: »" + ((game.getArena() != null) ? game.getArena().getDisplayName() : "?") + "§7«");
+            sender.sendMessage("§8 - §f" + "Current Arena: §7" + ((game.getArenaConfig() != null) ? game.getArenaConfig().getName() : "?") 
+                    + "§7 -- Name: »" + ((game.getArenaConfig() != null) ? game.getArenaConfig().getDisplayName() : "?") + "§7«");
             
             sender.sendMessage("§8 - §f" + "Total players: §7" + game.getTotalGameUserAmount() + "x");
             
@@ -123,31 +124,31 @@ public class MWCommands extends BaseCommand {
         Player player = (Player) sender;
 
         if (args.length < 2) {
-            player.sendMessage(Messages.getMessage(true, Messages.MessageEnum.COMMAND_TEAM_NUMBER_NEEDED));
+            player.sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.COMMAND_TEAM_NUMBER_NEEDED));
             return;
         }
 
         if (args.length > 2) {
-            player.sendMessage(Messages.getMessage(true, Messages.MessageEnum.COMMAND_TO_MANY_ARGUMENTS));
+            player.sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.COMMAND_TO_MANY_ARGUMENTS));
             return;
         }
 
         Game game = GameManager.getInstance().getGame(player.getLocation());
         if (game == null) {
-            player.sendMessage(Messages.getMessage(true, Messages.MessageEnum.GAME_NOT_IN_GAME_AREA));
+            player.sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.GAME_NOT_IN_GAME_AREA));
             return;
         }
         
         Player targetPlayer = MissileWars.getInstance().getServer().getPlayer(args[0]);
         if (targetPlayer == null) {
-            player.sendMessage(Messages.getMessage(true, Messages.MessageEnum.COMMAND_INVALID_PLAYER_NOT_ONLINE)
+            player.sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.COMMAND_INVALID_PLAYER_NOT_ONLINE)
                     .replace("%input%", args[0]));
             return;
         }
         
         MWPlayer targetMwPlayer = game.getPlayer(targetPlayer);
         if (targetMwPlayer == null) {
-            player.sendMessage(Messages.getMessage(true, Messages.MessageEnum.COMMAND_INVALID_PLAYER_NOT_IN_GAME)
+            player.sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.COMMAND_INVALID_PLAYER_NOT_IN_GAME)
                     .replace("%input%", args[0]));
             return;
         }
@@ -172,13 +173,13 @@ public class MWCommands extends BaseCommand {
                 to = game.getTeamManager().getTeamSpec();
                 break;
             default:
-                sender.sendMessage(Messages.getMessage(true, Messages.MessageEnum.COMMAND_INVALID_TEAM));
+                sender.sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.COMMAND_INVALID_TEAM));
                 return;
         }
         
         // Is the same team?
         if (from == to) {
-            player.sendMessage(Messages.getMessage(true, Messages.MessageEnum.TEAM_MOVE_ALREADY_IN_TEAM)
+            player.sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.TEAM_MOVE_ALREADY_IN_TEAM)
                     .replace("%player%", targetPlayer.getName()));
             return;
         }
@@ -186,25 +187,25 @@ public class MWCommands extends BaseCommand {
         if (game.getState() != GameState.END) {
             // Is the player the last one from his team?
             if ((from.getTeamType() == TeamType.PLAYER) && (from.getMembers().size() == 1)) {
-                player.sendMessage(Messages.getMessage(true, Messages.MessageEnum.TEAM_MOVE_IS_LAST_PLAYER)
+                player.sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.TEAM_MOVE_IS_LAST_PLAYER)
                     .replace("%from%", from.getFullname()));
                 return;
             }
             
         } else {
-            player.sendMessage(Messages.getMessage(true, Messages.MessageEnum.TEAM_MOVE_TEAM_NOT_NOW));
+            player.sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.TEAM_MOVE_TEAM_NOT_NOW));
             return;
             
         }
         
         // The "isValidFairSwitch()" validation and max-user check is skipped here.
         
-        sender.sendMessage(Messages.getMessage(true, Messages.MessageEnum.TEAM_MOVE_MOVED_SENDER)
+        sender.sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.TEAM_MOVE_MOVED_SENDER)
                 .replace("%player%", targetPlayer.getName())
                 .replace("%from%", from.getFullname())
                 .replace("%to%", to.getFullname()));
         
-        targetPlayer.sendMessage(Messages.getMessage(true, Messages.MessageEnum.TEAM_MOVE_MOVED_TARGET)
+        targetPlayer.sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.TEAM_MOVE_MOVED_TARGET)
                 .replace("%sender%", player.getName())
                 .replace("%from%", from.getFullname())
                 .replace("%to%", to.getFullname()));
@@ -221,24 +222,24 @@ public class MWCommands extends BaseCommand {
         Player player = (Player) sender;
 
         if (args.length < 1) {
-            player.sendMessage(Messages.getMessage(true, Messages.MessageEnum.COMMAND_MISSILE_NEEDED));
+            player.sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.COMMAND_MISSILE_NEEDED));
             return;
         }
 
         if (args.length > 5) {
-            player.sendMessage(Messages.getMessage(true, Messages.MessageEnum.COMMAND_TO_MANY_ARGUMENTS));
+            player.sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.COMMAND_TO_MANY_ARGUMENTS));
             return;
         }
 
         Game game = GameManager.getInstance().getGame(player.getLocation());
         if (game == null) {
-            player.sendMessage(Messages.getMessage(true, Messages.MessageEnum.GAME_NOT_IN_GAME_AREA));
+            player.sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.GAME_NOT_IN_GAME_AREA));
             return;
         }
 
-        Missile missile = (Missile) game.getArena().getMissileConfiguration().getSchematicFromFileName(args[0]);
+        Missile missile = (Missile) game.getArenaConfig().getMissileConfig().getSchematicFromFileName(args[0]);
         if (missile == null) {
-            player.sendMessage(Messages.getMessage(true, Messages.MessageEnum.COMMAND_INVALID_MISSILE)
+            player.sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.COMMAND_INVALID_MISSILE)
                     .replace("%input%", args[0]));
             return;
         }
@@ -269,7 +270,7 @@ public class MWCommands extends BaseCommand {
         
         missile.paste(game, player, hasTempBlock, tempBlockMaterial, tempBlockDelay, tempBlockRadius);
         
-        sender.sendMessage(Messages.getPrefix() + "Missile §7" + missile.getDisplayName() + " §fis placed.");
+        sender.sendMessage(PluginMessages.getPrefix() + "Missile §7" + missile.getDisplayName() + " §fis placed.");
         sender.sendMessage("§8 - §f" + "Temp-Block (for block-updater) enabled: §7" + hasTempBlock);
         sender.sendMessage("§8 - §f" + "Temp-Block material: §7" + tempBlockMaterial);
         sender.sendMessage("§8 - §f" + "Temp-Block delay: §7" + tempBlockDelay + " server ticks");
@@ -287,7 +288,7 @@ public class MWCommands extends BaseCommand {
         Player player = (Player) sender;
 
         if (args.length > 1) {
-            player.sendMessage(Messages.getMessage(true, Messages.MessageEnum.COMMAND_TO_MANY_ARGUMENTS));
+            player.sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.COMMAND_TO_MANY_ARGUMENTS));
             return;
         }
 
@@ -296,20 +297,20 @@ public class MWCommands extends BaseCommand {
         if (args.length == 1) {
             game = GameManager.getInstance().getGame(args[0]);
             if (game == null) {
-                player.sendMessage(Messages.getMessage(true, Messages.MessageEnum.COMMAND_INVALID_GAME)
+                player.sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.COMMAND_INVALID_GAME)
                         .replace("%input%", args[0]));
                 return;
             }
         } else {
             game = GameManager.getInstance().getGame(player.getLocation());
             if (game == null) {
-                player.sendMessage(Messages.getMessage(true, Messages.MessageEnum.GAME_NOT_IN_GAME_AREA));
+                player.sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.GAME_NOT_IN_GAME_AREA));
                 return;
             }
         }
 
         if (game.getState() != GameState.LOBBY) {
-            player.sendMessage(Messages.getMessage(true, Messages.MessageEnum.GAME_ALREADY_STARTET));
+            player.sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.GAME_ALREADY_STARTET));
             return;
         }
 
@@ -317,7 +318,7 @@ public class MWCommands extends BaseCommand {
             if (game.getMapVoting().getState() == VoteState.RUNNING) {
                 game.getMapVoting().setVotedArena();
             } else {
-                player.sendMessage(Messages.getMessage(true, Messages.MessageEnum.GAME_CAN_NOT_STARTET));
+                player.sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.GAME_CAN_NOT_STARTET));
                 return;
             }
         }
@@ -335,7 +336,7 @@ public class MWCommands extends BaseCommand {
         Player player = (Player) sender;
 
         if (args.length > 1) {
-            player.sendMessage(Messages.getMessage(true, Messages.MessageEnum.COMMAND_TO_MANY_ARGUMENTS));
+            player.sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.COMMAND_TO_MANY_ARGUMENTS));
             return;
         }
 
@@ -344,14 +345,14 @@ public class MWCommands extends BaseCommand {
         if (args.length == 1) {
             game = GameManager.getInstance().getGame(args[0]);
             if (game == null) {
-                player.sendMessage(Messages.getMessage(true, Messages.MessageEnum.COMMAND_INVALID_GAME)
+                player.sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.COMMAND_INVALID_GAME)
                         .replace("%input%", args[0]));
                 return;
             }
         } else {
             game = GameManager.getInstance().getGame(player.getLocation());
             if (game == null) {
-                player.sendMessage(Messages.getMessage(true, Messages.MessageEnum.GAME_NOT_IN_GAME_AREA));
+                player.sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.GAME_NOT_IN_GAME_AREA));
                 return;
             }
         }
@@ -370,7 +371,7 @@ public class MWCommands extends BaseCommand {
         Player player = (Player) sender;
 
         if (args.length > 1) {
-            player.sendMessage(Messages.getMessage(true, Messages.MessageEnum.COMMAND_TO_MANY_ARGUMENTS));
+            player.sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.COMMAND_TO_MANY_ARGUMENTS));
             return;
         }
 
@@ -379,26 +380,26 @@ public class MWCommands extends BaseCommand {
         if (args.length == 1) {
             game = GameManager.getInstance().getGame(args[0]);
             if (game == null) {
-                player.sendMessage(Messages.getMessage(true, Messages.MessageEnum.COMMAND_INVALID_GAME)
+                player.sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.COMMAND_INVALID_GAME)
                         .replace("%input%", args[0]));
                 return;
             }
         } else {
             game = GameManager.getInstance().getGame(player.getLocation());
             if (game == null) {
-                player.sendMessage(Messages.getMessage(true, Messages.MessageEnum.GAME_NOT_IN_GAME_AREA));
+                player.sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.GAME_NOT_IN_GAME_AREA));
                 return;
             }
         }
 
         GameManager.getInstance().getGames().values().forEach(Game::appendRestart);
-        sender.sendMessage(Messages.getMessage(true, Messages.MessageEnum.SERVER_RESTART_AFTER_GAME));
+        sender.sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.SERVER_RESTART_AFTER_GAME));
     }
 
     static boolean senderIsPlayer(CommandSender sender) {
         if (sender instanceof Player) return true;
 
-        sender.sendMessage(Messages.getMessage(true, Messages.MessageEnum.COMMAND_ONLY_PLAYERS));
+        sender.sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.COMMAND_ONLY_PLAYERS));
         return false;
     }
 
@@ -411,15 +412,14 @@ public class MWCommands extends BaseCommand {
         Player player = (Player) sender;
 
         if (args.length > 0) {
-            player.sendMessage(Messages.getMessage(true, Messages.MessageEnum.COMMAND_TO_MANY_ARGUMENTS));
+            player.sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.COMMAND_TO_MANY_ARGUMENTS));
             return;
         }
 
-        Config.load();
-        Messages.load();
+        ConfigLoader.loadConfigs();
         Arenas.load();
 
-        player.sendMessage(Messages.getMessage(true, Messages.MessageEnum.DEBUG_RELOAD_CONFIG));
+        player.sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.DEBUG_RELOAD_CONFIG));
     }
 
     @Subcommand("debug")
@@ -431,18 +431,18 @@ public class MWCommands extends BaseCommand {
         Player player = (Player) sender;
 
         if (args.length > 0) {
-            player.sendMessage(Messages.getMessage(true, Messages.MessageEnum.COMMAND_TO_MANY_ARGUMENTS));
+            player.sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.COMMAND_TO_MANY_ARGUMENTS));
             return;
         }
 
         int i = 0;
         Logger.NORMAL.log("Starting to print debug information for MissileWars v" + MissileWars.getInstance().version);
         for (Game game : GameManager.getInstance().getGames().values()) {
-            Logger.NORMAL.log("Printing state for arena " + game.getArena().getName() + ". Number: " + i);
+            Logger.NORMAL.log("Printing state for arena " + game.getArenaConfig().getName() + ". Number: " + i);
             Logger.NORMAL.log(game.toString());
         }
 
-        player.sendMessage(Messages.getMessage(true, Messages.MessageEnum.DEBUG_PRINTED_DEBUG_MSG));
+        player.sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.DEBUG_PRINTED_DEBUG_MSG));
     }
 
     @Subcommand("restartall")
@@ -454,26 +454,26 @@ public class MWCommands extends BaseCommand {
         Player player = (Player) sender;
 
         if (args.length > 0) {
-            player.sendMessage(Messages.getMessage(true, Messages.MessageEnum.COMMAND_TO_MANY_ARGUMENTS));
+            player.sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.COMMAND_TO_MANY_ARGUMENTS));
             return;
         }
 
         if (GameManager.getInstance().getGames().size() > 10) {
-            player.sendMessage(Messages.getMessage(true, Messages.MessageEnum.DEBUG_RESTART_ALL_GAMES_WARN));
+            player.sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.DEBUG_RESTART_ALL_GAMES_WARN));
         }
 
         GameManager.getInstance().restartAll();
-        player.sendMessage(Messages.getMessage(true, Messages.MessageEnum.DEBUG_RESTART_ALL_GAMES));
+        player.sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.DEBUG_RESTART_ALL_GAMES));
     }
 
     static void sendHelpMessage(CommandSender sender, String permission, String command, String description) {
         if (sender instanceof Player) {
             if (!sender.hasPermission(permission)) return;
         }
-        sender.sendMessage(Messages.getPrefix() + command + " - " + description);
+        sender.sendMessage(PluginMessages.getPrefix() + command + " - " + description);
     }
     
     static void sendHelpMessage(CommandSender sender, String command, String description) {
-        sender.sendMessage(Messages.getPrefix() + command + " - " + description);
+        sender.sendMessage(PluginMessages.getPrefix() + command + " - " + description);
     }
 }

+ 56 - 56
missilewars-plugin/src/main/java/de/butzlabben/missilewars/commands/SetupCommands.java

@@ -25,7 +25,7 @@ import co.aikar.commands.annotation.CommandPermission;
 import co.aikar.commands.annotation.Default;
 import co.aikar.commands.annotation.Subcommand;
 import de.butzlabben.missilewars.configuration.Config;
-import de.butzlabben.missilewars.configuration.Messages;
+import de.butzlabben.missilewars.configuration.PluginMessages;
 import de.butzlabben.missilewars.game.Game;
 import de.butzlabben.missilewars.game.GameManager;
 import org.bukkit.command.CommandSender;
@@ -41,7 +41,7 @@ public class SetupCommands extends BaseCommand {
     @Default
     @CommandPermission("mw.setup")
     public void setupCommands(CommandSender sender, String[] args) {
-        sender.sendMessage(Messages.getPrefix() + "§fSetup usage: §7/mw setup <main|lobby|arena> ...");
+        sender.sendMessage(PluginMessages.getPrefix() + "§fSetup usage: §7/mw setup <main|lobby|arena> ...");
     }
 
     @Subcommand("main")
@@ -56,7 +56,7 @@ public class SetupCommands extends BaseCommand {
                 if (!senderIsPlayer(sender)) return;
 
                 Config.setFallbackSpawn(player.getLocation());
-                player.sendMessage(Messages.getPrefix() + "§fSet new 'fallbackSpawn' to " + player.getLocation() + ".");
+                player.sendMessage(PluginMessages.getPrefix() + "§fSet new 'fallbackSpawn' to " + player.getLocation() + ".");
             }
 
             @Subcommand("teleport|tp")
@@ -65,7 +65,7 @@ public class SetupCommands extends BaseCommand {
                 if (!senderIsPlayer(sender)) return;
 
                 player.teleport(Config.getFallbackSpawn());
-                player.sendMessage(Messages.getPrefix() + "§fTeleported to 'fallbackSpawn'.");
+                player.sendMessage(PluginMessages.getPrefix() + "§fTeleported to 'fallbackSpawn'.");
             }
 
         }
@@ -84,7 +84,7 @@ public class SetupCommands extends BaseCommand {
             return true;
         }
 
-        sender.sendMessage(Messages.getPrefix() + "§cYou are not a player");
+        sender.sendMessage(PluginMessages.getPrefix() + "§cYou are not a player");
         return false;
     }
 
@@ -100,9 +100,9 @@ public class SetupCommands extends BaseCommand {
                 if (!senderIsPlayer(sender)) return;
                 if (!isValidGame(args)) return;
 
-                game.getArena().setSpectatorSpawn(player.getLocation());
-                game.getArena().updateConfig();
-                player.sendMessage(Messages.getPrefix() + "§fSet new 'spectatorSpawn' to " + player.getLocation() + ".");
+                game.getArenaConfig().setSpectatorSpawn(player.getLocation());
+                game.getArenaConfig().updateConfig();
+                player.sendMessage(PluginMessages.getPrefix() + "§fSet new 'spectatorSpawn' to " + player.getLocation() + ".");
             }
 
             @Subcommand("teleport|tp")
@@ -111,8 +111,8 @@ public class SetupCommands extends BaseCommand {
                 if (!senderIsPlayer(sender)) return;
                 if (!isValidGame(args)) return;
 
-                player.teleport(game.getArena().getSpectatorSpawn());
-                player.sendMessage(Messages.getPrefix() + "§fTeleported to 'spectatorSpawn'.");
+                player.teleport(game.getArenaConfig().getSpectatorSpawn());
+                player.sendMessage(PluginMessages.getPrefix() + "§fTeleported to 'spectatorSpawn'.");
             }
 
         }
@@ -126,9 +126,9 @@ public class SetupCommands extends BaseCommand {
                 if (!senderIsPlayer(sender)) return;
                 if (!isValidGame(args)) return;
 
-                game.getArena().setTeam1Spawn(player.getLocation());
-                game.getArena().updateConfig();
-                player.sendMessage(Messages.getPrefix() + "§fSet new 'team1Spawn' to " + player.getLocation() + ".");
+                game.getArenaConfig().setTeam1Spawn(player.getLocation());
+                game.getArenaConfig().updateConfig();
+                player.sendMessage(PluginMessages.getPrefix() + "§fSet new 'team1Spawn' to " + player.getLocation() + ".");
             }
 
             @Subcommand("teleport|tp")
@@ -137,8 +137,8 @@ public class SetupCommands extends BaseCommand {
                 if (!senderIsPlayer(sender)) return;
                 if (!isValidGame(args)) return;
 
-                player.teleport(game.getArena().getTeam1Spawn());
-                player.sendMessage(Messages.getPrefix() + "§fTeleported to 'team1Spawn'.");
+                player.teleport(game.getArenaConfig().getTeam1Spawn());
+                player.sendMessage(PluginMessages.getPrefix() + "§fTeleported to 'team1Spawn'.");
             }
 
         }
@@ -152,9 +152,9 @@ public class SetupCommands extends BaseCommand {
                 if (!senderIsPlayer(sender)) return;
                 if (!isValidGame(args)) return;
 
-                game.getArena().setTeam2Spawn(player.getLocation());
-                game.getArena().updateConfig();
-                player.sendMessage(Messages.getPrefix() + "§fSet new 'team2Spawn' to " + player.getLocation() + ".");
+                game.getArenaConfig().setTeam2Spawn(player.getLocation());
+                game.getArenaConfig().updateConfig();
+                player.sendMessage(PluginMessages.getPrefix() + "§fSet new 'team2Spawn' to " + player.getLocation() + ".");
             }
 
             @Subcommand("teleport|tp")
@@ -163,8 +163,8 @@ public class SetupCommands extends BaseCommand {
                 if (!senderIsPlayer(sender)) return;
                 if (!isValidGame(args)) return;
 
-                player.teleport(game.getArena().getTeam2Spawn());
-                player.sendMessage(Messages.getPrefix() + "§fTeleported to 'team2Spawn'.");
+                player.teleport(game.getArenaConfig().getTeam2Spawn());
+                player.sendMessage(PluginMessages.getPrefix() + "§fTeleported to 'team2Spawn'.");
             }
 
         }
@@ -181,10 +181,10 @@ public class SetupCommands extends BaseCommand {
                     if (!senderIsPlayer(sender)) return;
                     if (!isValidGame(args)) return;
 
-                    game.getArena().getArea().setPosition1(player.getLocation());
-                    game.getArena().setAreaConfig(game.getArena().getArea().getAreaConfiguration());
-                    game.getArena().updateConfig();
-                    player.sendMessage(Messages.getPrefix() + "§fSet new 'arena area' (position 1) to " + player.getLocation() + ".");
+                    game.getArenaConfig().getArea().setPosition1(player.getLocation());
+                    game.getArenaConfig().setAreaConfig(game.getArenaConfig().getArea().getAreaConfiguration());
+                    game.getArenaConfig().updateConfig();
+                    player.sendMessage(PluginMessages.getPrefix() + "§fSet new 'arena area' (position 1) to " + player.getLocation() + ".");
                 }
 
                 @Subcommand("teleport|tp")
@@ -193,8 +193,8 @@ public class SetupCommands extends BaseCommand {
                     if (!senderIsPlayer(sender)) return;
                     if (!isValidGame(args)) return;
 
-                    player.teleport(game.getArena().getArea().getPosition1());
-                    player.sendMessage(Messages.getPrefix() + "§fTeleported to 'arena area' (position 1): " + game.getArena().getArea().getPosition1().toString());
+                    player.teleport(game.getArenaConfig().getArea().getPosition1());
+                    player.sendMessage(PluginMessages.getPrefix() + "§fTeleported to 'arena area' (position 1): " + game.getArenaConfig().getArea().getPosition1().toString());
                 }
 
             }
@@ -208,10 +208,10 @@ public class SetupCommands extends BaseCommand {
                     if (!senderIsPlayer(sender)) return;
                     if (!isValidGame(args)) return;
 
-                    game.getArena().getArea().setPosition2(player.getLocation());
-                    game.getArena().setAreaConfig(game.getArena().getArea().getAreaConfiguration());
-                    game.getArena().updateConfig();
-                    player.sendMessage(Messages.getPrefix() + "§fSet new 'arena area' (position 2) to " + player.getLocation() + ".");
+                    game.getArenaConfig().getArea().setPosition2(player.getLocation());
+                    game.getArenaConfig().setAreaConfig(game.getArenaConfig().getArea().getAreaConfiguration());
+                    game.getArenaConfig().updateConfig();
+                    player.sendMessage(PluginMessages.getPrefix() + "§fSet new 'arena area' (position 2) to " + player.getLocation() + ".");
                 }
 
                 @Subcommand("teleport|tp")
@@ -220,8 +220,8 @@ public class SetupCommands extends BaseCommand {
                     if (!senderIsPlayer(sender)) return;
                     if (!isValidGame(args)) return;
 
-                    player.teleport(game.getArena().getArea().getPosition2());
-                    player.sendMessage(Messages.getPrefix() + "§fTeleported to 'arena area' (position 2): " + game.getArena().getArea().getPosition2().toString());
+                    player.teleport(game.getArenaConfig().getArea().getPosition2());
+                    player.sendMessage(PluginMessages.getPrefix() + "§fTeleported to 'arena area' (position 2): " + game.getArenaConfig().getArea().getPosition2().toString());
                 }
 
             }
@@ -241,9 +241,9 @@ public class SetupCommands extends BaseCommand {
                 if (!senderIsPlayer(sender)) return;
                 if (!isValidGame(args)) return;
 
-                game.getLobby().setSpawnPoint(player.getLocation());
-                game.getLobby().updateConfig();
-                player.sendMessage(Messages.getPrefix() + "§fSet new 'spawnPoint' to " + player.getLocation() + ".");
+                game.getGameConfig().getLobbyConfig().setSpawnPoint(player.getLocation());
+                game.getGameConfig().updateConfig();
+                player.sendMessage(PluginMessages.getPrefix() + "§fSet new 'spawnPoint' to " + player.getLocation() + ".");
             }
 
             @Subcommand("teleport|tp")
@@ -252,8 +252,8 @@ public class SetupCommands extends BaseCommand {
                 if (!senderIsPlayer(sender)) return;
                 if (!isValidGame(args)) return;
 
-                player.teleport(game.getLobby().getSpawnPoint());
-                player.sendMessage(Messages.getPrefix() + "§fTeleported to 'spawnPoint'.");
+                player.teleport(game.getGameConfig().getLobbyConfig().getSpawnPoint());
+                player.sendMessage(PluginMessages.getPrefix() + "§fTeleported to 'spawnPoint'.");
             }
 
         }
@@ -267,9 +267,9 @@ public class SetupCommands extends BaseCommand {
                 if (!senderIsPlayer(sender)) return;
                 if (!isValidGame(args)) return;
 
-                game.getLobby().setAfterGameSpawn(player.getLocation());
-                game.getLobby().updateConfig();
-                player.sendMessage(Messages.getPrefix() + "§fSet new 'afterGameSpawn' to " + player.getLocation() + ".");
+                game.getGameConfig().getLobbyConfig().setAfterGameSpawn(player.getLocation());
+                game.getGameConfig().updateConfig();
+                player.sendMessage(PluginMessages.getPrefix() + "§fSet new 'afterGameSpawn' to " + player.getLocation() + ".");
             }
 
             @Subcommand("teleport|tp")
@@ -278,8 +278,8 @@ public class SetupCommands extends BaseCommand {
                 if (!senderIsPlayer(sender)) return;
                 if (!isValidGame(args)) return;
 
-                player.teleport(game.getLobby().getAfterGameSpawn());
-                player.sendMessage(Messages.getPrefix() + "§fTeleported to 'afterGameSpawn'.");
+                player.teleport(game.getGameConfig().getLobbyConfig().getAfterGameSpawn());
+                player.sendMessage(PluginMessages.getPrefix() + "§fTeleported to 'afterGameSpawn'.");
             }
 
         }
@@ -296,10 +296,10 @@ public class SetupCommands extends BaseCommand {
                     if (!senderIsPlayer(sender)) return;
                     if (!isValidGame(args)) return;
 
-                    game.getLobby().getArea().setPosition1(player.getLocation());
-                    game.getLobby().setAreaConfig(game.getLobby().getArea().getAreaConfiguration());
-                    game.getLobby().updateConfig();
-                    player.sendMessage(Messages.getPrefix() + "§fSet new 'lobby area' (position 1) to " + player.getLocation() + ".");
+                    game.getGameConfig().getArea().setPosition1(player.getLocation());
+                    game.getGameConfig().getLobbyConfig().setAreaConfig(game.getGameConfig().getArea().getAreaConfiguration());
+                    game.getGameConfig().updateConfig();
+                    player.sendMessage(PluginMessages.getPrefix() + "§fSet new 'lobby area' (position 1) to " + player.getLocation() + ".");
                 }
 
                 @Subcommand("teleport|tp")
@@ -308,8 +308,8 @@ public class SetupCommands extends BaseCommand {
                     if (!senderIsPlayer(sender)) return;
                     if (!isValidGame(args)) return;
 
-                    player.teleport(game.getLobby().getArea().getPosition1());
-                    player.sendMessage(Messages.getPrefix() + "§fTeleported to 'lobby area' (position 1): " + game.getLobby().getArea().getPosition1().toString());
+                    player.teleport(game.getGameConfig().getArea().getPosition1());
+                    player.sendMessage(PluginMessages.getPrefix() + "§fTeleported to 'lobby area' (position 1): " + game.getGameConfig().getArea().getPosition1().toString());
                 }
 
             }
@@ -323,10 +323,10 @@ public class SetupCommands extends BaseCommand {
                     if (!senderIsPlayer(sender)) return;
                     if (!isValidGame(args)) return;
 
-                    game.getLobby().getArea().setPosition2(player.getLocation());
-                    game.getLobby().setAreaConfig(game.getLobby().getArea().getAreaConfiguration());
-                    game.getLobby().updateConfig();
-                    player.sendMessage(Messages.getPrefix() + "§fSet new 'lobby area' (position 2) to " + player.getLocation() + ".");
+                    game.getGameConfig().getArea().setPosition2(player.getLocation());
+                    game.getGameConfig().getLobbyConfig().setAreaConfig(game.getGameConfig().getArea().getAreaConfiguration());
+                    game.getGameConfig().updateConfig();
+                    player.sendMessage(PluginMessages.getPrefix() + "§fSet new 'lobby area' (position 2) to " + player.getLocation() + ".");
                 }
 
                 @Subcommand("teleport|tp")
@@ -335,8 +335,8 @@ public class SetupCommands extends BaseCommand {
                     if (!senderIsPlayer(sender)) return;
                     if (!isValidGame(args)) return;
 
-                    player.teleport(game.getLobby().getArea().getPosition2());
-                    player.sendMessage(Messages.getPrefix() + "§fTeleported to 'lobby area' (position 2): " + game.getLobby().getArea().getPosition2().toString());
+                    player.teleport(game.getGameConfig().getArea().getPosition2());
+                    player.sendMessage(PluginMessages.getPrefix() + "§fTeleported to 'lobby area' (position 2): " + game.getGameConfig().getArea().getPosition2().toString());
                 }
 
             }
@@ -356,13 +356,13 @@ public class SetupCommands extends BaseCommand {
         if (args.length == 1) {
             game = GameManager.getInstance().getGame(args[0]);
             if (game == null) {
-                player.sendMessage(Messages.getPrefix() + "§cGame not found.");
+                player.sendMessage(PluginMessages.getPrefix() + "§cGame not found.");
                 return false;
             }
         } else {
             game = GameManager.getInstance().getGame(player.getLocation());
             if (game == null) {
-                player.sendMessage(Messages.getMessage(true, Messages.MessageEnum.GAME_NOT_IN_GAME_AREA));
+                player.sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.GAME_NOT_IN_GAME_AREA));
                 return false;
             }
         }

+ 8 - 8
missilewars-plugin/src/main/java/de/butzlabben/missilewars/commands/StatsCommands.java

@@ -25,7 +25,7 @@ import co.aikar.commands.annotation.CommandPermission;
 import co.aikar.commands.annotation.Default;
 import co.aikar.commands.annotation.Subcommand;
 import de.butzlabben.missilewars.configuration.Config;
-import de.butzlabben.missilewars.configuration.Messages;
+import de.butzlabben.missilewars.configuration.PluginMessages;
 import de.butzlabben.missilewars.game.stats.PlayerStats;
 import de.butzlabben.missilewars.game.stats.SavedStats;
 import de.butzlabben.missilewars.game.stats.StatsFetcher;
@@ -141,10 +141,10 @@ public class StatsCommands extends BaseCommand {
         // TODO implement more features
 
         if (recommendations.isEmpty()) {
-            player.sendMessage(Messages.getPrefix() + "§aThere are currently no recommendations, everything seems fine :)");
+            player.sendMessage(PluginMessages.getPrefix() + "§aThere are currently no recommendations, everything seems fine :)");
         } else {
-            player.sendMessage(Messages.getPrefix() + "§7=====[ §eMissileWars recommendations §7]=====");
-            recommendations.forEach(str -> player.sendMessage(Messages.getPrefix() + str));
+            player.sendMessage(PluginMessages.getPrefix() + "§7=====[ §eMissileWars recommendations §7]=====");
+            recommendations.forEach(str -> player.sendMessage(PluginMessages.getPrefix() + str));
         }
     }
 
@@ -189,7 +189,7 @@ public class StatsCommands extends BaseCommand {
 
     private StatsFetcher getFetcher(Player player, String[] args) {
         if (!Config.isFightStatsEnabled()) {
-            player.sendMessage(Messages.getMessage(true, Messages.MessageEnum.STATS_NOT_ENABLED));
+            player.sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.STATS_NOT_ENABLED));
             return null;
         }
         Date from = new Date(0);
@@ -198,7 +198,7 @@ public class StatsCommands extends BaseCommand {
             try {
                 from = format.parse(args[0]);
             } catch (ParseException e) {
-                player.sendMessage(Messages.getMessage(true, Messages.MessageEnum.STATS_WRONG_DATE_FORMAT));
+                player.sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.STATS_WRONG_DATE_FORMAT));
                 return null;
             }
             if (args.length > 1) {
@@ -208,10 +208,10 @@ public class StatsCommands extends BaseCommand {
 
         StatsFetcher fetcher = new StatsFetcher(from, arena);
         if (fetcher.getGameCount() < 10) {
-            player.sendMessage(Messages.getMessage(true, Messages.MessageEnum.STATS_TOO_FEW_GAMES));
+            player.sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.STATS_TOO_FEW_GAMES));
             return null;
         }
-        player.sendMessage(Messages.getMessage(true, Messages.MessageEnum.STATS_LOADING_DATA));
+        player.sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.STATS_LOADING_DATA));
         return fetcher;
     }
 }

+ 33 - 33
missilewars-plugin/src/main/java/de/butzlabben/missilewars/commands/UserCommands.java

@@ -24,7 +24,7 @@ import co.aikar.commands.annotation.CommandCompletion;
 import co.aikar.commands.annotation.CommandPermission;
 import co.aikar.commands.annotation.Subcommand;
 import de.butzlabben.missilewars.MissileWars;
-import de.butzlabben.missilewars.configuration.Messages;
+import de.butzlabben.missilewars.configuration.PluginMessages;
 import de.butzlabben.missilewars.game.Game;
 import de.butzlabben.missilewars.game.GameManager;
 import de.butzlabben.missilewars.game.Team;
@@ -46,23 +46,23 @@ public class UserCommands extends BaseCommand {
         Player player = (Player) sender;
 
         if (args.length < 1) {
-            player.sendMessage(Messages.getMessage(true, Messages.MessageEnum.COMMAND_MAP_NEEDED));
+            player.sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.COMMAND_MAP_NEEDED));
             return;
         }
 
         if (args.length > 1) {
-            player.sendMessage(Messages.getMessage(true, Messages.MessageEnum.COMMAND_TO_MANY_ARGUMENTS));
+            player.sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.COMMAND_TO_MANY_ARGUMENTS));
             return;
         }
 
         Game game = GameManager.getInstance().getGame(player.getLocation());
         if (game == null) {
-            player.sendMessage(Messages.getMessage(true, Messages.MessageEnum.GAME_NOT_IN_GAME_AREA));
+            player.sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.GAME_NOT_IN_GAME_AREA));
             return;
         }
         
-        if (game.getLobby().getMapChooseProcedure() != MapChooseProcedure.MAPVOTING) {
-            player.sendMessage(Messages.getMessage(true, Messages.MessageEnum.VOTE_CANT_VOTE));
+        if (game.getGameConfig().getMapChooseProcedure() != MapChooseProcedure.MAPVOTING) {
+            player.sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.VOTE_CANT_VOTE));
             return;
         }
         
@@ -78,18 +78,18 @@ public class UserCommands extends BaseCommand {
         Player player = (Player) sender;
 
         if (args.length > 0) {
-            player.sendMessage(Messages.getMessage(true, Messages.MessageEnum.COMMAND_TO_MANY_ARGUMENTS));
+            player.sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.COMMAND_TO_MANY_ARGUMENTS));
             return;
         }
         
         Game game = GameManager.getInstance().getGame(player.getLocation());
         if (game == null) {
-            player.sendMessage(Messages.getMessage(true, Messages.MessageEnum.GAME_NOT_IN_GAME_AREA));
+            player.sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.GAME_NOT_IN_GAME_AREA));
             return;
         }
         
-        if (game.getLobby().getMapChooseProcedure() != MapChooseProcedure.MAPVOTING) {
-            player.sendMessage(Messages.getMessage(true, Messages.MessageEnum.VOTE_CANT_VOTE));
+        if (game.getGameConfig().getMapChooseProcedure() != MapChooseProcedure.MAPVOTING) {
+            player.sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.VOTE_CANT_VOTE));
             return;
         }
         
@@ -97,7 +97,7 @@ public class UserCommands extends BaseCommand {
         // But only in the LOBBY Game-State.
         
         if (game.getState() != GameState.LOBBY) {
-            player.sendMessage(Messages.getMessage(true, Messages.MessageEnum.VOTE_CHANGE_TEAM_NO_LONGER_NOW));
+            player.sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.VOTE_CHANGE_TEAM_NO_LONGER_NOW));
             return;
         }
         
@@ -114,29 +114,29 @@ public class UserCommands extends BaseCommand {
         Player player = (Player) sender;
 
         if (args.length < 1) {
-            player.sendMessage(Messages.getMessage(true, Messages.MessageEnum.COMMAND_TEAM_NUMBER_NEEDED));
+            player.sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.COMMAND_TEAM_NUMBER_NEEDED));
             return;
         }
 
         if (args.length > 1) {
-            player.sendMessage(Messages.getMessage(true, Messages.MessageEnum.COMMAND_TO_MANY_ARGUMENTS));
+            player.sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.COMMAND_TO_MANY_ARGUMENTS));
             return;
         }
 
         Game game = GameManager.getInstance().getGame(player.getLocation());
         if (game == null) {
-            player.sendMessage(Messages.getMessage(true, Messages.MessageEnum.GAME_NOT_IN_GAME_AREA));
+            player.sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.GAME_NOT_IN_GAME_AREA));
             return;
         }
         
         MWPlayer mwPlayer = game.getPlayer(player);
         
         if (game.getState() == GameState.LOBBY) {
-            if (game.getArena() != null) {
-                if (!game.getArena().isTeamchangeOngoingGame()) {
+            if (game.getArenaConfig() != null) {
+                if (!game.getArenaConfig().isTeamchangeOngoingGame()) {
                     // Is too late for team change (last seconds of lobby waiting-time)?
                     if (game.getTaskManager().getTimer().getSeconds() < 10) {
-                        player.sendMessage(Messages.getMessage(true, Messages.MessageEnum.TEAM_CHANGE_TEAM_NO_LONGER_NOW));
+                        player.sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.TEAM_CHANGE_TEAM_NO_LONGER_NOW));
                         return;
                     }
                 }
@@ -144,21 +144,21 @@ public class UserCommands extends BaseCommand {
             
         } else if (game.getState() == GameState.INGAME) {
             // Is team change only in lobby allowed?
-            if (!game.getArena().isTeamchangeOngoingGame()) {
-                player.sendMessage(Messages.getMessage(true, Messages.MessageEnum.TEAM_CHANGE_TEAM_NOT_NOW));
+            if (!game.getArenaConfig().isTeamchangeOngoingGame()) {
+                player.sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.TEAM_CHANGE_TEAM_NOT_NOW));
                 return;
             }
             
             // Anti-Spam Check:
             if (mwPlayer.getWaitTimeForTeamChange() > 0) {
-                player.sendMessage(Messages.getMessage(true, Messages.MessageEnum.COMMAND_ANTISPAM_TEAM_CHANGE)
+                player.sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.COMMAND_ANTISPAM_TEAM_CHANGE)
                         .replace("%seconds%", Long.toString(mwPlayer.getWaitTimeForTeamChange())));
                 return;
             }
             mwPlayer.setLastTeamChangeTime();
             
         } else {
-            player.sendMessage(Messages.getMessage(true, Messages.MessageEnum.TEAM_CHANGE_TEAM_NOT_NOW));
+            player.sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.TEAM_CHANGE_TEAM_NOT_NOW));
             return;
             
         }
@@ -171,7 +171,7 @@ public class UserCommands extends BaseCommand {
             case "1":
             case "team1":
                 if (!player.hasPermission("mw.change.team.player")) {
-                    Messages.getMessage(true, Messages.MessageEnum.NO_PERMISSION);
+                    PluginMessages.getMessage(true, PluginMessages.MessageEnum.NO_PERMISSION);
                     return;
                 }
                 to = game.getTeamManager().getTeam1();
@@ -179,7 +179,7 @@ public class UserCommands extends BaseCommand {
             case "2":
             case "team2":
                 if (!player.hasPermission("mw.change.team.player")) {
-                    Messages.getMessage(true, Messages.MessageEnum.NO_PERMISSION);
+                    PluginMessages.getMessage(true, PluginMessages.MessageEnum.NO_PERMISSION);
                     return;
                 }
                 to = game.getTeamManager().getTeam2();
@@ -187,26 +187,26 @@ public class UserCommands extends BaseCommand {
             case "spec":
             case "spectator":
                 if (!player.hasPermission("mw.change.team.spectator")) {
-                    Messages.getMessage(true, Messages.MessageEnum.NO_PERMISSION);
+                    PluginMessages.getMessage(true, PluginMessages.MessageEnum.NO_PERMISSION);
                     return;
                 }
                 to = game.getTeamManager().getTeamSpec();
                 break;
             default:
-                sender.sendMessage(Messages.getMessage(true, Messages.MessageEnum.COMMAND_INVALID_TEAM));
+                sender.sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.COMMAND_INVALID_TEAM));
                 return;
         }
         
         // Is the same team?
         if (from == to) {
-            player.sendMessage(Messages.getMessage(true, Messages.MessageEnum.TEAM_CHANGE_ALREADY_IN_TEAM));
+            player.sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.TEAM_CHANGE_ALREADY_IN_TEAM));
             return;
         }
         
         // Would the number of team members be too far apart?
         if (game.getState() != GameState.LOBBY) {
             if (!game.getTeamManager().isValidFairSwitch(from, to)) {
-                player.sendMessage(Messages.getMessage(true, Messages.MessageEnum.TEAM_CHANGE_UNFAIR_TEAM_SIZE));
+                player.sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.TEAM_CHANGE_UNFAIR_TEAM_SIZE));
                 return;
             }
         }
@@ -214,12 +214,12 @@ public class UserCommands extends BaseCommand {
         // Checking max-user values:
         if (to == game.getTeamManager().getTeamSpec()) {
             if (game.areTooManySpectators()) {
-                player.sendMessage(Messages.getMessage(true, Messages.MessageEnum.TEAM_SPECTATOR_TEAM_MAX_REACHED));
+                player.sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.TEAM_SPECTATOR_TEAM_MAX_REACHED));
                 return;
             }
         } else {
             if (game.areTooManyPlayers()) {
-                player.sendMessage(Messages.getMessage(true, Messages.MessageEnum.TEAM_PLAYER_TEAM_MAX_REACHED));
+                player.sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.TEAM_PLAYER_TEAM_MAX_REACHED));
                 return;
             }
         }
@@ -236,13 +236,13 @@ public class UserCommands extends BaseCommand {
         Player player = (Player) sender;
 
         if (args.length > 0) {
-            player.sendMessage(Messages.getMessage(true, Messages.MessageEnum.COMMAND_TO_MANY_ARGUMENTS));
+            player.sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.COMMAND_TO_MANY_ARGUMENTS));
             return;
         }
         
         Game game = GameManager.getInstance().getGame(player.getLocation());
         if (game == null) {
-            player.sendMessage(Messages.getMessage(true, Messages.MessageEnum.GAME_NOT_IN_GAME_AREA));
+            player.sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.GAME_NOT_IN_GAME_AREA));
             return;
         }
         
@@ -261,13 +261,13 @@ public class UserCommands extends BaseCommand {
         Player player = (Player) sender;
 
         if (args.length > 0) {
-            player.sendMessage(Messages.getMessage(true, Messages.MessageEnum.COMMAND_TO_MANY_ARGUMENTS));
+            player.sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.COMMAND_TO_MANY_ARGUMENTS));
             return;
         }
 
         Game game = GameManager.getInstance().getGame(player.getLocation());
         if (game == null) {
-            player.sendMessage(Messages.getMessage(true, Messages.MessageEnum.GAME_NOT_IN_GAME_AREA));
+            player.sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.GAME_NOT_IN_GAME_AREA));
             return;
         }
 

+ 1 - 1
missilewars-plugin/src/main/java/de/butzlabben/missilewars/configuration/ActionSet.java

@@ -66,7 +66,7 @@ public class ActionSet {
             
             Logger.DEBUG.log("Run Action: " + a.getActionType() + " -> '" + a.data + "'");
             
-            String data = Messages.getPapiMessage(a.getData(), player).replace("%prefix%", Messages.getPrefix());
+            String data = PluginMessages.getPapiMessage(a.getData(), player).replace("%prefix%", PluginMessages.getPrefix());
             switch (a.getActionType()) {
                 case PLAYER_CMD:
                     player.performCommand(data);

+ 50 - 53
missilewars-plugin/src/main/java/de/butzlabben/missilewars/configuration/Config.java

@@ -21,10 +21,12 @@ package de.butzlabben.missilewars.configuration;
 import de.butzlabben.missilewars.Logger;
 import de.butzlabben.missilewars.MissileWars;
 import de.butzlabben.missilewars.game.GameManager;
+import de.butzlabben.missilewars.initialization.ConfigLoader;
+import de.butzlabben.missilewars.initialization.FileManager;
 import de.butzlabben.missilewars.menus.MenuItem;
 import de.butzlabben.missilewars.util.MaterialUtil;
-import de.butzlabben.missilewars.util.SetupUtil;
 import lombok.Getter;
+import lombok.Setter;
 import org.bukkit.*;
 import org.bukkit.configuration.ConfigurationSection;
 import org.bukkit.configuration.file.YamlConfiguration;
@@ -39,32 +41,27 @@ import static org.bukkit.Material.*;
  * @since 01.01.2018
  */
 public class Config {
-
-    private static final File DIR = MissileWars.getInstance().getDataFolder();
-    private static final File FILE = new File(DIR, "config.yml");
-    private static YamlConfiguration cfg;
-    private static boolean isNewConfig = false;
+    
+    @Getter private static final File FILE = new File(MissileWars.getInstance().getDataFolder(), "config.yml");
+    @Setter private static YamlConfiguration cfg;
+    
+    private final static boolean isNewConfig = !FILE.exists();
 
     public static void load() {
 
-        // check if the directory and the file exists or create it new
-        isNewConfig = SetupUtil.isNewConfig(DIR, FILE);
-
-        // try to load the config
-        cfg = SetupUtil.getLoadedConfig(FILE);
-
-        // copy the config input
-        cfg.options().copyDefaults(true);
-
-        // validate the config options
+        cfg = ConfigLoader.loadConfigFile(FILE);
+        
+        // Validate the settings and re-save the cleaned config-file.
         addDefaults();
-
-        // re-save the config with only validated options
-        SetupUtil.safeFile(FILE, cfg);
-        cfg = SetupUtil.getLoadedConfig(FILE);
-
+        
+        save();
     }
-
+    
+    public static void save() {
+        FileManager.safeFile(FILE, cfg);
+        cfg = ConfigLoader.getLoadedConfig(FILE);
+    }
+    
     private static void addDefaults() {
         cfg.addDefault("debug", false);
         if (debug()) {
@@ -82,12 +79,12 @@ public class Config {
 
         cfg.addDefault("arenas.folder", "plugins/MissileWars/arenas");
 
-        cfg.addDefault("lobbies.multiple_lobbies", false);
-        cfg.addDefault("lobbies.folder", "plugins/MissileWars/lobbies");
-        cfg.addDefault("lobbies.default_lobby", "lobby0.yml");
+        cfg.addDefault("games.multiple_games", false);
+        cfg.addDefault("games.folder", "plugins/MissileWars/games");
+        cfg.addDefault("games.default_game", "game0.yml");
 
-        cfg.addDefault("missiles.folder", "plugins/MissileWars/missiles");
-        cfg.addDefault("shields.folder", "plugins/MissileWars/shields");
+        cfg.addDefault("missiles.folder", "plugins/MissileWars/schematics/missiles");
+        cfg.addDefault("shields.folder", "plugins/MissileWars/schematics/shields");
 
         cfg.addDefault("temp_block.enable", true);
         cfg.addDefault("temp_block.material", NOTE_BLOCK.name());
@@ -178,7 +175,7 @@ public class Config {
 
             cfg.addDefault(gameJoinMenu + ".items.mapVote_active.priority", 1);
             cfg.addDefault(gameJoinMenu + ".items.mapVote_active.view_requirement.type", "string equals");
-            cfg.addDefault(gameJoinMenu + ".items.mapVote_active.view_requirement.input", "%missilewars_lobby_mapvote_state_this%");
+            cfg.addDefault(gameJoinMenu + ".items.mapVote_active.view_requirement.input", "%missilewars_game_mapvote_state_this%");
             cfg.addDefault(gameJoinMenu + ".items.mapVote_active.view_requirement.output", "RUNNING");
             
             cfg.set(gameJoinMenu + ".items.mapVote_active.lore", new ArrayList<String>() {{
@@ -219,11 +216,11 @@ public class Config {
             cfg.addDefault(gameJoinMenu + ".items.areaInfo.priority", 0);
 
             cfg.set(gameJoinMenu + ".items.areaInfo.lore", new ArrayList<String>() {{
-                add("&e> &fLobby: &7%missilewars_lobby_displayname_this%");
+                add("&e> &fLobby: &7%missilewars_game_displayname_this%");
                 add("&e> &fArena: &7%missilewars_arena_displayname_this%");
-                add("&e> &fGame-Time: &7%missilewars_lobby_gameduration_this% min");
+                add("&e> &fGame-Time: &7%missilewars_game_gameduration_this% min");
                 add("&e> &fMissiles: &7%missilewars_arena_missileamount_this%x");
-                add("&e> &fArena-Size: &7%missilewars_lobby_arenasize_X_this% x %missilewars_lobby_arenasize_Z_this% blocks");
+                add("&e> &fArena-Size: &7%missilewars_game_arenasize_X_this% x %missilewars_game_arenasize_Z_this% blocks");
             }});
             
             cfg.set(gameJoinMenu + ".items.areaInfo.left_click_actions", new ArrayList<String>());
@@ -254,7 +251,7 @@ public class Config {
         cfg.set("fallback_spawn.pitch", spawnLocation.getPitch());
 
         // re-save the config with only validated options
-        SetupUtil.safeFile(FILE, cfg);
+        FileManager.safeFile(FILE, cfg);
     }
     
     public static YamlConfiguration getConfig() {
@@ -289,16 +286,16 @@ public class Config {
         return cfg.getString("arenas.folder");
     }
 
-    public static boolean isMultipleLobbies() {
-        return cfg.getBoolean("lobbies.multiple_lobbies");
+    public static boolean useMultipleGames() {
+        return cfg.getBoolean("games.multiple_games");
     }
 
-    public static String getLobbiesFolder() {
-        return cfg.getString("lobbies.folder");
+    public static String getGamesFolder() {
+        return cfg.getString("games.folder");
     }
 
-    public static String getDefaultLobby() {
-        return cfg.getString("lobbies.default_lobby");
+    public static String getDefaultGame() {
+        return cfg.getString("games.default_game");
     }
 
     public static String getMissilesFolder() {
@@ -330,15 +327,15 @@ public class Config {
     }
 
     public static String motdEnded() {
-        return Messages.getConvertedMsg(cfg.getString("motd.ended"));
+        return PluginMessages.getConvertedMsg(cfg.getString("motd.ended"));
     }
 
     public static String motdGame() {
-        return Messages.getConvertedMsg(cfg.getString("motd.ingame"));
+        return PluginMessages.getConvertedMsg(cfg.getString("motd.ingame"));
     }
 
     public static String motdLobby() {
-        return Messages.getConvertedMsg(cfg.getString("motd.lobby"));
+        return PluginMessages.getConvertedMsg(cfg.getString("motd.lobby"));
     }
 
     public static boolean motdEnabled() {
@@ -402,11 +399,11 @@ public class Config {
     }
 
     public static String getScoreboardTitle() {
-        return Messages.getConvertedMsg(cfg.getString("sidebar.title"));
+        return PluginMessages.getConvertedMsg(cfg.getString("sidebar.title"));
     }
 
     public static String getScoreboardMembersStyle() {
-        return Messages.getConvertedMsg(cfg.getString("sidebar.member_list_style"));
+        return PluginMessages.getConvertedMsg(cfg.getString("sidebar.member_list_style"));
     }
 
     public static int getScoreboardMembersMax() {
@@ -414,7 +411,7 @@ public class Config {
     }
     
     public static List<String> getScoreboardEntries() {
-        return Messages.getConvertedMsgList(cfg.getStringList("sidebar.entries"));
+        return PluginMessages.getConvertedMsgList(cfg.getStringList("sidebar.entries"));
     }
     
     public static int getActionbarForSpecDelay() {
@@ -422,7 +419,7 @@ public class Config {
     }
     
     public static String[] getActionbarForSpecEntries() {
-        return Messages.getConvertedMsgArray(cfg.getStringList("actionbar_msg.spectator.messages"));
+        return PluginMessages.getConvertedMsgArray(cfg.getStringList("actionbar_msg.spectator.messages"));
     }
     
     public static Map<Integer, Map<Integer, MenuItem>> getGameJoinMenuItems() {
@@ -437,12 +434,12 @@ public class Config {
             ConfigurationSection cfg = Config.cfg.getConfigurationSection(gameJoinMenu + ".items." + item);
             MenuItem menuItem = new MenuItem(cfg.getInt("slot"), cfg.getInt("priority"));
 
-            menuItem.setDisplayName(Messages.getConvertedMsg(cfg.getString("display_name")));
+            menuItem.setDisplayName(PluginMessages.getConvertedMsg(cfg.getString("display_name")));
             menuItem.setMaterialName(cfg.getString("material"));
             menuItem.setItemRequirement(cfg);
-            menuItem.setLoreList(Messages.getConvertedMsgList(cfg.getStringList("lore")));
-            menuItem.setLeftClickActions(new ActionSet(Messages.getConvertedMsgList(cfg.getStringList("left_click_actions"))));
-            menuItem.setRightClickActions(new ActionSet(Messages.getConvertedMsgList(cfg.getStringList("right_click_actions"))));
+            menuItem.setLoreList(PluginMessages.getConvertedMsgList(cfg.getStringList("lore")));
+            menuItem.setLeftClickActions(new ActionSet(PluginMessages.getConvertedMsgList(cfg.getStringList("left_click_actions"))));
+            menuItem.setRightClickActions(new ActionSet(PluginMessages.getConvertedMsgList(cfg.getStringList("right_click_actions"))));
             
             int slot = menuItem.getSlot();
             Map<Integer, MenuItem> itemsInSlot = new HashMap<>();
@@ -461,7 +458,7 @@ public class Config {
     }
     
     public static String getTeamSelectionMenuTitle() {
-        return Messages.getConvertedMsg(cfg.getString("menus.inventory_menu.team_selection_menu.title"));
+        return PluginMessages.getConvertedMsg(cfg.getString("menus.inventory_menu.team_selection_menu.title"));
     }
     
     @Getter
@@ -475,12 +472,12 @@ public class Config {
         }
         
         public String getMessage() {
-            return Messages.getConvertedMsg(cfg.getString(getPath()));
+            return PluginMessages.getConvertedMsg(cfg.getString(getPath()));
         }
     }
     
     public static String getMapVoteMenuTitle() {
-        return Messages.getConvertedMsg(cfg.getString("menus.inventory_menu.map_vote_menu.title"));
+        return PluginMessages.getConvertedMsg(cfg.getString("menus.inventory_menu.map_vote_menu.title"));
     }
     
     @Getter
@@ -499,7 +496,7 @@ public class Config {
         }
         
         public String getMessage() {
-            return Messages.getConvertedMsg(cfg.getString(getPath()));
+            return PluginMessages.getConvertedMsg(cfg.getString(getPath()));
         }
     }
     

+ 22 - 24
missilewars-plugin/src/main/java/de/butzlabben/missilewars/configuration/Messages.java → missilewars-plugin/src/main/java/de/butzlabben/missilewars/configuration/PluginMessages.java

@@ -19,8 +19,10 @@
 package de.butzlabben.missilewars.configuration;
 
 import de.butzlabben.missilewars.MissileWars;
-import de.butzlabben.missilewars.util.SetupUtil;
+import de.butzlabben.missilewars.initialization.ConfigLoader;
+import de.butzlabben.missilewars.initialization.FileManager;
 import lombok.Getter;
+import lombok.Setter;
 import me.clip.placeholderapi.PlaceholderAPI;
 import org.bukkit.ChatColor;
 import org.bukkit.configuration.file.YamlConfiguration;
@@ -35,32 +37,28 @@ import java.util.List;
  * @author Butzlabben
  * @since 13.08.2018
  */
-public class Messages {
-
-    private static final File DIR = MissileWars.getInstance().getDataFolder();
-    private static final File FILE = new File(DIR, "messages.yml");
-    private static YamlConfiguration cfg;
-    private static boolean isNewConfig = false;
+public class PluginMessages {
+    
+    @Getter private static final File FILE = new File(MissileWars.getInstance().getDataFolder(), "messages.yml");
+    @Setter private static YamlConfiguration cfg;
+    
+    private final static boolean isNewConfig = !FILE.exists();
 
     public static void load() {
 
-        // check if the directory and the file exists or create it new
-        isNewConfig = SetupUtil.isNewConfig(DIR, FILE);
-
-        // try to load the config
-        cfg = SetupUtil.getLoadedConfig(FILE);
-
-        // copy the config input
-        cfg.options().copyDefaults(true);
-
-        // validate the config options
+        cfg = ConfigLoader.loadConfigFile(FILE);
+        
+        // Validate the settings and re-save the cleaned config-file.
         addDefaults();
-
-        // re-save the config with only validated options
-        SetupUtil.safeFile(FILE, cfg);
-        cfg = SetupUtil.getLoadedConfig(FILE);
+        
+        save();
     }
-
+    
+    public static void save() {
+        FileManager.safeFile(FILE, cfg);
+        cfg = ConfigLoader.getLoadedConfig(FILE);
+    }
+    
     private static void addDefaults() {
 
         for (MessageEnum msg : MessageEnum.values()) {
@@ -193,8 +191,8 @@ public class Messages {
 
         SIGNEDIT_SIGN_CREATED("signedit.sign_created", "&7Sign was successfully created and connected."),
         SIGNEDIT_SIGN_REMOVED("signedit.sign_removed", "&7You have successfully removed this MissileWars sign."),
-        SIGNEDIT_EMPTY_LOBBY("signedit.empty_lobby", "&cPlease specify the target lobby name in the second line."),
-        SIGNEDIT_LOBBY_NOT_FOUND("signedit.lobby_not_found", "&cCould not find lobby \"%input%\"."),
+        SIGNEDIT_EMPTY_GAME("signedit.empty_game", "&cPlease specify the target game name in the second line."),
+        SIGNEDIT_GAME_NOT_FOUND("signedit.game_not_found", "&cCould not find game \"%input%\"."),
         SIGNEDIT_SIGN_REMOVE_DESC("signedit.sign_remove_desc", "&cThis shield is locked by the MissileWars plugin. Sneak while you are destroying the shield to remove it."),
 
         GAME_STATE_NO_GAME("game_state.no_game", "&cNo Game."),

+ 15 - 14
missilewars-plugin/src/main/java/de/butzlabben/missilewars/configuration/arena/Arena.java → missilewars-plugin/src/main/java/de/butzlabben/missilewars/configuration/arena/ArenaConfig.java

@@ -19,6 +19,7 @@
 package de.butzlabben.missilewars.configuration.arena;
 
 import com.google.gson.annotations.SerializedName;
+import de.butzlabben.missilewars.configuration.arena.modules.*;
 import de.butzlabben.missilewars.util.geometry.GameArea;
 import de.butzlabben.missilewars.util.serialization.Serializer;
 import lombok.Getter;
@@ -31,7 +32,7 @@ import java.io.IOException;
 
 @Getter
 @ToString
-public class Arena implements Cloneable {
+public class ArenaConfig implements Cloneable {
 
     // The values defined here are only valid if there is no Config yet.
     private String name = "arena0";
@@ -39,22 +40,22 @@ public class Arena implements Cloneable {
     @SerializedName("display_material") private String displayMaterial = "STONE";
     @SerializedName("template_world") private String templateWorld = "default_map";
     @SerializedName("auto_respawn") private boolean autoRespawn = true;
-    @SerializedName("game_spawn") private GameSpawnConfiguration spawn = new GameSpawnConfiguration();
-    @SerializedName("game_respawn") private GameRespawnConfiguration respawn = new GameRespawnConfiguration();
+    @SerializedName("game_spawn") private GameSpawnConfig spawn = new GameSpawnConfig();
+    @SerializedName("game_respawn") private GameRespawnConfig respawn = new GameRespawnConfig();
     @SerializedName("do_tile_drops") private boolean doTileDrops = false;
     @SerializedName("keep_inventory") private boolean keepInventory = false;
     @SerializedName("max_move_height") private int maxMoveHeight = 170;
     @SerializedName("death_height") private int deathHeight = 65;
     @SerializedName("game_duration") private int gameDuration = 30;
-    @SerializedName("fireball") private FireballConfiguration fireballConfiguration = new FireballConfiguration();
-    @SerializedName("arrow") private ArrowConfiguration arrowConfiguration = new ArrowConfiguration();
+    @SerializedName("fireball") private FireballConfig fireballConfig = new FireballConfig();
+    @SerializedName("arrow") private ArrowConfig arrowConfig = new ArrowConfig();
     @SerializedName("save_statistics") private boolean saveStatistics = true;
-    @SerializedName("fall_protection") private FallProtectionConfiguration fallProtection = new FallProtectionConfiguration();
-    @SerializedName("game_result.money") private MoneyConfiguration money = new MoneyConfiguration();
-    @SerializedName("equipment_interval") private EquipmentIntervalConfiguration interval = new EquipmentIntervalConfiguration();
-    @SerializedName("missile") private MissileConfiguration missileConfiguration = new MissileConfiguration();
-    @SerializedName("shield") private ShieldConfiguration shieldConfiguration = new ShieldConfiguration();
-    @Setter @SerializedName("area") private AreaConfiguration areaConfig = new AreaConfiguration(-30, 0, -72, 30, 256, 72);
+    @SerializedName("fall_protection") private FallProtectionConfig fallProtection = new FallProtectionConfig();
+    @SerializedName("game_result.money") private MoneyConfig money = new MoneyConfig();
+    @SerializedName("equipment_interval") private EquipmentIntervalConfig interval = new EquipmentIntervalConfig();
+    @SerializedName("missile") private MissileConfig missileConfig = new MissileConfig();
+    @SerializedName("shield") private ShieldConfig shieldConfig = new ShieldConfig();
+    @Setter @SerializedName("area") private AreaConfig areaConfig = new AreaConfig(-30, 0, -72, 30, 256, 72);
     @SerializedName("teamchange_ongoing_game") private boolean teamchangeOngoingGame = false;
 
     @SerializedName("spectator_spawn")
@@ -73,14 +74,14 @@ public class Arena implements Cloneable {
     @Setter private transient GameArea area;
     @Setter private transient File file;
 
-    public Arena() {
+    public ArenaConfig() {
 
     }
     
     @Override
-    public Arena clone() {
+    public ArenaConfig clone() {
         try {
-            Arena clone = (Arena) super.clone();
+            ArenaConfig clone = (ArenaConfig) super.clone();
             clone.spectatorSpawn = spectatorSpawn.clone();
             clone.team1Spawn = team1Spawn.clone();
             clone.team2Spawn = team2Spawn.clone();

+ 4 - 4
missilewars-plugin/src/main/java/de/butzlabben/missilewars/configuration/arena/AreaConfiguration.java → missilewars-plugin/src/main/java/de/butzlabben/missilewars/configuration/arena/modules/AreaConfig.java

@@ -16,7 +16,7 @@
  * along with MissileWars.  If not, see <https://www.gnu.org/licenses/>.
  */
 
-package de.butzlabben.missilewars.configuration.arena;
+package de.butzlabben.missilewars.configuration.arena.modules;
 
 import com.google.gson.annotations.SerializedName;
 import java.util.HashMap;
@@ -31,7 +31,7 @@ import org.jetbrains.annotations.NotNull;
 @Getter
 @ToString
 @AllArgsConstructor
-public class AreaConfiguration implements ConfigurationSerializable {
+public class AreaConfig implements ConfigurationSerializable {
 
     @SerializedName("min_x") private int minX;
     @SerializedName("min_y") private int minY;
@@ -49,8 +49,8 @@ public class AreaConfiguration implements ConfigurationSerializable {
      *
      * @return an area configuration around the location
      */
-    public static AreaConfiguration aroundLocation(Location location, int margin) {
-        return new AreaConfiguration(location.getBlockX() - margin,
+    public static AreaConfig aroundLocation(Location location, int margin) {
+        return new AreaConfig(location.getBlockX() - margin,
                 0,
                 location.getBlockZ() - margin,
                 location.getBlockX() + margin,

+ 2 - 2
missilewars-plugin/src/main/java/de/butzlabben/missilewars/configuration/arena/ArrowConfiguration.java → missilewars-plugin/src/main/java/de/butzlabben/missilewars/configuration/arena/modules/ArrowConfig.java

@@ -16,7 +16,7 @@
  * along with MissileWars.  If not, see <https://www.gnu.org/licenses/>.
  */
 
-package de.butzlabben.missilewars.configuration.arena;
+package de.butzlabben.missilewars.configuration.arena.modules;
 
 import lombok.Getter;
 import lombok.RequiredArgsConstructor;
@@ -25,7 +25,7 @@ import lombok.ToString;
 @Getter
 @ToString
 @RequiredArgsConstructor
-public class ArrowConfiguration {
+public class ArrowConfig {
 
     private int occurrence = 2;
     private int amount = 3;

+ 2 - 2
missilewars-plugin/src/main/java/de/butzlabben/missilewars/configuration/arena/EquipmentIntervalConfiguration.java → missilewars-plugin/src/main/java/de/butzlabben/missilewars/configuration/arena/modules/EquipmentIntervalConfig.java

@@ -16,7 +16,7 @@
  * along with MissileWars.  If not, see <https://www.gnu.org/licenses/>.
  */
 
-package de.butzlabben.missilewars.configuration.arena;
+package de.butzlabben.missilewars.configuration.arena.modules;
 
 import com.google.gson.annotations.SerializedName;
 import java.util.HashMap;
@@ -28,7 +28,7 @@ import lombok.ToString;
 @Getter
 @ToString
 @RequiredArgsConstructor
-public class EquipmentIntervalConfiguration {
+public class EquipmentIntervalConfig {
 
     @SerializedName("custom_start_interval") private int customStartInterval = 10;
     @SerializedName("reset_after_respawn") private boolean resetAfterRespawn = true;

+ 2 - 2
missilewars-plugin/src/main/java/de/butzlabben/missilewars/configuration/arena/FallProtectionConfiguration.java → missilewars-plugin/src/main/java/de/butzlabben/missilewars/configuration/arena/modules/FallProtectionConfig.java

@@ -16,7 +16,7 @@
  * along with MissileWars.  If not, see <https://www.gnu.org/licenses/>.
  */
 
-package de.butzlabben.missilewars.configuration.arena;
+package de.butzlabben.missilewars.configuration.arena.modules;
 
 import com.google.gson.annotations.SerializedName;
 import lombok.Getter;
@@ -26,7 +26,7 @@ import lombok.ToString;
 @Getter
 @ToString
 @RequiredArgsConstructor
-public class FallProtectionConfiguration {
+public class FallProtectionConfig {
 
     private boolean enabled = true;
     private int duration = 60;

+ 2 - 2
missilewars-plugin/src/main/java/de/butzlabben/missilewars/configuration/arena/FireballConfiguration.java → missilewars-plugin/src/main/java/de/butzlabben/missilewars/configuration/arena/modules/FireballConfig.java

@@ -16,7 +16,7 @@
  * along with MissileWars.  If not, see <https://www.gnu.org/licenses/>.
  */
 
-package de.butzlabben.missilewars.configuration.arena;
+package de.butzlabben.missilewars.configuration.arena.modules;
 
 import com.google.gson.annotations.SerializedName;
 import lombok.Getter;
@@ -26,7 +26,7 @@ import lombok.ToString;
 @Getter
 @ToString
 @RequiredArgsConstructor
-public class FireballConfiguration {
+public class FireballConfig {
 
     private String name = "Fireball";
     private int occurrence = 2;

+ 2 - 2
missilewars-plugin/src/main/java/de/butzlabben/missilewars/configuration/arena/GameRespawnConfiguration.java → missilewars-plugin/src/main/java/de/butzlabben/missilewars/configuration/arena/modules/GameRespawnConfig.java

@@ -16,7 +16,7 @@
  * along with MissileWars.  If not, see <https://www.gnu.org/licenses/>.
  */
 
-package de.butzlabben.missilewars.configuration.arena;
+package de.butzlabben.missilewars.configuration.arena.modules;
 
 import com.google.gson.annotations.SerializedName;
 import lombok.Getter;
@@ -26,7 +26,7 @@ import lombok.ToString;
 @Getter
 @ToString
 @RequiredArgsConstructor
-public class GameRespawnConfiguration {
+public class GameRespawnConfig {
 
     @SerializedName("send_bow") private boolean sendBow = true;
     @SerializedName("send_pickaxe") private boolean sendPickaxe = false;

+ 2 - 2
missilewars-plugin/src/main/java/de/butzlabben/missilewars/configuration/arena/GameSpawnConfiguration.java → missilewars-plugin/src/main/java/de/butzlabben/missilewars/configuration/arena/modules/GameSpawnConfig.java

@@ -16,7 +16,7 @@
  * along with MissileWars.  If not, see <https://www.gnu.org/licenses/>.
  */
 
-package de.butzlabben.missilewars.configuration.arena;
+package de.butzlabben.missilewars.configuration.arena.modules;
 
 import com.google.gson.annotations.SerializedName;
 import lombok.Getter;
@@ -26,7 +26,7 @@ import lombok.ToString;
 @Getter
 @ToString
 @RequiredArgsConstructor
-public class GameSpawnConfiguration {
+public class GameSpawnConfig {
 
     @SerializedName("send_bow") private boolean sendBow = true;
     @SerializedName("send_pickaxe") private boolean sendPickaxe = false;

+ 2 - 2
missilewars-plugin/src/main/java/de/butzlabben/missilewars/configuration/arena/MissileConfiguration.java → missilewars-plugin/src/main/java/de/butzlabben/missilewars/configuration/arena/modules/MissileConfig.java

@@ -16,7 +16,7 @@
  * along with MissileWars.  If not, see <https://www.gnu.org/licenses/>.
  */
 
-package de.butzlabben.missilewars.configuration.arena;
+package de.butzlabben.missilewars.configuration.arena.modules;
 
 import de.butzlabben.missilewars.Logger;
 import de.butzlabben.missilewars.game.schematics.SchematicConfiguration;
@@ -35,7 +35,7 @@ import java.util.*;
 @Getter
 @ToString
 @RequiredArgsConstructor
-public class MissileConfiguration extends SchematicConfiguration {
+public class MissileConfig extends SchematicConfiguration {
 
     // TODO pretty names
     private boolean onlyBlockPlaceable = false;

+ 2 - 2
missilewars-plugin/src/main/java/de/butzlabben/missilewars/configuration/arena/MoneyConfiguration.java → missilewars-plugin/src/main/java/de/butzlabben/missilewars/configuration/arena/modules/MoneyConfig.java

@@ -16,7 +16,7 @@
  * along with MissileWars.  If not, see <https://www.gnu.org/licenses/>.
  */
 
-package de.butzlabben.missilewars.configuration.arena;
+package de.butzlabben.missilewars.configuration.arena.modules;
 
 import lombok.Getter;
 import lombok.RequiredArgsConstructor;
@@ -25,7 +25,7 @@ import lombok.ToString;
 @Getter
 @ToString
 @RequiredArgsConstructor
-public class MoneyConfiguration {
+public class MoneyConfig {
 
     private int win = 80;
     private int loss = 50;

+ 2 - 2
missilewars-plugin/src/main/java/de/butzlabben/missilewars/configuration/arena/ShieldConfiguration.java → missilewars-plugin/src/main/java/de/butzlabben/missilewars/configuration/arena/modules/ShieldConfig.java

@@ -16,7 +16,7 @@
  * along with MissileWars.  If not, see <https://www.gnu.org/licenses/>.
  */
 
-package de.butzlabben.missilewars.configuration.arena;
+package de.butzlabben.missilewars.configuration.arena.modules;
 
 import com.google.gson.annotations.SerializedName;
 import de.butzlabben.missilewars.Logger;
@@ -36,7 +36,7 @@ import java.util.Set;
 @Getter
 @ToString
 @RequiredArgsConstructor
-public class ShieldConfiguration extends SchematicConfiguration {
+public class ShieldConfig extends SchematicConfiguration {
 
     @SerializedName("fly_time") private int flyTime = 20;
 

+ 13 - 33
missilewars-plugin/src/main/java/de/butzlabben/missilewars/configuration/lobby/Lobby.java → missilewars-plugin/src/main/java/de/butzlabben/missilewars/configuration/game/GameConfig.java

@@ -16,13 +16,12 @@
  * along with MissileWars.  If not, see <https://www.gnu.org/licenses/>.
  */
 
-package de.butzlabben.missilewars.configuration.lobby;
+package de.butzlabben.missilewars.configuration.game;
 
 import com.google.gson.annotations.SerializedName;
-import de.butzlabben.missilewars.Logger;
-import de.butzlabben.missilewars.configuration.Config;
-import de.butzlabben.missilewars.configuration.arena.AreaConfiguration;
-import de.butzlabben.missilewars.configuration.arena.Arena;
+import de.butzlabben.missilewars.configuration.arena.ArenaConfig;
+import de.butzlabben.missilewars.configuration.game.modules.GameTeamConfig;
+import de.butzlabben.missilewars.configuration.game.modules.LobbyConfig;
 import de.butzlabben.missilewars.game.Arenas;
 import de.butzlabben.missilewars.game.enums.JoinIngameBehavior;
 import de.butzlabben.missilewars.game.enums.MapChooseProcedure;
@@ -33,9 +32,6 @@ import lombok.Getter;
 import lombok.RequiredArgsConstructor;
 import lombok.Setter;
 import lombok.ToString;
-import org.bukkit.Bukkit;
-import org.bukkit.Location;
-import org.bukkit.World;
 
 import java.io.File;
 import java.io.IOException;
@@ -46,26 +42,22 @@ import java.util.stream.Collectors;
 @Getter
 @ToString
 @RequiredArgsConstructor
-public class Lobby {
+public class GameConfig {
 
     // The values defined here are only valid if there is no Config yet.
-    private String name = "lobby0";
+    private String name = "game0";
     @SerializedName("display_name") private String displayName = "&eDefault game";
     @SerializedName("auto_load") private boolean autoLoad = true;
-    @SerializedName("world") private String worldName = getBukkitDefaultWorld().getName();
-    @SerializedName("lobby_time") private int lobbyTime = 60;
     @SerializedName("min_players") private int minPlayers = 2;
     @SerializedName("max_players") private int maxPlayers = 20;
     @SerializedName("max_spectators") private int maxSpectators = -1;
-    @SerializedName("team_1") private GameTeamConfiguration team1Config = new GameTeamConfiguration("Team1", "&c");
-    @SerializedName("team_2") private GameTeamConfiguration team2Config = new GameTeamConfiguration("Team2", "&a");
-    @SerializedName("team_spectator") private GameTeamConfiguration teamConfigSpec = new GameTeamConfiguration("Spectator", "&f");
-    @Setter @SerializedName("spawn_point") private Location spawnPoint = Config.getFallbackSpawn().add(40, 0, 0);
-    @Setter @SerializedName("after_game_spawn") private Location afterGameSpawn = Config.getFallbackSpawn();
-    @Setter @SerializedName("area") private AreaConfiguration areaConfig = AreaConfiguration.aroundLocation(spawnPoint, 20);
+    @SerializedName("team_1") private GameTeamConfig team1Config = new GameTeamConfig("Team1", "&c");
+    @SerializedName("team_2") private GameTeamConfig team2Config = new GameTeamConfig("Team2", "&a");
+    @SerializedName("team_spectator") private GameTeamConfig teamConfigSpec = new GameTeamConfig("Spectator", "&f");
     @SerializedName("map_choose_procedure") private MapChooseProcedure mapChooseProcedure = MapChooseProcedure.FIRST;
     @SerializedName("join_ongoing_game") private JoinIngameBehavior joinIngameBehavior = JoinIngameBehavior.SPECTATOR;
     @SerializedName("rejoin_ongoing_game") private RejoinIngameBehavior rejoinIngameBehavior = RejoinIngameBehavior.LAST_TEAM;
+    @SerializedName("lobby") private LobbyConfig lobbyConfig = new LobbyConfig();
     @SerializedName("possible_arenas") private List<String> possibleArenas = new ArrayList<>() {{
         add("arena0");
     }};
@@ -73,21 +65,9 @@ public class Lobby {
     // These values are only set after the Config has been read.
     @Setter private transient GameArea area;
     @Setter private transient File file;
-
-    public World getBukkitWorld() {
-        World world = Bukkit.getWorld(worldName);
-        if (world == null) {
-            Logger.ERROR.log("Could not find any world with the name: " + worldName);
-            Logger.ERROR.log("Please correct this in the configuration of lobby \"" + name + "\"");
-        }
-        return world;
-    }
-
-    private World getBukkitDefaultWorld() {
-        return Bukkit.getWorlds().get(0);
-    }
-
-    public List<Arena> getArenas() {
+    
+    
+    public List<ArenaConfig> getArenas() {
         return possibleArenas
                 .stream()
                 .map(Arenas::getFromName)

+ 2 - 2
missilewars-plugin/src/main/java/de/butzlabben/missilewars/configuration/lobby/GameTeamConfiguration.java → missilewars-plugin/src/main/java/de/butzlabben/missilewars/configuration/game/modules/GameTeamConfig.java

@@ -16,7 +16,7 @@
  * along with MissileWars.  If not, see <https://www.gnu.org/licenses/>.
  */
 
-package de.butzlabben.missilewars.configuration.lobby;
+package de.butzlabben.missilewars.configuration.game.modules;
 
 import lombok.AllArgsConstructor;
 import lombok.Getter;
@@ -30,7 +30,7 @@ import java.util.Map;
 @Getter
 @ToString
 @AllArgsConstructor
-public class GameTeamConfiguration implements ConfigurationSerializable {
+public class GameTeamConfig implements ConfigurationSerializable {
 
     private String name;
     private String color;

+ 56 - 0
missilewars-plugin/src/main/java/de/butzlabben/missilewars/configuration/game/modules/LobbyConfig.java

@@ -0,0 +1,56 @@
+/*
+ * This file is part of MissileWars (https://github.com/Butzlabben/missilewars).
+ * Copyright (c) 2018-2021 Daniel Nägele.
+ *
+ * MissileWars is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * MissileWars is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with MissileWars.  If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package de.butzlabben.missilewars.configuration.game.modules;
+
+import com.google.gson.annotations.SerializedName;
+import de.butzlabben.missilewars.Logger;
+import de.butzlabben.missilewars.configuration.Config;
+import de.butzlabben.missilewars.configuration.arena.modules.AreaConfig;
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
+import lombok.Setter;
+import lombok.ToString;
+import org.bukkit.Bukkit;
+import org.bukkit.Location;
+import org.bukkit.World;
+
+@Getter
+@ToString
+@RequiredArgsConstructor
+public class LobbyConfig {
+    
+    @SerializedName("world") private String worldName = getBukkitDefaultWorld().getName();
+    @SerializedName("lobby_time") private int lobbyTime = 60;
+    @Setter @SerializedName("spawn_point") private Location spawnPoint = Config.getFallbackSpawn().add(40, 0, 0);
+    @Setter @SerializedName("after_game_spawn") private Location afterGameSpawn = Config.getFallbackSpawn();
+    @Setter @SerializedName("area") private AreaConfig areaConfig = AreaConfig.aroundLocation(spawnPoint, 20);
+    
+    private World getBukkitDefaultWorld() {
+        return Bukkit.getWorlds().get(0);
+    }
+    
+    public World getBukkitWorld() {
+        World world = Bukkit.getWorld(worldName);
+        if (world == null) {
+            Logger.ERROR.log("Could not find any world with the name: " + worldName);
+            Logger.ERROR.log("Please correct this in the configuration.");
+        }
+        return world;
+    }
+}

+ 19 - 18
missilewars-plugin/src/main/java/de/butzlabben/missilewars/game/Arenas.java

@@ -21,8 +21,8 @@ package de.butzlabben.missilewars.game;
 import de.butzlabben.missilewars.Logger;
 import de.butzlabben.missilewars.MissileWars;
 import de.butzlabben.missilewars.configuration.Config;
-import de.butzlabben.missilewars.configuration.arena.Arena;
-import de.butzlabben.missilewars.util.SetupUtil;
+import de.butzlabben.missilewars.configuration.arena.ArenaConfig;
+import de.butzlabben.missilewars.initialization.FileManager;
 import de.butzlabben.missilewars.util.serialization.Serializer;
 import lombok.Getter;
 import org.bukkit.Bukkit;
@@ -35,7 +35,7 @@ import java.util.Map;
 public class Arenas {
 
     @Getter
-    private static final Map<String, Arena> ARENAS = new HashMap<>();
+    private static final Map<String, ArenaConfig> ARENAS = new HashMap<>();
 
     public static void load() {
         ARENAS.clear();
@@ -46,12 +46,12 @@ public class Arenas {
         folder.mkdirs();
 
         // Get all arena files or create a new one
-        File[] files = folder.listFiles();
-        if (files.length == 0) {
-            File defaultArena = new File(folder, "arena0.yml");
+        File[] arenaFiles = folder.listFiles();
+        if (arenaFiles.length == 0) {
+            File defaultConfig = new File(folder, "arena0.yml");
             try {
-                defaultArena.createNewFile();
-                Serializer.serialize(defaultArena, new Arena());
+                defaultConfig.createNewFile();
+                Serializer.serialize(defaultConfig, new ArenaConfig());
             } catch (IOException exception) {
                 Logger.ERROR.log("Could not create default arena config");
                 Logger.ERROR.log("As there are no arenas present, the plugin is shutting down");
@@ -59,21 +59,22 @@ public class Arenas {
                 Bukkit.getPluginManager().disablePlugin(MissileWars.getInstance());
                 return;
             }
-            files = new File[] {defaultArena};
+            arenaFiles = new File[] {defaultConfig};
         }
 
-        for (File config : files) {
+        for (File config : arenaFiles) {
             if (!config.getName().endsWith(".yml") && !config.getName().endsWith(".yaml")) continue;
             try {
-                Arena arena = Serializer.deserialize(config, Arena.class);
-                arena.setFile(config);
-                if (existsArena(arena.getName())) {
-                    Logger.WARN.log("There are several arenas configured with the name \"" + arena.getName() + "\". Arenas must have a unique name");
+                ArenaConfig arenaConfig = Serializer.deserialize(config, ArenaConfig.class);
+                arenaConfig.setFile(config);
+                if (existsArena(arenaConfig.getName())) {
+                    Logger.WARN.log("There are several arenas configured with the name \"" + arenaConfig.getName() + "\". Arenas must have a unique name");
                     continue;
                 }
-                SetupUtil.checkMap(arena.getTemplateWorld());
-                arena.updateConfig();
-                ARENAS.put(arena.getName(), arena);
+                FileManager.saveDefaultResource(Config.getArenasFolder() + File.separator + "default_map", 
+                        "MissileWars-Arena.zip", MissileWars.getInstance());
+                arenaConfig.updateConfig();
+                ARENAS.put(arenaConfig.getName(), arenaConfig);
             } catch (IOException exception) {
                 Logger.ERROR.log("Could not load config for arena " + config.getName());
                 exception.printStackTrace();
@@ -81,7 +82,7 @@ public class Arenas {
         }
     }
 
-    public static Arena getFromName(String arenaName) {
+    public static ArenaConfig getFromName(String arenaName) {
         if (ARENAS.containsKey(arenaName)) return ARENAS.get(arenaName);
         return null;
     }

+ 62 - 63
missilewars-plugin/src/main/java/de/butzlabben/missilewars/game/Game.java

@@ -21,9 +21,9 @@ package de.butzlabben.missilewars.game;
 import de.butzlabben.missilewars.Logger;
 import de.butzlabben.missilewars.MissileWars;
 import de.butzlabben.missilewars.configuration.Config;
-import de.butzlabben.missilewars.configuration.Messages;
-import de.butzlabben.missilewars.configuration.arena.Arena;
-import de.butzlabben.missilewars.configuration.lobby.Lobby;
+import de.butzlabben.missilewars.configuration.PluginMessages;
+import de.butzlabben.missilewars.configuration.arena.ArenaConfig;
+import de.butzlabben.missilewars.configuration.game.GameConfig;
 import de.butzlabben.missilewars.event.GameStartEvent;
 import de.butzlabben.missilewars.event.GameStopEvent;
 import de.butzlabben.missilewars.game.enums.GameResult;
@@ -33,7 +33,6 @@ import de.butzlabben.missilewars.game.equipment.EquipmentManager;
 import de.butzlabben.missilewars.game.misc.MotdManager;
 import de.butzlabben.missilewars.game.misc.ScoreboardManager;
 import de.butzlabben.missilewars.game.misc.TeamSpawnProtection;
-import de.butzlabben.missilewars.game.schematics.SchematicFacing;
 import de.butzlabben.missilewars.game.schematics.objects.Missile;
 import de.butzlabben.missilewars.game.schematics.objects.Shield;
 import de.butzlabben.missilewars.game.signs.MWSign;
@@ -47,10 +46,10 @@ import de.butzlabben.missilewars.listener.game.GameBoundListener;
 import de.butzlabben.missilewars.listener.game.GameListener;
 import de.butzlabben.missilewars.listener.game.LobbyListener;
 import de.butzlabben.missilewars.player.MWPlayer;
-import de.butzlabben.missilewars.util.PlayerUtil;
 import de.butzlabben.missilewars.util.geometry.GameArea;
 import de.butzlabben.missilewars.util.geometry.Geometry;
 import de.butzlabben.missilewars.util.serialization.Serializer;
+import de.redstoneworld.redutilities.player.Teleport;
 import lombok.Getter;
 import lombok.Setter;
 import lombok.ToString;
@@ -73,15 +72,15 @@ import java.util.function.Consumer;
  */
 
 @Getter
-@ToString(of = {"gameWorld", "players", "lobby", "arena", "state"})
+@ToString(of = {"state", "gameConfig", "players", "gameWorld", "gameArea"})
 public class Game {
 
     @Setter private GameState state = GameState.LOBBY;
+    private final GameConfig gameConfig;
     private static final Map<String, Integer> cycles = new HashMap<>();
     private static int fights = 0;
     private final Map<UUID, MWPlayer> players = new HashMap<>();
     private final MapVoting mapVoting = new MapVoting(this);
-    private final Lobby lobby;
     private final Map<UUID, BukkitTask> playerTasks = new HashMap<>();
     private final List<Location> portalBlocks = new ArrayList<>();
     private TeamManager teamManager;
@@ -91,7 +90,7 @@ public class Game {
     private GameArea gameArea;
     private GameArea innerGameArea;
     private long timestart;
-    private Arena arena;
+    private ArenaConfig arenaConfig;
     private ScoreboardManager scoreboardManager;
     private GameJoinManager gameJoinManager;
     private GameLeaveManager gameLeaveManager;
@@ -100,30 +99,30 @@ public class Game {
     private TaskManager taskManager;
     private int remainingGameDuration;
     
-    public Game(Lobby lobby) {
-        Logger.BOOT.log("Loading lobby \"" + lobby.getName() + "\".");
-        this.lobby = lobby;
+    public Game(GameConfig game) {
+        Logger.BOOT.log("Loading game \"" + game.getName() + "\".");
+        this.gameConfig = game;
 
-        if (lobby.getBukkitWorld() == null) {
-            Logger.ERROR.log("Lobby world \"" + lobby.getName() + "\" must not be null");
+        if (gameConfig.getLobbyConfig().getBukkitWorld() == null) {
+            Logger.ERROR.log("Lobby world of the game \"" + gameConfig.getName() + "\" can not be null.");
             return;
         }
 
         try {
-            Serializer.setWorldAtAllLocations(lobby, lobby.getBukkitWorld());
+            Serializer.setWorldAtAllLocations(gameConfig, gameConfig.getLobbyConfig().getBukkitWorld());
         } catch (Exception exception) {
-            Logger.ERROR.log("Could not inject world object at lobby \"" + lobby.getName() + "\".");
+            Logger.ERROR.log("Could not inject world object from game \"" + gameConfig.getName() + "\".");
             exception.printStackTrace();
             return;
         }
 
-        if (lobby.getPossibleArenas().isEmpty()) {
-            Logger.ERROR.log("At least one valid arena must be set at lobby \"" + lobby.getName() + "\".");
+        if (gameConfig.getPossibleArenas().isEmpty()) {
+            Logger.ERROR.log("No valid arena found in game \"" + gameConfig.getName() + "\".");
             return;
         }
 
-        if (lobby.getPossibleArenas().stream().noneMatch(Arenas::existsArena)) {
-            Logger.ERROR.log("None of the specified arenas match a real arena for the lobby \"" + lobby.getName() + "\".");
+        if (gameConfig.getPossibleArenas().stream().noneMatch(Arenas::existsArena)) {
+            Logger.ERROR.log("None of the specified arenas match a real arena for the game \"" + gameConfig.getName() + "\".");
             return;
         }
         
@@ -138,14 +137,14 @@ public class Game {
         taskManager = new TaskManager(this);
         taskManager.stopTimer();
         updateGameListener(new LobbyListener(this));
-        taskManager.setTimer(new LobbyTimer(this, lobby.getLobbyTime()));
+        taskManager.setTimer(new LobbyTimer(this, gameConfig.getLobbyConfig().getLobbyTime()));
         taskManager.runTimer(0, 20);
         state = GameState.LOBBY;
 
         Bukkit.getScheduler().runTaskLater(MissileWars.getInstance(), () -> applyForAllPlayers(player -> gameJoinManager.runTeleportEventForPlayer(player)), 2);
 
         if (Config.isSetup()) {
-            Logger.WARN.log("Did not fully initialize lobby \"" + lobby.getName() + "\" as the plugin is in setup mode");
+            Logger.WARN.log("Did not fully initialize game \"" + gameConfig.getName() + "\" as the plugin is in setup mode");
             return;
         }
 
@@ -154,22 +153,22 @@ public class Game {
         gameLeaveManager = new GameLeaveManager(this);
         
         // choose the game arena
-        if (lobby.getMapChooseProcedure() == MapChooseProcedure.FIRST) {
-            setArena(lobby.getArenas().get(0));
+        if (gameConfig.getMapChooseProcedure() == MapChooseProcedure.FIRST) {
+            setArena(gameConfig.getArenas().get(0));
             prepareGame();
 
-        } else if (lobby.getMapChooseProcedure() == MapChooseProcedure.MAPCYCLE) {
-            final int lastMapIndex = cycles.getOrDefault(lobby.getName(), -1);
-            List<Arena> arenas = lobby.getArenas();
+        } else if (gameConfig.getMapChooseProcedure() == MapChooseProcedure.MAPCYCLE) {
+            final int lastMapIndex = cycles.getOrDefault(gameConfig.getName(), -1);
+            List<ArenaConfig> arenas = gameConfig.getArenas();
             int index = lastMapIndex >= arenas.size() - 1 ? 0 : lastMapIndex + 1;
-            cycles.put(lobby.getName(), index);
+            cycles.put(gameConfig.getName(), index);
             setArena(arenas.get(index));
             prepareGame();
 
-        } else if (lobby.getMapChooseProcedure() == MapChooseProcedure.MAPVOTING) {
+        } else if (gameConfig.getMapChooseProcedure() == MapChooseProcedure.MAPVOTING) {
             if (mapVoting.onlyOneArenaFound()) {
-                setArena(lobby.getArenas().get(0));
-                Logger.WARN.log("Only one arena was found for the lobby \"" + lobby.getName() + "\". The configured map voting was skipped.");
+                setArena(gameConfig.getArenas().get(0));
+                Logger.WARN.log("Only one arena was found for the game \"" + gameConfig.getName() + "\". The configured map voting was skipped.");
                 prepareGame();
             } else {
                 mapVoting.startVote();
@@ -186,7 +185,7 @@ public class Game {
      * now already defined.
      */
     public void prepareGame() {
-        if (this.arena == null) {
+        if (this.arenaConfig == null) {
             throw new IllegalStateException("The arena is not yet set");
         }
         
@@ -219,7 +218,7 @@ public class Game {
     }
 
     private void updateMOTD() {
-        if (!Config.isMultipleLobbies()) {
+        if (!Config.useMultipleGames()) {
             MotdManager.getInstance().updateMOTD(this);
         }
     }
@@ -233,7 +232,7 @@ public class Game {
         World world = gameWorld.getWorld();
 
         if (world == null) {
-            Logger.ERROR.log("Could not start game in arena \"" + arena.getName() + "\". World is null");
+            Logger.ERROR.log("Could not start game in arena \"" + arenaConfig.getName() + "\". World is null");
             return;
         }
 
@@ -281,7 +280,7 @@ public class Game {
 
         updateMOTD();
 
-        if (arena.isSaveStatistics()) {
+        if (arenaConfig.isSaveStatistics()) {
             FightStats stats = new FightStats(this);
             stats.insert();
         }
@@ -298,7 +297,7 @@ public class Game {
             return;
         }
 
-        GameManager.getInstance().restartGame(lobby, false);
+        GameManager.getInstance().restartGame(gameConfig, false);
     }
 
     public void appendRestart() {
@@ -352,7 +351,7 @@ public class Game {
      * @return true, if it's in the Lobby-Area
      */
     public boolean isInLobbyArea(Location location) {
-        return Geometry.isInsideIn(location, lobby.getArea());
+        return Geometry.isInsideIn(location, gameConfig.getArea());
     }
 
     /**
@@ -458,10 +457,10 @@ public class Game {
     public void spawnMissile(Player player, ItemStack itemStack) {
 
         // Are missiles only allowed to spawn inside the arena, between the two arena spawn points?
-        boolean isOnlyBetweenSpawnPlaceable = this.arena.getMissileConfiguration().isOnlyBetweenSpawnPlaceable();
+        boolean isOnlyBetweenSpawnPlaceable = this.arenaConfig.getMissileConfig().isOnlyBetweenSpawnPlaceable();
         if (isOnlyBetweenSpawnPlaceable) {
             if (!isInInnerGameArea(player.getLocation())) {
-                player.sendMessage(Messages.getMessage(true, Messages.MessageEnum.ARENA_MISSILE_PLACE_DENY));
+                player.sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.ARENA_MISSILE_PLACE_DENY));
                 return;
             }
         }
@@ -469,9 +468,9 @@ public class Game {
         ItemMeta itemMeta = itemStack.getItemMeta();
         if (itemMeta == null) return;
         
-        Missile missile = (Missile) this.arena.getMissileConfiguration().getSchematicFromDisplayName(itemMeta.getDisplayName());
+        Missile missile = (Missile) this.arenaConfig.getMissileConfig().getSchematicFromDisplayName(itemMeta.getDisplayName());
         if (missile == null) {
-            player.sendMessage(Messages.getMessage(true, Messages.MessageEnum.COMMAND_INVALID_MISSILE)
+            player.sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.COMMAND_INVALID_MISSILE)
                     .replace("%input%", itemMeta.getDisplayName()));
             return;
         }
@@ -492,9 +491,9 @@ public class Game {
         ItemMeta itemMeta = ball.getItem().getItemMeta();
         if (itemMeta == null) return;
 
-        Shield shield = (Shield) this.arena.getShieldConfiguration().getSchematicFromDisplayName(itemMeta.getDisplayName());
+        Shield shield = (Shield) this.arenaConfig.getShieldConfig().getSchematicFromDisplayName(itemMeta.getDisplayName());
         if (shield == null) {
-            player.sendMessage(Messages.getMessage(true, Messages.MessageEnum.COMMAND_INVALID_SHIELD)
+            player.sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.COMMAND_INVALID_SHIELD)
                     .replace("%input%", itemMeta.getDisplayName()));
             return;
         }
@@ -521,26 +520,26 @@ public class Game {
         fb.setBounce(false);
     }
 
-    public void setArena(Arena arena) {
-        if (this.arena != null) {
+    public void setArena(ArenaConfig arenaConfig) {
+        if (this.arenaConfig != null) {
             throw new IllegalStateException("Arena already set");
         }
 
-        arena.getMissileConfiguration().check();
-        arena.getShieldConfiguration().check();
+        arenaConfig.getMissileConfig().check();
+        arenaConfig.getShieldConfig().check();
 
-        this.arena = arena.clone();
-        gameWorld = new GameWorld(this, arena.getTemplateWorld());
+        this.arenaConfig = arenaConfig.clone();
+        gameWorld = new GameWorld(this, arenaConfig.getTemplateWorld());
         gameWorld.load();
-        gameArea = new GameArea(gameWorld.getWorld(), arena.getAreaConfig());
+        gameArea = new GameArea(gameWorld.getWorld(), arenaConfig.getAreaConfig());
 
         try {
-            Serializer.setWorldAtAllLocations(this.arena, gameWorld.getWorld());
-            teamManager.getTeam1().setSpawn(this.arena.getTeam1Spawn());
-            teamManager.getTeam2().setSpawn(this.arena.getTeam2Spawn());
-            teamManager.getTeamSpec().setSpawn(this.arena.getSpectatorSpawn());
+            Serializer.setWorldAtAllLocations(this.arenaConfig, gameWorld.getWorld());
+            teamManager.getTeam1().setSpawn(this.arenaConfig.getTeam1Spawn());
+            teamManager.getTeam2().setSpawn(this.arenaConfig.getTeam2Spawn());
+            teamManager.getTeamSpec().setSpawn(this.arenaConfig.getSpectatorSpawn());
         } catch (Exception exception) {
-            Logger.ERROR.log("Could not inject world object at arena " + this.arena.getName());
+            Logger.ERROR.log("Could not inject world object at arena " + this.arenaConfig.getName());
             exception.printStackTrace();
             return;
         }
@@ -656,7 +655,7 @@ public class Game {
      * @return (boolean) 'true' if to few players are in the lobby 
      */
     public boolean areToFewPlayers() {
-        int minSize = lobby.getMinPlayers();
+        int minSize = gameConfig.getMinPlayers();
         int currentSize = teamManager.getTeam1().getMembers().size() + teamManager.getTeam2().getMembers().size();
         return currentSize < minSize;
     }
@@ -669,7 +668,7 @@ public class Game {
      * @return (boolean) 'true' if to many players are in the lobby 
      */
     public boolean areTooManyPlayers() {
-        int maxSize = lobby.getMaxPlayers();
+        int maxSize = gameConfig.getMaxPlayers();
         
         if (maxSize == -1) return false;
         
@@ -683,7 +682,7 @@ public class Game {
      * @return (boolean) 'true' if to many spectators are in the lobby 
      */
     public boolean areTooManySpectators() {
-        int maxSize = lobby.getMaxSpectators();
+        int maxSize = gameConfig.getMaxSpectators();
         
         if (maxSize == -1) return false;
         
@@ -693,11 +692,11 @@ public class Game {
     
     public int getGameDuration() {
         int time = 0;
-        if (arena == null) return time;
+        if (arenaConfig == null) return time;
         
         if (state == GameState.LOBBY) {
             // Show the planned duration of the next game:
-            time = arena.getGameDuration();
+            time = arenaConfig.getGameDuration();
         } else if (state == GameState.INGAME) {
             // Show the remaining duration of the running game:
             time = getTaskManager().getTimer().getSeconds() / 60;
@@ -733,19 +732,19 @@ public class Game {
     }
 
     public void teleportToFallbackSpawn(Player player) {
-        PlayerUtil.teleportSafely(player, Config.getFallbackSpawn());
+        Teleport.teleportSafely(player, Config.getFallbackSpawn());
     }
 
     public void teleportToLobbySpawn(Player player) {
-        PlayerUtil.teleportSafely(player, lobby.getSpawnPoint());
+        Teleport.teleportSafely(player, gameConfig.getLobbyConfig().getSpawnPoint());
     }
 
     public void teleportToArenaSpectatorSpawn(Player player) {
-        PlayerUtil.teleportSafely(player, arena.getSpectatorSpawn());
+        Teleport.teleportSafely(player, arenaConfig.getSpectatorSpawn());
     }
 
     public void teleportToAfterGameSpawn(Player player) {
-        PlayerUtil.teleportSafely(player, lobby.getAfterGameSpawn());
+        Teleport.teleportSafely(player, gameConfig.getLobbyConfig().getAfterGameSpawn());
     }
     
     /**

+ 14 - 14
missilewars-plugin/src/main/java/de/butzlabben/missilewars/game/GameJoinManager.java

@@ -21,7 +21,7 @@ package de.butzlabben.missilewars.game;
 import de.butzlabben.missilewars.Logger;
 import de.butzlabben.missilewars.MissileWars;
 import de.butzlabben.missilewars.configuration.Config;
-import de.butzlabben.missilewars.configuration.Messages;
+import de.butzlabben.missilewars.configuration.PluginMessages;
 import de.butzlabben.missilewars.game.enums.GameState;
 import de.butzlabben.missilewars.game.enums.TeamType;
 import de.butzlabben.missilewars.menus.hotbar.GameJoinMenu;
@@ -80,7 +80,7 @@ public class GameJoinManager {
             Team lastTeam = game.getGameLeaveManager().getLastTeamOfKnownPlayer(player.getUniqueId());
             
             if (isKnownPlayer) {
-                player.sendMessage(Messages.getMessage(true, Messages.MessageEnum.GAME_REJOINED)
+                player.sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.GAME_REJOINED)
                         .replace("%last-team%", lastTeam.getFullname()));
                 
                 if (lastTeam.getTeamType() == targetTeamType) team = lastTeam;
@@ -210,12 +210,12 @@ public class GameJoinManager {
         
         String broadcastMsg;
         if (game.getState() == GameState.LOBBY) {
-            broadcastMsg = Messages.getMessage(true, Messages.MessageEnum.LOBBY_PLAYER_JOINED);
+            broadcastMsg = PluginMessages.getMessage(true, PluginMessages.MessageEnum.LOBBY_PLAYER_JOINED);
         } else {
-            broadcastMsg = Messages.getMessage(true, Messages.MessageEnum.GAME_PLAYER_JOINED);
+            broadcastMsg = PluginMessages.getMessage(true, PluginMessages.MessageEnum.GAME_PLAYER_JOINED);
         }
         
-        game.broadcast(broadcastMsg.replace("%max_players%", Integer.toString(game.getLobby().getMaxPlayers()))
+        game.broadcast(broadcastMsg.replace("%max_players%", Integer.toString(game.getGameConfig().getMaxPlayers()))
                 .replace("%players%", Integer.toString(game.getPlayerAmount()))
                 .replace("%player%", player.getName())
                 .replace("%team%", (mwPlayer.getTeam() != null) ? mwPlayer.getTeam().getFullname() : "?"));
@@ -226,12 +226,12 @@ public class GameJoinManager {
         
         String broadcastMsg;
         if (game.getState() == GameState.LOBBY) {
-            broadcastMsg = Messages.getMessage(true, Messages.MessageEnum.LOBBY_PLAYER_SWITCHED);
+            broadcastMsg = PluginMessages.getMessage(true, PluginMessages.MessageEnum.LOBBY_PLAYER_SWITCHED);
         } else {
-            broadcastMsg = Messages.getMessage(true, Messages.MessageEnum.GAME_PLAYER_SWITCHED);
+            broadcastMsg = PluginMessages.getMessage(true, PluginMessages.MessageEnum.GAME_PLAYER_SWITCHED);
         }
         
-        game.broadcast(broadcastMsg.replace("%max_players%", Integer.toString(game.getLobby().getMaxPlayers()))
+        game.broadcast(broadcastMsg.replace("%max_players%", Integer.toString(game.getGameConfig().getMaxPlayers()))
                 .replace("%players%", Integer.toString(game.getPlayerAmount()))
                 .replace("%player%", player.getName())
                 .replace("%from%", oldTeam.getFullname())
@@ -244,20 +244,20 @@ public class GameJoinManager {
         String privateMsg;
         if (mwPlayer.getTeam() == teamManager.getTeamSpec()) {
             if (isTeamSwitch) {
-                privateMsg = Messages.getMessage(true, Messages.MessageEnum.TEAM_SPECTATOR_TEAM_SWITCH);
+                privateMsg = PluginMessages.getMessage(true, PluginMessages.MessageEnum.TEAM_SPECTATOR_TEAM_SWITCH);
             } else {
-                privateMsg = Messages.getMessage(true, Messages.MessageEnum.TEAM_SPECTATOR_TEAM_ASSIGNED);
+                privateMsg = PluginMessages.getMessage(true, PluginMessages.MessageEnum.TEAM_SPECTATOR_TEAM_ASSIGNED);
             }
             
         } else {
             if (isTeamSwitch) {
-                privateMsg = Messages.getMessage(true, Messages.MessageEnum.TEAM_PLAYER_TEAM_SWITCH);
+                privateMsg = PluginMessages.getMessage(true, PluginMessages.MessageEnum.TEAM_PLAYER_TEAM_SWITCH);
             } else {
-                privateMsg = Messages.getMessage(true, Messages.MessageEnum.TEAM_PLAYER_TEAM_ASSIGNED);
+                privateMsg = PluginMessages.getMessage(true, PluginMessages.MessageEnum.TEAM_PLAYER_TEAM_ASSIGNED);
             }
         }
         
-        player.sendMessage(privateMsg.replace("%max_players%", Integer.toString(game.getLobby().getMaxPlayers()))
+        player.sendMessage(privateMsg.replace("%max_players%", Integer.toString(game.getGameConfig().getMaxPlayers()))
                 .replace("%players%", Integer.toString(game.getPlayerAmount()))
                 .replace("%player%", player.getName())
                 .replace("%team%", (mwPlayer.getTeam() != null) ? mwPlayer.getTeam().getFullname() : "?"));
@@ -286,7 +286,7 @@ public class GameJoinManager {
      */
     public void runTeleportEventForPlayer(Player player) {
         Bukkit.getPluginManager().callEvent(new PlayerTeleportEvent(player,
-                Config.getFallbackSpawn(), game.getLobby().getSpawnPoint()));
+                Config.getFallbackSpawn(), game.getGameConfig().getLobbyConfig().getSpawnPoint()));
     }
     
 }

+ 9 - 7
missilewars-plugin/src/main/java/de/butzlabben/missilewars/game/GameLeaveManager.java

@@ -19,7 +19,7 @@
 package de.butzlabben.missilewars.game;
 
 import de.butzlabben.missilewars.MissileWars;
-import de.butzlabben.missilewars.configuration.Messages;
+import de.butzlabben.missilewars.configuration.PluginMessages;
 import de.butzlabben.missilewars.game.enums.GameResult;
 import de.butzlabben.missilewars.game.enums.GameState;
 import de.butzlabben.missilewars.game.enums.TeamType;
@@ -62,13 +62,13 @@ public class GameLeaveManager {
 
         String message = null;
         if (game.getState() == GameState.LOBBY) {
-            message = Messages.getMessage(true, Messages.MessageEnum.LOBBY_PLAYER_LEFT);
+            message = PluginMessages.getMessage(true, PluginMessages.MessageEnum.LOBBY_PLAYER_LEFT);
         } else if (game.getState() == GameState.INGAME) {
-            message = Messages.getMessage(true, Messages.MessageEnum.GAME_PLAYER_LEFT);
+            message = PluginMessages.getMessage(true, PluginMessages.MessageEnum.GAME_PLAYER_LEFT);
         }
 
         if (message != null) {
-            game.broadcast(message.replace("%max_players%", Integer.toString(game.getLobby().getMaxPlayers()))
+            game.broadcast(message.replace("%max_players%", Integer.toString(game.getGameConfig().getMaxPlayers()))
                     .replace("%players%", Integer.toString(game.getPlayerAmount()))
                     .replace("%player%", player.getName())
                     .replace("%team%", team.getFullname()));
@@ -77,9 +77,11 @@ public class GameLeaveManager {
         player.setScoreboard(Bukkit.getScoreboardManager().getMainScoreboard());
         
         if (game.getState() == GameState.LOBBY) {
-            player.sendMessage(Messages.getMessage(true, Messages.MessageEnum.LOBBY_LEFT).replace("%lobby_name%", game.getLobby().getDisplayName()));
+            player.sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.LOBBY_LEFT)
+                    .replace("%game_name%", game.getGameConfig().getDisplayName()));
         } else if (game.getState() == GameState.INGAME) {
-            player.sendMessage(Messages.getMessage(true, Messages.MessageEnum.GAME_LEFT).replace("%arena_name%", game.getArena().getDisplayName()));
+            player.sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.GAME_LEFT)
+                    .replace("%arena_name%", game.getArenaConfig().getDisplayName()));
         }
 
     }
@@ -109,7 +111,7 @@ public class GameLeaveManager {
                 game.sendGameResult();
                 game.stopGame();
             });
-            game.broadcast(Messages.getMessage(true, Messages.MessageEnum.TEAM_ALL_TEAMMATES_OFFLINE)
+            game.broadcast(PluginMessages.getMessage(true, PluginMessages.MessageEnum.TEAM_ALL_TEAMMATES_OFFLINE)
                     .replace("%team%", team.getFullname()));
         }
     }

+ 53 - 69
missilewars-plugin/src/main/java/de/butzlabben/missilewars/game/GameManager.java

@@ -21,8 +21,7 @@ package de.butzlabben.missilewars.game;
 import de.butzlabben.missilewars.Logger;
 import de.butzlabben.missilewars.MissileWars;
 import de.butzlabben.missilewars.configuration.Config;
-import de.butzlabben.missilewars.configuration.lobby.Lobby;
-import de.butzlabben.missilewars.configuration.Messages;
+import de.butzlabben.missilewars.configuration.game.GameConfig;
 import de.butzlabben.missilewars.game.enums.GameState;
 import de.butzlabben.missilewars.util.geometry.GameArea;
 import de.butzlabben.missilewars.util.serialization.Serializer;
@@ -55,34 +54,35 @@ public class GameManager {
         
         for (Game game : gamesListCache) {
             game.setState(GameState.END);
-            restartGame(game.getLobby(), false);
+            restartGame(game.getGameConfig(), false);
         }
     }
 
     /**
-     * This method is for starting up the server. The game lobby configurations
-     * are loaded here.
+     * This method is for starting up the server. The game (and included lobby) 
+     * configurations are loaded here.
      */
     public void loadGamesOnStartup() {
-        File[] lobbyFiles = null;
-        if (Config.isMultipleLobbies()) {
-            lobbyFiles = new File(Config.getLobbiesFolder()).listFiles();
+        File[] gameFiles = null;
+        if (Config.useMultipleGames()) {
+            gameFiles = new File(Config.getGamesFolder()).listFiles();
         } else {
-            File lobbiesFolder = new File(Config.getLobbiesFolder());
-            File file = new File(lobbiesFolder, Config.getDefaultLobby());
+            File gamesFolder = new File(Config.getGamesFolder());
+            File file = new File(gamesFolder, Config.getDefaultGame());
             if (file.exists()) {
-                lobbyFiles = new File[] {file};
+                gameFiles = new File[] {file};
             }
         }
-        if (lobbyFiles == null) lobbyFiles = new File[0];
+        if (gameFiles == null) gameFiles = new File[0];
 
-        if (lobbyFiles.length == 0) {
-            Logger.WARN.log("No lobby configs found. Creating default one");
-            File lobbiesFolder = new File(Config.getLobbiesFolder());
-            File file = new File(lobbiesFolder, Config.getDefaultLobby());
+        if (gameFiles.length == 0) {
+            Logger.WARN.log("No game-configs found. Creating default one.");
+            File gamesFolder = new File(Config.getGamesFolder());
+            gamesFolder.mkdirs();
+            File defaultConfig = new File(gamesFolder, Config.getDefaultGame());
             try {
-                file.createNewFile();
-                Serializer.serialize(file, new Lobby());
+                defaultConfig.createNewFile();
+                Serializer.serialize(defaultConfig, new GameConfig());
             } catch (IOException exception) {
                 Logger.ERROR.log("Could not create default arena config");
                 Logger.ERROR.log("As there are no arenas present, the plugin is shutting down");
@@ -90,44 +90,44 @@ public class GameManager {
                 Bukkit.getPluginManager().disablePlugin(MissileWars.getInstance());
                 return;
             }
-            lobbyFiles = new File[] {file};
+            gameFiles = new File[] {defaultConfig};
         }
 
-        for (File lobbyFile : lobbyFiles) {
-            if (lobbyFile == null) continue;
-            if (!lobbyFile.getName().endsWith(".yml") && !lobbyFile.getName().endsWith(".yaml")) continue;
+        for (File config : gameFiles) {
+            if (!config.getName().endsWith(".yml") && !config.getName().endsWith(".yaml")) continue;
 
-            debugStart(lobbyFile);
+            debugStart(config);
         }
     }
 
     /**
-     * This method attempts to read the game lobby configuration and build a game
-     * from it. Config mistakes are recognized and the config is saved again.
+     * This method attempts to read the game (and included lobby) configuration and 
+     * build a game from it. Config mistakes are recognized and the config is saved again.
      *
-     * @param lobbyFile (File) the arena configuration file
+     * @param gameFile (File) the arena configuration file
      */
-    private void debugStart(File lobbyFile) {
-        Logger.BOOT.log("Try to loading lobby of \"" + lobbyFile.getName() + "\"");
+    private void debugStart(File gameFile) {
+        Logger.BOOT.log("Try to loading game from \"" + gameFile.getName() + "\"");
 
         try {
-            Lobby lobby = Serializer.deserialize(lobbyFile, Lobby.class);
+            GameConfig gameConfig = Serializer.deserialize(gameFile, GameConfig.class);
 
-            if (lobby == null) {
-                Logger.ERROR.log("Could not load lobby of \"" + lobbyFile.getName() + "\"");
+            if (gameConfig == null) {
+                Logger.ERROR.log("Could not get game-config from \"" + gameFile.getName() + "\"");
                 return;
             }
 
-            if (getGame(lobby.getName()) != null) {
-                Logger.ERROR.log("A lobby with the same name was already loaded. Names of lobbies must be unique, this lobby will not be loaded");
+            if (getGame(gameConfig.getName()) != null) {
+                Logger.ERROR.log("A game with the same name was already loaded. Names of games must be unique. " 
+                        + "This game and his lobby will not be loaded.");
                 return;
             }
 
-            lobby.setFile(lobbyFile);
-            restartGame(lobby, false);
+            gameConfig.setFile(gameFile);
+            restartGame(gameConfig, false);
 
         } catch (IOException exception) {
-            Logger.ERROR.log("Could not load lobby of \"" + lobbyFile.getName() + "\"");
+            Logger.ERROR.log("Could not load game from \"" + gameFile.getName() + "\"");
             exception.printStackTrace();
         }
     }
@@ -135,38 +135,38 @@ public class GameManager {
     /**
      * This method (re)starts a MissileWars game.
      *
-     * @param targetLobby (Lobby) the existing lobby of the game
-     * @param forceStart  true, if it should also (re)start, if it's not an automatically
-     *                    starting game according to the lobby configuration
+     * @param targetGameConfig (GameConfig) the existing game-config of the game
+     * @param forceStart  true, if it should also (re)start, if it's not an automatically 
+     *                    starting game according to the game configuration
      */
-    public void restartGame(Lobby targetLobby, boolean forceStart) {
-        if (!targetLobby.isAutoLoad() && !forceStart) return;
+    public void restartGame(GameConfig targetGameConfig, boolean forceStart) {
+        if (!targetGameConfig.isAutoLoad() && !forceStart) return;
 
-        String targetLobbyName = targetLobby.getName();
+        String targetGameName = targetGameConfig.getName();
 
         // reset the old game
-        Game game = getGame(targetLobbyName);
+        Game game = getGame(targetGameName);
         if (game != null) {
             game.resetGame();
         }
 
         // delete the old game from the list
-        games.remove(targetLobbyName);
+        games.remove(targetGameName);
 
-        Logger.DEBUG.log("Old Game disabled.");
+        Logger.DEBUG.log("Old game disabled.");
 
-        // read the game lobby configuration and build a new game and lobby from it
+        // read the game configuration and build a new game and lobby from it
         try {
-            Lobby lobby = Serializer.deserialize(targetLobby.getFile(), Lobby.class);
-            lobby.setFile(targetLobby.getFile());
-            lobby.setArea(new GameArea(lobby.getBukkitWorld(), lobby.getAreaConfig()));
-            lobby.updateConfig();
+            GameConfig gameConfig = Serializer.deserialize(targetGameConfig.getFile(), GameConfig.class);
+            gameConfig.setFile(targetGameConfig.getFile());
+            gameConfig.setArea(new GameArea(gameConfig.getLobbyConfig().getBukkitWorld(), gameConfig.getLobbyConfig().getAreaConfig()));
+            gameConfig.updateConfig();
 
-            Logger.BOOTDONE.log("Reloaded lobby \"" + targetLobbyName + "\" (" + targetLobby.getFile().getName() + ")");
-            addGame(targetLobbyName, new Game(lobby));
+            Logger.BOOTDONE.log("Reloaded game \"" + targetGameName + "\" (" + targetGameConfig.getFile().getName() + ")");
+            addGame(targetGameName, new Game(gameConfig));
 
         } catch (IOException exception) {
-            Logger.ERROR.log("Could not load lobby of \"" + targetLobby.getFile().getName() + "\"");
+            Logger.ERROR.log("Could not load game from \"" + targetGameConfig.getFile().getName() + "\"");
             exception.printStackTrace();
         }
     }
@@ -192,20 +192,4 @@ public class GameManager {
         return null;
     }
     
-    public String getGameStateMessage(Game game) {
-        
-        if (game == null) return Messages.getMessage(false, Messages.MessageEnum.GAME_STATE_NO_GAME);
-        
-        switch (game.getState()) {
-            case LOBBY:
-                return Messages.getMessage(false, Messages.MessageEnum.GAME_STATE_LOBBY);
-            case INGAME:
-                return Messages.getMessage(false, Messages.MessageEnum.GAME_STATE_INGAME);
-            case END:
-                return Messages.getMessage(false, Messages.MessageEnum.GAME_STATE_END);
-            default:
-                return Messages.getMessage(false, Messages.MessageEnum.GAME_STATE_ERROR);
-        }
-    }
-    
 }

+ 17 - 17
missilewars-plugin/src/main/java/de/butzlabben/missilewars/game/GameResultManager.java

@@ -2,7 +2,7 @@ package de.butzlabben.missilewars.game;
 
 import de.butzlabben.missilewars.MissileWars;
 import de.butzlabben.missilewars.configuration.Config;
-import de.butzlabben.missilewars.configuration.Messages;
+import de.butzlabben.missilewars.configuration.PluginMessages;
 import de.butzlabben.missilewars.game.enums.GameResult;
 import de.butzlabben.missilewars.game.enums.TeamType;
 import de.butzlabben.missilewars.player.MWPlayer;
@@ -61,13 +61,13 @@ public class GameResultManager {
 
         switch (mwPlayer.getTeam().getGameResult()) {
             case WIN:
-                money = game.getArena().getMoney().getWin();
+                money = game.getArenaConfig().getMoney().getWin();
                 break;
             case LOSE:
-                money = game.getArena().getMoney().getLoss();
+                money = game.getArenaConfig().getMoney().getLoss();
                 break;
             case DRAW:
-                money = game.getArena().getMoney().getDraw();
+                money = game.getArenaConfig().getMoney().getDraw();
                 break;
             default:
                 money = 0;
@@ -87,16 +87,16 @@ public class GameResultManager {
 
         switch (mwPlayer.getTeam().getGameResult()) {
             case WIN:
-                title = Messages.getMessage(false, Messages.MessageEnum.GAME_RESULT_TITLE_WINNER);
-                subTitle = Messages.getMessage(false, Messages.MessageEnum.GAME_RESULT_SUBTITLE_WINNER);
+                title = PluginMessages.getMessage(false, PluginMessages.MessageEnum.GAME_RESULT_TITLE_WINNER);
+                subTitle = PluginMessages.getMessage(false, PluginMessages.MessageEnum.GAME_RESULT_SUBTITLE_WINNER);
                 break;
             case LOSE:
-                title = Messages.getMessage(false, Messages.MessageEnum.GAME_RESULT_TITLE_LOSER);
-                subTitle = Messages.getMessage(false, Messages.MessageEnum.GAME_RESULT_SUBTITLE_LOSER);
+                title = PluginMessages.getMessage(false, PluginMessages.MessageEnum.GAME_RESULT_TITLE_LOSER);
+                subTitle = PluginMessages.getMessage(false, PluginMessages.MessageEnum.GAME_RESULT_SUBTITLE_LOSER);
                 break;
             case DRAW:
-                title = Messages.getMessage(false, Messages.MessageEnum.GAME_RESULT_TITLE_DRAW);
-                subTitle = Messages.getMessage(false, Messages.MessageEnum.GAME_RESULT_SUBTITLE_DRAW);
+                title = PluginMessages.getMessage(false, PluginMessages.MessageEnum.GAME_RESULT_TITLE_DRAW);
+                subTitle = PluginMessages.getMessage(false, PluginMessages.MessageEnum.GAME_RESULT_SUBTITLE_DRAW);
                 break;
             default:
                 title = null;
@@ -137,18 +137,18 @@ public class GameResultManager {
         String subTitle;
 
         if (teamManager.getTeam1().getGameResult() == GameResult.WIN) {
-            title = Messages.getMessage(false, Messages.MessageEnum.GAME_RESULT_TITLE_WON)
+            title = PluginMessages.getMessage(false, PluginMessages.MessageEnum.GAME_RESULT_TITLE_WON)
                     .replace("%team%", teamManager.getTeam1().getName());
-            subTitle = Messages.getMessage(false, Messages.MessageEnum.GAME_RESULT_SUBTITLE_WON);
+            subTitle = PluginMessages.getMessage(false, PluginMessages.MessageEnum.GAME_RESULT_SUBTITLE_WON);
 
         } else if (teamManager.getTeam2().getGameResult() == GameResult.WIN) {
-            title = Messages.getMessage(false, Messages.MessageEnum.GAME_RESULT_TITLE_WON)
+            title = PluginMessages.getMessage(false, PluginMessages.MessageEnum.GAME_RESULT_TITLE_WON)
                     .replace("%team%", teamManager.getTeam2().getName());
-            subTitle = Messages.getMessage(false, Messages.MessageEnum.GAME_RESULT_SUBTITLE_WON);
+            subTitle = PluginMessages.getMessage(false, PluginMessages.MessageEnum.GAME_RESULT_SUBTITLE_WON);
 
         } else {
-            title = Messages.getMessage(false, Messages.MessageEnum.GAME_RESULT_TITLE_DRAW);
-            subTitle = Messages.getMessage(false, Messages.MessageEnum.GAME_RESULT_SUBTITLE_DRAW);
+            title = PluginMessages.getMessage(false, PluginMessages.MessageEnum.GAME_RESULT_TITLE_DRAW);
+            subTitle = PluginMessages.getMessage(false, PluginMessages.MessageEnum.GAME_RESULT_SUBTITLE_DRAW);
 
         }
 
@@ -175,7 +175,7 @@ public class GameResultManager {
             
         }
         
-        Firework firework = game.getGameWorld().getWorld().spawn(game.getArena().getSpectatorSpawn(), Firework.class);
+        Firework firework = game.getGameWorld().getWorld().spawn(game.getArenaConfig().getSpectatorSpawn(), Firework.class);
         FireworkMeta fireworkMeta = firework.getFireworkMeta();
         
         fireworkMeta.clearEffects();

+ 4 - 4
missilewars-plugin/src/main/java/de/butzlabben/missilewars/game/GameWorld.java

@@ -20,7 +20,7 @@ package de.butzlabben.missilewars.game;
 
 import de.butzlabben.missilewars.Logger;
 import de.butzlabben.missilewars.configuration.Config;
-import de.butzlabben.missilewars.configuration.Messages;
+import de.butzlabben.missilewars.configuration.PluginMessages;
 import java.io.File;
 import java.io.IOException;
 import lombok.Getter;
@@ -65,7 +65,7 @@ public class GameWorld {
         synchronized (lock) {
             Bukkit.getOnlinePlayers().forEach(p -> {
                 if (p.isDead() && p.getWorld().getName().equals(worldName)) {
-                    p.kickPlayer(Messages.getMessage(true, Messages.MessageEnum.ARENA_KICK_INACTIVITY));
+                    p.kickPlayer(PluginMessages.getMessage(true, PluginMessages.MessageEnum.ARENA_KICK_INACTIVITY));
                 }
             });
         }
@@ -126,8 +126,8 @@ public class GameWorld {
             World world = Bukkit.createWorld(new WorldCreator(worldName));
             Bukkit.getWorlds().add(world);
 
-            world.setGameRule(GameRule.DO_TILE_DROPS, game.getArena().isDoTileDrops());
-            world.setGameRule(GameRule.KEEP_INVENTORY, game.getArena().isKeepInventory());
+            world.setGameRule(GameRule.DO_TILE_DROPS, game.getArenaConfig().isDoTileDrops());
+            world.setGameRule(GameRule.KEEP_INVENTORY, game.getArenaConfig().isKeepInventory());
         }
     }
 

+ 36 - 36
missilewars-plugin/src/main/java/de/butzlabben/missilewars/game/MapVoting.java

@@ -18,8 +18,8 @@
 
 package de.butzlabben.missilewars.game;
 
-import de.butzlabben.missilewars.configuration.Messages;
-import de.butzlabben.missilewars.configuration.arena.Arena;
+import de.butzlabben.missilewars.configuration.PluginMessages;
+import de.butzlabben.missilewars.configuration.arena.ArenaConfig;
 import de.butzlabben.missilewars.game.enums.MapChooseProcedure;
 import de.butzlabben.missilewars.game.enums.VoteState;
 import de.butzlabben.missilewars.player.MWPlayer;
@@ -33,7 +33,7 @@ import java.util.stream.Collectors;
 
 public class MapVoting {
 
-    private final Map<MWPlayer, Arena> arenaVotes = new HashMap<>();
+    private final Map<MWPlayer, ArenaConfig> arenaVotes = new HashMap<>();
     private Game game;
     @Getter private VoteState state = VoteState.NULL;
 
@@ -52,22 +52,22 @@ public class MapVoting {
     public void addVote(Player player, String arenaName) {
         
         if (state == VoteState.NULL) {
-            player.sendMessage(Messages.getMessage(true, Messages.MessageEnum.VOTE_CHANGE_TEAM_NOT_NOW));
+            player.sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.VOTE_CHANGE_TEAM_NOT_NOW));
             return;
         } else if (state == VoteState.FINISH) {
-            player.sendMessage(Messages.getMessage(true, Messages.MessageEnum.VOTE_CHANGE_TEAM_NO_LONGER_NOW));
+            player.sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.VOTE_CHANGE_TEAM_NO_LONGER_NOW));
             return;
         }
 
-        Arena arena = Arenas.getFromName(arenaName);
-        if (arena == null) {
-            player.sendMessage(Messages.getMessage(true, Messages.MessageEnum.COMMAND_INVALID_MAP)
+        ArenaConfig arenaConfig = Arenas.getFromName(arenaName);
+        if (arenaConfig == null) {
+            player.sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.COMMAND_INVALID_MAP)
                     .replace("%input%", arenaName));
             return;
         }
         
-        if (!game.getLobby().getArenas().contains(arena)) {
-            player.sendMessage(Messages.getMessage(true, Messages.MessageEnum.VOTE_MAP_NOT_AVAILABLE));
+        if (!game.getGameConfig().getArenas().contains(arenaConfig)) {
+            player.sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.VOTE_MAP_NOT_AVAILABLE));
             return;
         }
 
@@ -75,9 +75,9 @@ public class MapVoting {
 
         if (arenaVotes.containsKey(mwPlayer)) {
 
-            if (arenaVotes.get(mwPlayer) == arena) {
-                player.sendMessage(Messages.getMessage(true, Messages.MessageEnum.VOTE_ARENA_ALREADY_SELECTED)
-                        .replace("%map%", arena.getDisplayName()));
+            if (arenaVotes.get(mwPlayer) == arenaConfig) {
+                player.sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.VOTE_ARENA_ALREADY_SELECTED)
+                        .replace("%map%", arenaConfig.getDisplayName()));
                 return;
             }
 
@@ -86,9 +86,9 @@ public class MapVoting {
         }
 
         // add the new vote
-        arenaVotes.put(mwPlayer, arena);
+        arenaVotes.put(mwPlayer, arenaConfig);
 
-        player.sendMessage(Messages.getMessage(true, Messages.MessageEnum.VOTE_SUCCESS).replace("%map%", arena.getDisplayName()));
+        player.sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.VOTE_SUCCESS).replace("%map%", arenaConfig.getDisplayName()));
     }
 
     /**
@@ -96,27 +96,27 @@ public class MapVoting {
      *
      * @return (Arena) the winner arena for this vote
      */
-    private Arena getVotedArena() {
+    private ArenaConfig getVotedArena() {
 
         // If no one voted:
-        if (arenaVotes.isEmpty()) return game.getLobby().getArenas().get(0);
+        if (arenaVotes.isEmpty()) return game.getGameConfig().getArenas().get(0);
 
-        Arena arena = arenaVotes.values().stream().collect(Collectors.groupingBy(Function.identity(), Collectors.counting()))
+        ArenaConfig arenaConfig = arenaVotes.values().stream().collect(Collectors.groupingBy(Function.identity(), Collectors.counting()))
                 .entrySet()
                 .stream()
                 .max(Map.Entry.comparingByValue()).orElseThrow()
                 .getKey();
 
-        return arena;
+        return arenaConfig;
     }
     
-    public double getPercentOf(Arena arena) {
-        long votes = arenaVotes.values().stream().filter(a -> a.equals(arena)).count();
+    public double getPercentOf(ArenaConfig arenaConfig) {
+        long votes = arenaVotes.values().stream().filter(a -> a.equals(arenaConfig)).count();
         return ((double) votes / arenaVotes.size()) * 100;
     }
     
-    public String getPercentOfMsg(Arena arena) {
-        double result = Math.round(getPercentOf(arena));
+    public String getPercentOfMsg(ArenaConfig arenaConfig) {
+        double result = Math.round(getPercentOf(arenaConfig));
         return Double.toString(result);
     }
     
@@ -124,7 +124,7 @@ public class MapVoting {
      * This method unlocks the map voting.
      */
     public void startVote() {
-        if (game.getLobby().getMapChooseProcedure() != MapChooseProcedure.MAPVOTING)
+        if (game.getGameConfig().getMapChooseProcedure() != MapChooseProcedure.MAPVOTING)
             throw new IllegalStateException("Defined map choose procedure is not \"MAPVOTING\"");
 
         state = VoteState.RUNNING;
@@ -134,27 +134,27 @@ public class MapVoting {
      * This method locks the map voting again.
      */
     public void stopVote() {
-        if (game.getLobby().getMapChooseProcedure() != MapChooseProcedure.MAPVOTING)
+        if (game.getGameConfig().getMapChooseProcedure() != MapChooseProcedure.MAPVOTING)
             throw new IllegalStateException("Defined map choose procedure is not \"MAPVOTING\"");
 
         state = VoteState.FINISH;
     }
 
     /**
-     * This method checks if there is only one arena map available for this lobby and 
+     * This method checks if there is only one arena map available for this game and 
      * therefore no map vote is necessary.
      * 
-     * @return (Boolean) true, if only one map exists for this lobby
+     * @return (Boolean) true, if only one map exists for this game
      */
     public boolean onlyOneArenaFound() {
-        return (game.getLobby().getArenas().size() == 1);
+        return (game.getGameConfig().getArenas().size() == 1);
     }
 
     /**
      * This method sets the selected arena of map voting for the current game.
      */
     public void setVotedArena() {
-        if (game.getLobby().getMapChooseProcedure() != MapChooseProcedure.MAPVOTING)
+        if (game.getGameConfig().getMapChooseProcedure() != MapChooseProcedure.MAPVOTING)
             throw new IllegalStateException("Defined map choose procedure is not \"MAPVOTING\"");
 
         if (onlyOneArenaFound()) return;
@@ -162,18 +162,18 @@ public class MapVoting {
 
         stopVote();
 
-        Arena arena = game.getMapVoting().getVotedArena();
-        if (arena == null) throw new IllegalStateException("Voted arena is not present");
-        game.setArena(arena);
+        ArenaConfig arenaConfig = game.getMapVoting().getVotedArena();
+        if (arenaConfig == null) throw new IllegalStateException("Voted arena is not present");
+        game.setArena(arenaConfig);
 
-        game.broadcast(Messages.getMessage(true, Messages.MessageEnum.VOTE_FINISHED)
-                .replace("%map%", game.getArena().getDisplayName()));
+        game.broadcast(PluginMessages.getMessage(true, PluginMessages.MessageEnum.VOTE_FINISHED)
+                .replace("%map%", game.getArenaConfig().getDisplayName()));
 
         game.prepareGame();
     }
     
-    public boolean isVotedMapOfPlayer(Arena arena, MWPlayer mwPlayer) {
-        return (arenaVotes.get(mwPlayer) == arena);
+    public boolean isVotedMapOfPlayer(ArenaConfig arenaConfig, MWPlayer mwPlayer) {
+        return (arenaVotes.get(mwPlayer) == arenaConfig);
     }
     
 }

+ 2 - 2
missilewars-plugin/src/main/java/de/butzlabben/missilewars/game/Team.java

@@ -25,8 +25,8 @@ import de.butzlabben.missilewars.game.enums.TeamType;
 import de.butzlabben.missilewars.game.misc.TeamSpawnProtection;
 import de.butzlabben.missilewars.menus.MenuItem;
 import de.butzlabben.missilewars.player.MWPlayer;
-import de.butzlabben.missilewars.util.PlayerUtil;
 import de.butzlabben.missilewars.util.version.ColorConverter;
+import de.redstoneworld.redutilities.player.Teleport;
 import lombok.Getter;
 import lombok.RequiredArgsConstructor;
 import lombok.Setter;
@@ -174,7 +174,7 @@ public class Team {
     
     public void teleportToTeamSpawn(Player player) {
         TeamSpawnProtection.regenerateSpawn(this);
-        PlayerUtil.teleportSafely(player, spawn);
+        Teleport.teleportSafely(player, spawn);
     }
     
 }

+ 6 - 6
missilewars-plugin/src/main/java/de/butzlabben/missilewars/game/TeamManager.java

@@ -19,7 +19,7 @@
 package de.butzlabben.missilewars.game;
 
 import de.butzlabben.missilewars.Logger;
-import de.butzlabben.missilewars.configuration.lobby.Lobby;
+import de.butzlabben.missilewars.configuration.game.GameConfig;
 import de.butzlabben.missilewars.game.enums.TeamType;
 import lombok.Getter;
 
@@ -31,7 +31,7 @@ import java.util.UUID;
 public class TeamManager {
     
     private final Game game;
-    private final Lobby lobby;
+    private final GameConfig gameConfig;
     
     @Getter private Team team1;
     @Getter private Team team2;
@@ -41,11 +41,11 @@ public class TeamManager {
     
     public TeamManager(Game game) {
         this.game = game;
-        this.lobby = game.getLobby();
+        this.gameConfig = game.getGameConfig();
         
-        team1 = new Team(lobby.getTeam1Config().getName(), lobby.getTeam1Config().getColor(), game, TeamType.PLAYER);
-        team2 = new Team(lobby.getTeam2Config().getName(), lobby.getTeam2Config().getColor(), game, TeamType.PLAYER);
-        teamSpec = new Team(lobby.getTeamConfigSpec().getName(), lobby.getTeamConfigSpec().getColor(), game, TeamType.SPECTATOR);
+        team1 = new Team(gameConfig.getTeam1Config().getName(), gameConfig.getTeam1Config().getColor(), game, TeamType.PLAYER);
+        team2 = new Team(gameConfig.getTeam2Config().getName(), gameConfig.getTeam2Config().getColor(), game, TeamType.PLAYER);
+        teamSpec = new Team(gameConfig.getTeamConfigSpec().getName(), gameConfig.getTeamConfigSpec().getColor(), game, TeamType.SPECTATOR);
         
         team1.initialTeam();
         team2.initialTeam();

+ 15 - 3
missilewars-plugin/src/main/java/de/butzlabben/missilewars/game/enums/GameState.java

@@ -18,13 +18,25 @@
 
 package de.butzlabben.missilewars.game.enums;
 
+import de.butzlabben.missilewars.configuration.PluginMessages;
+import lombok.Getter;
+
 /**
  * @author Butzlabben
  * @since 01.01.2018
  */
+@Getter
 public enum GameState {
 
-    LOBBY,
-    INGAME,
-    END
+    LOBBY (PluginMessages.getMessage(false, PluginMessages.MessageEnum.GAME_STATE_LOBBY)),
+    INGAME (PluginMessages.getMessage(false, PluginMessages.MessageEnum.GAME_STATE_INGAME)),
+    END (PluginMessages.getMessage(false, PluginMessages.MessageEnum.GAME_STATE_END)),
+    ERROR (PluginMessages.getMessage(false, PluginMessages.MessageEnum.GAME_STATE_ERROR));
+
+    private final String gameStateMsg;
+    
+    GameState(String gameStateMsg) {
+        this.gameStateMsg = gameStateMsg;
+    }
+    
 }

+ 7 - 7
missilewars-plugin/src/main/java/de/butzlabben/missilewars/game/equipment/EquipmentManager.java

@@ -58,7 +58,7 @@ public class EquipmentManager {
     public void createGameItems() {
 
         // Will it be used?
-        if (game.getArena().getSpawn().isSendBow() || game.getArena().getRespawn().isSendBow()) {
+        if (game.getArenaConfig().getSpawn().isSendBow() || game.getArenaConfig().getRespawn().isSendBow()) {
 
             ItemStack bow = new ItemStack(Material.BOW);
             bow.addEnchantment(Enchantment.ARROW_FIRE, 1);
@@ -72,7 +72,7 @@ public class EquipmentManager {
         }
 
         // Will it be used?
-        if (game.getArena().getSpawn().isSendPickaxe() || game.getArena().getRespawn().isSendPickaxe()) {
+        if (game.getArenaConfig().getSpawn().isSendPickaxe() || game.getArenaConfig().getRespawn().isSendPickaxe()) {
 
             ItemStack pickaxe = new ItemStack(Material.IRON_PICKAXE);
             ItemMeta pickaxeMeta = pickaxe.getItemMeta();
@@ -93,7 +93,7 @@ public class EquipmentManager {
     public void sendGameItems(Player player, boolean isRespawn) {
 
         if (isRespawn) {
-            if (game.getArena().isKeepInventory()) return;
+            if (game.getArenaConfig().isKeepInventory()) return;
 
         } else {
             // clear inventory
@@ -107,13 +107,13 @@ public class EquipmentManager {
         // send kit items
         if (isRespawn) {
 
-            if (game.getArena().getRespawn().isSendBow()) player.getInventory().addItem(this.customBow);
-            if (game.getArena().getRespawn().isSendPickaxe()) player.getInventory().addItem(this.customPickaxe);
+            if (game.getArenaConfig().getRespawn().isSendBow()) player.getInventory().addItem(this.customBow);
+            if (game.getArenaConfig().getRespawn().isSendPickaxe()) player.getInventory().addItem(this.customPickaxe);
 
         } else {
 
-            if (game.getArena().getSpawn().isSendBow()) player.getInventory().addItem(this.customBow);
-            if (game.getArena().getSpawn().isSendPickaxe()) player.getInventory().addItem(this.customPickaxe);
+            if (game.getArenaConfig().getSpawn().isSendBow()) player.getInventory().addItem(this.customBow);
+            if (game.getArenaConfig().getSpawn().isSendPickaxe()) player.getInventory().addItem(this.customPickaxe);
 
         }
     }

+ 17 - 17
missilewars-plugin/src/main/java/de/butzlabben/missilewars/game/equipment/PlayerEquipmentRandomizer.java

@@ -19,7 +19,7 @@
 package de.butzlabben.missilewars.game.equipment;
 
 import de.butzlabben.missilewars.Logger;
-import de.butzlabben.missilewars.configuration.arena.Arena;
+import de.butzlabben.missilewars.configuration.arena.ArenaConfig;
 import de.butzlabben.missilewars.game.Game;
 import de.butzlabben.missilewars.game.schematics.objects.Missile;
 import de.butzlabben.missilewars.game.schematics.objects.Shield;
@@ -37,7 +37,7 @@ public class PlayerEquipmentRandomizer {
 
     private final MWPlayer mwPlayer;
     private final Game game;
-    private final Arena arena;
+    private final ArenaConfig arenaConfig;
     private final EquipmentManager equipmentManager;
 
     private final int maxGameDuration;
@@ -55,13 +55,13 @@ public class PlayerEquipmentRandomizer {
     public PlayerEquipmentRandomizer(MWPlayer mwPlayer, Game game) {
         this.mwPlayer = mwPlayer;
         this.game = game;
-        this.arena = game.getArena();
+        this.arenaConfig = game.getArenaConfig();
         this.equipmentManager = game.getEquipmentManager();
         randomizer = new Random();
-        maxGameDuration = game.getArena().getGameDuration() * 60;
+        maxGameDuration = game.getArenaConfig().getGameDuration() * 60;
         
-        this.startInterval = arena.getInterval().getCustomStartInterval();
-        this.respawnInterval = arena.getInterval().getCustomRespawnInterval();
+        this.startInterval = arenaConfig.getInterval().getCustomStartInterval();
+        this.respawnInterval = arenaConfig.getInterval().getCustomRespawnInterval();
 
         initializePlayerInterval();
     }
@@ -99,7 +99,7 @@ public class PlayerEquipmentRandomizer {
      */
     public void resetPlayerInterval() {
         // config option 'resetAfterRespawn'
-        if (!arena.getInterval().isResetAfterRespawn()) return;
+        if (!arenaConfig.getInterval().isResetAfterRespawn()) return;
         
         // adding 1 value before setting the player interval because of the timing
         if (respawnInterval == -1) {
@@ -187,19 +187,19 @@ public class PlayerEquipmentRandomizer {
      */
     private int getIntervalByTeamAmount() {
 
-        if (arena.getInterval().getIntervalsByTeamAmount().isEmpty()) {
-            Logger.WARN.log("The given interval mapping in \"" + arena.getName() + "\" is empty. Choosing default value " + DEFAULT_INTERVAL_BY_TEAM_AMOUNT + ".");
+        if (arenaConfig.getInterval().getIntervalsByTeamAmount().isEmpty()) {
+            Logger.WARN.log("The given interval mapping in \"" + arenaConfig.getName() + "\" is empty. Choosing default value " + DEFAULT_INTERVAL_BY_TEAM_AMOUNT + ".");
             return DEFAULT_INTERVAL_BY_TEAM_AMOUNT;
         }
 
         int teamSize = mwPlayer.getTeam().getMembers().size();
         for (int i = teamSize; i > 0; i--) {
-            if (arena.getInterval().getIntervalsByTeamAmount().containsKey(Integer.toString(i))) {
-                return arena.getInterval().getIntervalsByTeamAmount().get(Integer.toString(i));
+            if (arenaConfig.getInterval().getIntervalsByTeamAmount().containsKey(Integer.toString(i))) {
+                return arenaConfig.getInterval().getIntervalsByTeamAmount().get(Integer.toString(i));
             }
         }
 
-        Logger.DEBUG.log("No interval value for map \"" + arena.getName() + "\" could be detected based on the team amount of " + teamSize + ". Please define at least one a interval value for a minimal team amount of 1.");
+        Logger.DEBUG.log("No interval value for map \"" + arenaConfig.getName() + "\" could be detected based on the team amount of " + teamSize + ". Please define at least one a interval value for a minimal team amount of 1.");
         return DEFAULT_INTERVAL_BY_TEAM_AMOUNT;
     }
 
@@ -212,19 +212,19 @@ public class PlayerEquipmentRandomizer {
      */
     private double getFactorByGameTime() {
 
-        if (arena.getInterval().getIntervalFactorByGameTime().isEmpty()) {
-            Logger.WARN.log("The given interval factor mapping in \"" + arena.getName() + "\" is empty. Choosing default value " + DEFAULT_FACTOR_BY_GAME_TIME + ".");
+        if (arenaConfig.getInterval().getIntervalFactorByGameTime().isEmpty()) {
+            Logger.WARN.log("The given interval factor mapping in \"" + arenaConfig.getName() + "\" is empty. Choosing default value " + DEFAULT_FACTOR_BY_GAME_TIME + ".");
             return DEFAULT_FACTOR_BY_GAME_TIME;
         }
 
         int seconds = game.getTaskManager().getTimer().getSeconds();
         for (int i = seconds; i <= maxGameDuration; i++) {
-            if (arena.getInterval().getIntervalFactorByGameTime().containsKey(Integer.toString(i))) {
-                return arena.getInterval().getIntervalFactorByGameTime().get(Integer.toString(i));
+            if (arenaConfig.getInterval().getIntervalFactorByGameTime().containsKey(Integer.toString(i))) {
+                return arenaConfig.getInterval().getIntervalFactorByGameTime().get(Integer.toString(i));
             }
         }
 
-        Logger.DEBUG.log("No interval factor value for map \"" + arena.getName() + "\" could be detected based on the game time of " + seconds + " seconds. Please define at least one a interval value for a minimal team amount of " + maxGameDuration + " seconds.");
+        Logger.DEBUG.log("No interval factor value for map \"" + arenaConfig.getName() + "\" could be detected based on the game time of " + seconds + " seconds. Please define at least one a interval value for a minimal team amount of " + maxGameDuration + " seconds.");
         return DEFAULT_FACTOR_BY_GAME_TIME;
     }
 

+ 2 - 2
missilewars-plugin/src/main/java/de/butzlabben/missilewars/game/equipment/SchematicGameEquipment.java

@@ -52,13 +52,13 @@ public class SchematicGameEquipment {
     private void createSchematicEquipmentList(SchematicObject.schematicType schematicType) {
 
         if (schematicType == SchematicObject.schematicType.MISSILE) {
-            for (SchematicObject object : game.getArena().getMissileConfiguration().getSchematics()) {
+            for (SchematicObject object : game.getArenaConfig().getMissileConfig().getSchematics()) {
                 for (int i = object.getOccurrence(); i > 0; i--) {
                     schematicEquipmentList.add(object);
                 }
             }
         } else if (schematicType == SchematicObject.schematicType.SHIELD) {
-            for (SchematicObject object : game.getArena().getShieldConfiguration().getSchematics()) {
+            for (SchematicObject object : game.getArenaConfig().getShieldConfig().getSchematics()) {
                 for (int i = object.getOccurrence(); i > 0; i--) {
                     schematicEquipmentList.add(object);
                 }

+ 4 - 4
missilewars-plugin/src/main/java/de/butzlabben/missilewars/game/equipment/SpecialGameEquipment.java

@@ -60,8 +60,8 @@ public class SpecialGameEquipment {
      */
     private void createSpecialEquipmentList() {
         
-        int arrowOccurrence = game.getArena().getArrowConfiguration().getOccurrence();
-        int fireballOccurrence = game.getArena().getFireballConfiguration().getOccurrence();
+        int arrowOccurrence = game.getArenaConfig().getArrowConfig().getOccurrence();
+        int fireballOccurrence = game.getArenaConfig().getFireballConfig().getOccurrence();
 
         for (int i = arrowOccurrence; i > 0; i--) {
             specialEquipmentList.add(arrow);
@@ -77,7 +77,7 @@ public class SpecialGameEquipment {
      * This method creates the arrow item stack.
      */
     private void createArrow() {
-        arrow = new ItemStack(Material.ARROW, game.getArena().getArrowConfiguration().getAmount());
+        arrow = new ItemStack(Material.ARROW, game.getArenaConfig().getArrowConfig().getAmount());
     }
 
     /**
@@ -86,7 +86,7 @@ public class SpecialGameEquipment {
     private void createFireball() {
         fireball = new ItemStack(Material.FIRE_CHARGE);
         ItemMeta fireballMeta = fireball.getItemMeta();
-        fireballMeta.setDisplayName(game.getArena().getFireballConfiguration().getName());
+        fireballMeta.setDisplayName(game.getArenaConfig().getFireballConfig().getName());
         fireball.setItemMeta(fireballMeta);
     }
 

+ 55 - 54
missilewars-plugin/src/main/java/de/butzlabben/missilewars/game/misc/MissileWarsPlaceholder.java

@@ -19,10 +19,11 @@
 package de.butzlabben.missilewars.game.misc;
 
 import de.butzlabben.missilewars.MissileWars;
-import de.butzlabben.missilewars.configuration.lobby.Lobby;
-import de.butzlabben.missilewars.configuration.arena.Arena;
+import de.butzlabben.missilewars.configuration.game.GameConfig;
+import de.butzlabben.missilewars.configuration.arena.ArenaConfig;
 import de.butzlabben.missilewars.game.Game;
 import de.butzlabben.missilewars.game.GameManager;
+import de.butzlabben.missilewars.game.enums.GameState;
 import de.butzlabben.missilewars.player.MWPlayer;
 import me.clip.placeholderapi.expansion.PlaceholderExpansion;
 import org.bukkit.OfflinePlayer;
@@ -41,7 +42,7 @@ public class MissileWarsPlaceholder extends PlaceholderExpansion {
     @Override
     @NotNull
     public String getAuthor() {
-        return "Daniel Nägele";
+        return "RedstoneFuture";
     }
 
     @Override
@@ -53,7 +54,7 @@ public class MissileWarsPlaceholder extends PlaceholderExpansion {
     @Override
     @NotNull
     public String getVersion() {
-        return "0.0.2";
+        return "0.0.3";
     }
 
     // This is required or else PlaceholderAPI will unregister the expansion on reload
@@ -74,79 +75,79 @@ public class MissileWarsPlaceholder extends PlaceholderExpansion {
 
             if (playerGame == null) {
 
-                // %missilewars_lobby_gamestate_<lobby name or 'this'>%
-                if (params.startsWith("lobby_gamestate_")) {
-                    return GameManager.getInstance().getGameStateMessage(null);
+                // %missilewars_game_gamestate_<game name or 'this'>%
+                if (params.startsWith("game_gamestate_")) {
+                    return GameState.ERROR.getGameStateMsg();
                 }
 
-                // if (params.startsWith("lobby_")) return "§c§oThis is not a lobby area!";
-                if (params.startsWith("lobby_")) return noInformation;
+                // if (params.startsWith("game_")) return "§c§oThis is not a game area!";
+                if (params.startsWith("game_")) return noInformation;
                 // if (params.startsWith("arena_")) return "§c§oThis is not a game arena!";
                 if (params.startsWith("arena_")) return noInformation;
                 // if (params.startsWith("player_")) return "§c§oPlayer is not in a game!";
                 if (params.startsWith("player_")) return noInformation;
             }
             
-            if (playerGame.getArena() == null) {
+            if (playerGame.getArenaConfig() == null) {
                 // if (params.startsWith("arena_")) return "§c§oThis is not a game arena!";
                 if (params.startsWith("arena_")) return noInformation;
             }
 
-            if (params.startsWith("lobby_")) params = params.replace("this", playerGame.getLobby().getName());
-            if (params.startsWith("arena_")) params = params.replace("this", playerGame.getArena().getName());
+            if (params.startsWith("game_")) params = params.replace("this", playerGame.getGameConfig().getName());
+            if (params.startsWith("arena_")) params = params.replace("this", playerGame.getArenaConfig().getName());
             
         }
         
         for (Game game : GameManager.getInstance().getGames().values()) {
-            Lobby lobby = game.getLobby();
+            GameConfig gameConfig = game.getGameConfig();
             
-            // %missilewars_lobby_gamestate_<lobby name or 'this'>%
-            if (params.equalsIgnoreCase("lobby_gamestate_" + lobby.getName())) {
-                return GameManager.getInstance().getGameStateMessage(game);
+            // %missilewars_game_gamestate_<game name or 'this'>%
+            if (params.equalsIgnoreCase("game_gamestate_" + gameConfig.getName())) {
+                return game.getState().getGameStateMsg();
             }
             
-            // %missilewars_lobby_mapvote_state_<lobby name or 'this'>%
-            if (params.equalsIgnoreCase("lobby_mapvote_state_" + lobby.getName())) {
+            // %missilewars_game_mapvote_state_<game name or 'this'>%
+            if (params.equalsIgnoreCase("game_mapvote_state_" + gameConfig.getName())) {
                 return game.getMapVoting().getState().toString();
             }
 
-            // %missilewars_lobby_displayname_<lobby name or 'this'>%
-            if (params.equalsIgnoreCase("lobby_displayname_" + lobby.getName())) {
-                return lobby.getDisplayName();
+            // %missilewars_game_displayname_<game name or 'this'>%
+            if (params.equalsIgnoreCase("game_displayname_" + gameConfig.getName())) {
+                return gameConfig.getDisplayName();
             }
             
-            // %missilewars_lobby_team1_name_<lobby name or 'this'>%
-            if (params.equalsIgnoreCase("lobby_team1_name_" + lobby.getName())) {
-                return lobby.getTeam1Config().getName();
+            // %missilewars_game_team1_name_<game name or 'this'>%
+            if (params.equalsIgnoreCase("game_team1_name_" + gameConfig.getName())) {
+                return gameConfig.getTeam1Config().getName();
             }
             
-            // %missilewars_lobby_team1_color_<lobby name or 'this'>%
-            if (params.equalsIgnoreCase("lobby_team1_color_" + lobby.getName())) {
-                return lobby.getTeam1Config().getColor();
+            // %missilewars_game_team1_color_<game name or 'this'>%
+            if (params.equalsIgnoreCase("game_team1_color_" + gameConfig.getName())) {
+                return gameConfig.getTeam1Config().getColor();
             }
             
-            // %missilewars_lobby_team2_name_<lobby name or 'this'>%
-            if (params.equalsIgnoreCase("lobby_team2_name_" + lobby.getName())) {
-                return lobby.getTeam2Config().getName();
+            // %missilewars_game_team2_name_<game name or 'this'>%
+            if (params.equalsIgnoreCase("game_team2_name_" + gameConfig.getName())) {
+                return gameConfig.getTeam2Config().getName();
             }
             
-            // %missilewars_lobby_team2_color_<lobby name or 'this'>%
-            if (params.equalsIgnoreCase("lobby_team2_color_" + lobby.getName())) {
-                return lobby.getTeam2Config().getColor();
+            // %missilewars_game_team2_color_<game name or 'this'>%
+            if (params.equalsIgnoreCase("game_team2_color_" + gameConfig.getName())) {
+                return gameConfig.getTeam2Config().getColor();
             }
             
-            // %missilewars_lobby_mapchooseprocedure_<lobby name or 'this'>%
-            if (params.equalsIgnoreCase("lobby_mapchooseprocedure_" + lobby.getName())) {
-                return lobby.getMapChooseProcedure().toString();
+            // %missilewars_game_mapchooseprocedure_<game name or 'this'>%
+            if (params.equalsIgnoreCase("game_mapchooseprocedure_" + gameConfig.getName())) {
+                return gameConfig.getMapChooseProcedure().toString();
             }
             
-            // %missilewars_lobby_gameduration_<lobby name or 'this'>%
-            if (params.equalsIgnoreCase("lobby_gameduration_" + lobby.getName())) {
+            // %missilewars_game_gameduration_<game name or 'this'>%
+            if (params.equalsIgnoreCase("game_gameduration_" + gameConfig.getName())) {
                 return Integer.toString(game.getGameDuration());
             }
             
-            // %missilewars_lobby_arenasize_X_<lobby name or 'this'>%
-            if (params.equalsIgnoreCase("lobby_arenasize_X_" + lobby.getName())) {
+            // %missilewars_game_arenasize_X_<game name or 'this'>%
+            if (params.equalsIgnoreCase("game_arenasize_X_" + gameConfig.getName())) {
                 if (game.getGameArea() != null) {
                     return Integer.toString(game.getGameArea().getXSize());
                 } else {
@@ -154,8 +155,8 @@ public class MissileWarsPlaceholder extends PlaceholderExpansion {
                 }
             }
             
-            // %missilewars_lobby_arenasize_Y_<lobby name or 'this'>%
-            if (params.equalsIgnoreCase("lobby_arenasize_Y_" + lobby.getName())) {
+            // %missilewars_game_arenasize_Y_<game name or 'this'>%
+            if (params.equalsIgnoreCase("game_arenasize_Y_" + gameConfig.getName())) {
                 if (game.getGameArea() != null) {
                     return Integer.toString(game.getGameArea().getYSize());
                 } else {
@@ -163,8 +164,8 @@ public class MissileWarsPlaceholder extends PlaceholderExpansion {
                 }
             }
             
-            // %missilewars_lobby_arenasize_Z_<lobby name or 'this'>%
-            if (params.equalsIgnoreCase("lobby_arenasize_Z_" + lobby.getName())) {
+            // %missilewars_game_arenasize_Z_<game name or 'this'>%
+            if (params.equalsIgnoreCase("game_arenasize_Z_" + gameConfig.getName())) {
                 if (game.getGameArea() != null) {
                     return Integer.toString(game.getGameArea().getZSize());
                 } else {
@@ -172,21 +173,21 @@ public class MissileWarsPlaceholder extends PlaceholderExpansion {
                 }
             }
             
-            for (Arena arena : lobby.getArenas()) {
+            for (ArenaConfig arenaConfig : gameConfig.getArenas()) {
 
                 // %missilewars_arena_displayname_<arena name or 'this'>%
-                if (params.equalsIgnoreCase("arena_displayname_" + arena.getName())) {
-                    return arena.getDisplayName();
+                if (params.equalsIgnoreCase("arena_displayname_" + arenaConfig.getName())) {
+                    return arenaConfig.getDisplayName();
                 }
 
                 // %missilewars_arena_missileamount_<arena name or 'this'>%
-                if (params.equalsIgnoreCase("arena_missileamount_" + arena.getName())) {
-                    return Integer.toString(arena.getMissileConfiguration().getSchematics().size());
+                if (params.equalsIgnoreCase("arena_missileamount_" + arenaConfig.getName())) {
+                    return Integer.toString(arenaConfig.getMissileConfig().getSchematics().size());
                 }
                 
                 // %missilewars_arena_gameduration_<arena name or 'this'>%
-                if (params.equalsIgnoreCase("arena_gameduration_" + arena.getName())) {
-                    return Integer.toString(arena.getGameDuration());
+                if (params.equalsIgnoreCase("arena_gameduration_" + arenaConfig.getName())) {
+                    return Integer.toString(arenaConfig.getGameDuration());
                 }
                 
             }
@@ -194,9 +195,9 @@ public class MissileWarsPlaceholder extends PlaceholderExpansion {
             if (game.getPlayers().get(offlinePlayer.getUniqueId()) != null) {
                 MWPlayer mwPlayer = game.getPlayers().get(offlinePlayer.getUniqueId());
                 
-                // %missilewars_player_lobby_displayname%
-                if (params.equalsIgnoreCase("player_lobby_displayname")) {
-                    return game.getLobby().getDisplayName();
+                // %missilewars_player_game_displayname%
+                if (params.equalsIgnoreCase("player_game_displayname")) {
+                    return mwPlayer.getGame().getGameConfig().getDisplayName();
                 }
                 
                 // %missilewars_player_team_name%

+ 3 - 3
missilewars-plugin/src/main/java/de/butzlabben/missilewars/game/misc/MotdManager.java

@@ -19,7 +19,7 @@
 package de.butzlabben.missilewars.game.misc;
 
 import de.butzlabben.missilewars.configuration.Config;
-import de.butzlabben.missilewars.configuration.Messages;
+import de.butzlabben.missilewars.configuration.PluginMessages;
 import de.butzlabben.missilewars.game.Game;
 import de.butzlabben.missilewars.game.enums.GameState;
 import lombok.Getter;
@@ -53,9 +53,9 @@ public class MotdManager {
             }
             
             motd = ChatColor.translateAlternateColorCodes('&', newMotd)
-                    .replace("%max_players%", Integer.toString(game.getLobby().getMaxPlayers()))
+                    .replace("%max_players%", Integer.toString(game.getGameConfig().getMaxPlayers()))
                     .replace("%players%", Integer.toString(game.getPlayerAmount()))
-                    .replace("%prefix%", Messages.getPrefix());
+                    .replace("%prefix%", PluginMessages.getPrefix());
         }
     }
 }

+ 4 - 4
missilewars-plugin/src/main/java/de/butzlabben/missilewars/game/misc/RespawnGoldBlock.java

@@ -19,7 +19,7 @@
 package de.butzlabben.missilewars.game.misc;
 
 import de.butzlabben.missilewars.MissileWars;
-import de.butzlabben.missilewars.configuration.Messages;
+import de.butzlabben.missilewars.configuration.PluginMessages;
 import de.butzlabben.missilewars.game.Game;
 import de.butzlabben.missilewars.game.enums.GameState;
 import de.butzlabben.missilewars.util.version.BlockSetterProvider;
@@ -123,7 +123,7 @@ public class RespawnGoldBlock implements Listener {
             BlockSetterProvider.getBlockDataSetter().setData(loc.getBlock(), map.get(loc).getValue());
         }
         map.clear();
-        player.sendMessage(Messages.getMessage(true, Messages.MessageEnum.FALL_PROTECTION_END));
+        player.sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.FALL_PROTECTION_END));
         Bukkit.getScheduler().cancelTask(task);
         HandlerList.unregisterAll(this);
     }
@@ -135,7 +135,7 @@ public class RespawnGoldBlock implements Listener {
     private void sendFallProtectionMessage() {
         double seconds = (double) duration / 20;
         if ((seconds == Math.floor(seconds)) && !Double.isInfinite(seconds)) {
-            player.sendMessage(Messages.getMessage(true, Messages.MessageEnum.FALL_PROTECTION_START).replace("%seconds%", Integer.toString((int) seconds)));
+            player.sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.FALL_PROTECTION_START).replace("%seconds%", Integer.toString((int) seconds)));
         }
     }
 
@@ -150,7 +150,7 @@ public class RespawnGoldBlock implements Listener {
             map.clear();
             Bukkit.getScheduler().cancelTask(task);
             HandlerList.unregisterAll(this);
-            eventPlayer.sendMessage(Messages.getMessage(true, Messages.MessageEnum.FALL_PROTECTION_DEACTIVATED));
+            eventPlayer.sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.FALL_PROTECTION_DEACTIVATED));
         }
     }
 }

+ 3 - 5
missilewars-plugin/src/main/java/de/butzlabben/missilewars/game/misc/ScoreboardManager.java

@@ -21,13 +21,11 @@ package de.butzlabben.missilewars.game.misc;
 import de.butzlabben.missilewars.configuration.Config;
 import de.butzlabben.missilewars.game.Game;
 import de.butzlabben.missilewars.game.Team;
-import de.butzlabben.missilewars.game.enums.GameState;
 import de.butzlabben.missilewars.player.MWPlayer;
 import lombok.Getter;
 import lombok.RequiredArgsConstructor;
 import lombok.Setter;
 import org.bukkit.Bukkit;
-import org.bukkit.ChatColor;
 import org.bukkit.scoreboard.DisplaySlot;
 import org.bukkit.scoreboard.Objective;
 import org.bukkit.scoreboard.Scoreboard;
@@ -71,11 +69,11 @@ public class ScoreboardManager {
         team1 = game.getTeamManager().getTeam1();
         team2 = game.getTeamManager().getTeam2();
 
-        if (game.getArena() == null) {
+        if (game.getArenaConfig() == null) {
             // using of placeholders until the arena is not set
             setArenaDisplayName("?");
         } else {
-            setArenaDisplayName(game.getArena().getDisplayName());
+            setArenaDisplayName(game.getArenaConfig().getDisplayName());
         }
 
         // register Scoreboard
@@ -249,7 +247,7 @@ public class ScoreboardManager {
         text = text.replace("%team1_amount%", Integer.toString(team1.getMembers().size()));
         text = text.replace("%team2_amount%", Integer.toString(team2.getMembers().size()));
 
-        text = text.replace("%lobby_name%", game.getLobby().getDisplayName());
+        text = text.replace("%game_name%", game.getGameConfig().getDisplayName());
         text = text.replace("%arena_name%", arenaDisplayName);
 
         text = text.replace("%time%", Integer.toString(game.getGameDuration()));

+ 3 - 3
missilewars-plugin/src/main/java/de/butzlabben/missilewars/game/schematics/SchematicFacing.java

@@ -19,7 +19,7 @@
 package de.butzlabben.missilewars.game.schematics;
 
 import de.butzlabben.missilewars.Logger;
-import de.butzlabben.missilewars.configuration.arena.MissileConfiguration;
+import de.butzlabben.missilewars.configuration.arena.modules.MissileConfig;
 import de.butzlabben.missilewars.util.missile.Interval;
 import org.bukkit.entity.Player;
 
@@ -46,7 +46,7 @@ public enum SchematicFacing {
         this.secondary = secondary;
     }
 
-    public static SchematicFacing getFacing(double degree, MissileConfiguration configuration) {
+    public static SchematicFacing getFacing(double degree, MissileConfig configuration) {
         List<SchematicFacing> values = Arrays.stream(SchematicFacing.values()).filter(f -> configuration.getEnabledFacings().contains(f)).collect(Collectors.toList());
         SchematicFacing facing = null;
         for (SchematicFacing fac : values) {
@@ -72,7 +72,7 @@ public enum SchematicFacing {
         return facing;
     }
 
-    public static SchematicFacing getFacingPlayer(Player playerSelf, MissileConfiguration configuration) {
+    public static SchematicFacing getFacingPlayer(Player playerSelf, MissileConfig configuration) {
         float y = playerSelf.getLocation().getYaw();
         if (y < 0) {
             y += 360;

+ 3 - 3
missilewars-plugin/src/main/java/de/butzlabben/missilewars/game/schematics/objects/Missile.java

@@ -19,10 +19,10 @@
 package de.butzlabben.missilewars.game.schematics.objects;
 
 import de.butzlabben.missilewars.Logger;
+import de.butzlabben.missilewars.MissileWars;
 import de.butzlabben.missilewars.configuration.Config;
 import de.butzlabben.missilewars.game.Game;
 import de.butzlabben.missilewars.game.schematics.SchematicFacing;
-import de.butzlabben.missilewars.game.schematics.paste.PasteProvider;
 import org.bukkit.Location;
 import org.bukkit.Material;
 import org.bukkit.entity.EntityType;
@@ -69,7 +69,7 @@ public class Missile extends SchematicObject {
     public void paste(Game game, Player player, boolean hasTempBlock, Material tempBlockMaterial, int tempBlockDelay, 
                       int tempBlockRadius) {
         
-        SchematicFacing schematicFacing = SchematicFacing.getFacingPlayer(player, game.getArena().getMissileConfiguration());
+        SchematicFacing schematicFacing = SchematicFacing.getFacingPlayer(player, game.getArenaConfig().getMissileConfig());
         if (schematicFacing == null) return;
         
         try {
@@ -93,7 +93,7 @@ public class Missile extends SchematicObject {
                 rotation = 90;
             }
             
-            PasteProvider.getPaster().pasteMissile(getSchematic(), pastePos, rotation, loc.getWorld(), hasTempBlock, 
+            MissileWars.getInstance().getSchematicPaster().pasteMissile(getSchematic(), pastePos, rotation, loc.getWorld(), hasTempBlock, 
                     tempBlockMaterial, tempBlockDelay, tempBlockRadius);
             
         } catch (Exception e) {

+ 2 - 2
missilewars-plugin/src/main/java/de/butzlabben/missilewars/game/schematics/objects/Shield.java

@@ -1,8 +1,8 @@
 package de.butzlabben.missilewars.game.schematics.objects;
 
 import de.butzlabben.missilewars.Logger;
+import de.butzlabben.missilewars.MissileWars;
 import de.butzlabben.missilewars.configuration.Config;
-import de.butzlabben.missilewars.game.schematics.paste.PasteProvider;
 import org.bukkit.Location;
 import org.bukkit.Material;
 import org.bukkit.entity.Snowball;
@@ -29,7 +29,7 @@ public class Shield extends SchematicObject {
             Location loc = ball.getLocation();
             Vector pastePos = new Vector(loc.getX(), loc.getY(), loc.getZ());
             
-            PasteProvider.getPaster().pasteSchematic(getSchematic(), pastePos, 0, loc.getWorld());
+            MissileWars.getInstance().getSchematicPaster().pasteSchematic(getSchematic(), pastePos, 0, loc.getWorld());
         } catch (Exception e) {
             Logger.ERROR.log("Could not load " + getDisplayName());
             e.printStackTrace();

+ 0 - 49
missilewars-plugin/src/main/java/de/butzlabben/missilewars/game/schematics/paste/PasteProvider.java

@@ -1,49 +0,0 @@
-/*
- * This file is part of MissileWars (https://github.com/Butzlabben/missilewars).
- * Copyright (c) 2018-2021 Daniel Nägele.
- *
- * MissileWars is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * MissileWars is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with MissileWars.  If not, see <https://www.gnu.org/licenses/>.
- */
-
-package de.butzlabben.missilewars.game.schematics.paste;
-
-
-import de.butzlabben.missilewars.Logger;
-import de.butzlabben.missilewars.MissileWars;
-import lombok.Getter;
-
-/**
- * @author Butzlabben
- * @since 23.09.2018
- */
-public class PasteProvider {
-
-    @Getter
-    private static final Paster paster;
-
-    static {
-        if (MissileWars.getInstance().foundFAWE()) {
-            paster = new FawePasteProvider();
-            Logger.DEBUG.log("Chose FAWE paster.");
-        } else {
-            // FAWE Paster works also for (normal) WorldEdit
-            paster = new FawePasteProvider();
-            Logger.DEBUG.log("Chose FAWE paster.");
-        }
-    }
-
-    private PasteProvider() {
-    }
-
-}

+ 13 - 10
missilewars-plugin/src/main/java/de/butzlabben/missilewars/game/signs/MWSign.java

@@ -20,9 +20,10 @@ package de.butzlabben.missilewars.game.signs;
 
 import de.butzlabben.missilewars.Logger;
 import de.butzlabben.missilewars.MissileWars;
-import de.butzlabben.missilewars.configuration.Messages;
+import de.butzlabben.missilewars.configuration.PluginMessages;
 import de.butzlabben.missilewars.game.Game;
 import de.butzlabben.missilewars.game.GameManager;
+import de.butzlabben.missilewars.game.enums.GameState;
 import de.butzlabben.missilewars.util.version.MaterialHelper;
 import lombok.AllArgsConstructor;
 import lombok.Data;
@@ -62,10 +63,10 @@ public class MWSign {
         }
         Game game = GameManager.getInstance().getGame(getLobby());
         List<String> lines = new ArrayList<>();
-        lines.add(replace(Messages.getMessage(false, Messages.MessageEnum.SIGN_0), game));
-        lines.add(replace(Messages.getMessage(false, Messages.MessageEnum.SIGN_1), game));
-        lines.add(replace(Messages.getMessage(false, Messages.MessageEnum.SIGN_2), game));
-        lines.add(replace(Messages.getMessage(false, Messages.MessageEnum.SIGN_3), game));
+        lines.add(replace(PluginMessages.getMessage(false, PluginMessages.MessageEnum.SIGN_0), game));
+        lines.add(replace(PluginMessages.getMessage(false, PluginMessages.MessageEnum.SIGN_1), game));
+        lines.add(replace(PluginMessages.getMessage(false, PluginMessages.MessageEnum.SIGN_2), game));
+        lines.add(replace(PluginMessages.getMessage(false, PluginMessages.MessageEnum.SIGN_3), game));
 
         // Run sync
         Bukkit.getScheduler().runTask(MissileWars.getInstance(), () -> editSign(getLocation(), lines));
@@ -86,25 +87,27 @@ public class MWSign {
 
     private String replace(String line, Game game) {
 
-        String state = GameManager.getInstance().getGameStateMessage(game);
+        String gameStateMsg = GameState.ERROR.getGameStateMsg();
         String name = "-";
         
         if (game != null) {
+            gameStateMsg = game.getState().getGameStateMsg();
+            
             switch (game.getState()) {
                 case LOBBY:
-                    name = game.getLobby().getDisplayName();
+                    name = game.getGameConfig().getDisplayName();
                     break;
                 case INGAME:
                 case END:
-                    name = game.getArena().getDisplayName();
+                    name = game.getArenaConfig().getDisplayName();
                     break;
             }
         }
 
-        int maxPlayers = (game == null ? 0 : game.getLobby().getMaxPlayers());
+        int maxPlayers = (game == null ? 0 : game.getGameConfig().getMaxPlayers());
         int players = (game == null ? 0 : game.getPlayerAmount());
 
-        return line.replace("%state%", state)
+        return line.replace("%state%", gameStateMsg)
                 .replace("%arena%", name)
                 .replace("%max_players%", Integer.toString(maxPlayers))
                 .replace("%players%", Integer.toString(players));

+ 1 - 1
missilewars-plugin/src/main/java/de/butzlabben/missilewars/game/signs/SignRepository.java

@@ -109,6 +109,6 @@ public class SignRepository {
     }
 
     public List<MWSign> getSigns(Game game) {
-        return signs.stream().filter(s -> s.getLobby().equals(game.getLobby().getName())).collect(Collectors.toList());
+        return signs.stream().filter(s -> s.getLobby().equals(game.getGameConfig().getName())).collect(Collectors.toList());
     }
 }

+ 1 - 1
missilewars-plugin/src/main/java/de/butzlabben/missilewars/game/signs/CheckRunnable.java → missilewars-plugin/src/main/java/de/butzlabben/missilewars/game/signs/SignUpdateRunnable.java

@@ -21,7 +21,7 @@ package de.butzlabben.missilewars.game.signs;
 import de.butzlabben.missilewars.MissileWars;
 import java.util.List;
 
-public class CheckRunnable implements Runnable {
+public class SignUpdateRunnable implements Runnable {
 
     @Override
     public void run() {

+ 1 - 1
missilewars-plugin/src/main/java/de/butzlabben/missilewars/game/stats/FightStats.java

@@ -41,7 +41,7 @@ public class FightStats {
     public FightStats(Game game) {
         this.game = game;
 
-        arenaName = game.getArena().getName();
+        arenaName = game.getArenaConfig().getName();
         timeStart = game.getTimestart();
         timeElapsed = System.currentTimeMillis() - timeStart;
         teamWon = getGameResultCode();

+ 2 - 2
missilewars-plugin/src/main/java/de/butzlabben/missilewars/game/timer/EndTimer.java

@@ -18,7 +18,7 @@
 
 package de.butzlabben.missilewars.game.timer;
 
-import de.butzlabben.missilewars.configuration.Messages;
+import de.butzlabben.missilewars.configuration.PluginMessages;
 import de.butzlabben.missilewars.game.Game;
 
 /**
@@ -37,7 +37,7 @@ public class EndTimer extends Timer {
 
         switch (seconds) {
             case 15:
-                broadcast(Messages.getMessage(true, Messages.MessageEnum.ENDGAME_TIMER_GAME_STARTS_NEW_IN)
+                broadcast(PluginMessages.getMessage(true, PluginMessages.MessageEnum.ENDGAME_TIMER_GAME_STARTS_NEW_IN)
                         .replace("%seconds%", Integer.toString(seconds)));
                 break;
             case 0:

+ 7 - 7
missilewars-plugin/src/main/java/de/butzlabben/missilewars/game/timer/GameTimer.java

@@ -19,10 +19,10 @@
 package de.butzlabben.missilewars.game.timer;
 
 import de.butzlabben.missilewars.configuration.Config;
-import de.butzlabben.missilewars.configuration.Messages;
+import de.butzlabben.missilewars.configuration.PluginMessages;
 import de.butzlabben.missilewars.game.Game;
 import de.butzlabben.missilewars.game.enums.TeamType;
-import de.butzlabben.missilewars.util.PlayerUtil;
+import de.redstoneworld.redutilities.player.Messages;
 import org.bukkit.GameMode;
 import org.bukkit.entity.Player;
 
@@ -36,7 +36,7 @@ public class GameTimer extends Timer {
     
     public GameTimer(Game game) {
         super(game);
-        seconds = game.getArena().getGameDuration() * 60;
+        seconds = game.getArenaConfig().getGameDuration() * 60;
     }
 
     @Override
@@ -52,7 +52,7 @@ public class GameTimer extends Timer {
             case 600:
             case 300:
             case 180:
-                broadcast(Messages.getMessage(true, Messages.MessageEnum.GAME_TIMER_GAME_ENDS_IN_MINUTES)
+                broadcast(PluginMessages.getMessage(true, PluginMessages.MessageEnum.GAME_TIMER_GAME_ENDS_IN_MINUTES)
                         .replace("%minutes%", Integer.toString(seconds / 60)));
                 break;
             case 60:
@@ -63,7 +63,7 @@ public class GameTimer extends Timer {
             case 3:
             case 2:
             case 1:
-                broadcast(Messages.getMessage(true, Messages.MessageEnum.GAME_TIMER_GAME_ENDS_IN_SECONDS)
+                broadcast(PluginMessages.getMessage(true, PluginMessages.MessageEnum.GAME_TIMER_GAME_ENDS_IN_SECONDS)
                         .replace("%seconds%", Integer.toString(seconds)));
                 break;
             case 0:
@@ -86,7 +86,7 @@ public class GameTimer extends Timer {
                     
                     if (game.isInGameArea(player.getLocation())) return;
                     
-                    player.sendMessage(Messages.getMessage(true, Messages.MessageEnum.ARENA_LEAVED));
+                    player.sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.ARENA_LEAVED));
                     mwPlayer.getTeam().teleportToTeamSpawn(player);
                     
                 }
@@ -99,7 +99,7 @@ public class GameTimer extends Timer {
                 Player player = mwPlayer.getPlayer();
                 
                 if (mwPlayer.getTeam().getTeamType() == TeamType.PLAYER) return;
-                PlayerUtil.sendActionbarMsg(player, Config.getActionbarForSpecEntries()[actionbarMsgCounter]);
+                Messages.sendActionbarMsg(player, Config.getActionbarForSpecEntries()[actionbarMsgCounter]);
             });
             
             // Array-Iteration:

+ 7 - 7
missilewars-plugin/src/main/java/de/butzlabben/missilewars/game/timer/LobbyTimer.java

@@ -18,7 +18,7 @@
 
 package de.butzlabben.missilewars.game.timer;
 
-import de.butzlabben.missilewars.configuration.Messages;
+import de.butzlabben.missilewars.configuration.PluginMessages;
 import de.butzlabben.missilewars.game.Game;
 import de.butzlabben.missilewars.game.enums.MapChooseProcedure;
 import de.butzlabben.missilewars.player.MWPlayer;
@@ -59,7 +59,7 @@ public class LobbyTimer extends Timer implements Runnable {
             if (getGame().areToFewPlayers()) {
                 seconds = startTime;
                 remaining = 90;
-                broadcast(Messages.getMessage(true, Messages.MessageEnum.LOBBY_NOT_ENOUGH_PLAYERS));
+                broadcast(PluginMessages.getMessage(true, PluginMessages.MessageEnum.LOBBY_NOT_ENOUGH_PLAYERS));
                 return;
             }
         }
@@ -73,20 +73,20 @@ public class LobbyTimer extends Timer implements Runnable {
             case 3:
             case 2:
             case 1:
-                broadcast(Messages.getMessage(true, Messages.MessageEnum.LOBBY_TIMER_GAME_STARTS_IN)
+                broadcast(PluginMessages.getMessage(true, PluginMessages.MessageEnum.LOBBY_TIMER_GAME_STARTS_IN)
                         .replace("%seconds%", Integer.toString(seconds)));
                 playPling();
                 break;
             case 10:
-                if (getGame().getLobby().getMapChooseProcedure() == MapChooseProcedure.MAPVOTING)
+                if (getGame().getGameConfig().getMapChooseProcedure() == MapChooseProcedure.MAPVOTING)
                     getGame().getMapVoting().setVotedArena();
-                broadcast(Messages.getMessage(true, Messages.MessageEnum.LOBBY_TIMER_GAME_STARTS_IN)
+                broadcast(PluginMessages.getMessage(true, PluginMessages.MessageEnum.LOBBY_TIMER_GAME_STARTS_IN)
                         .replace("%seconds%", Integer.toString(seconds)));
                 playPling();
                 break;
             case 0:
                 if (!getGame().getTeamManager().hasBalancedTeamSizes()) {
-                    broadcast(Messages.getMessage(true, Messages.MessageEnum.LOBBY_TEAMS_UNEQUAL));
+                    broadcast(PluginMessages.getMessage(true, PluginMessages.MessageEnum.LOBBY_TEAMS_UNEQUAL));
                     seconds = startTime;
                     return;
                 }
@@ -110,7 +110,7 @@ public class LobbyTimer extends Timer implements Runnable {
      * are informed about the start.
      */
     public void executeGameStart() {
-        broadcast(Messages.getMessage(true, Messages.MessageEnum.GAME_GAME_STARTS));
+        broadcast(PluginMessages.getMessage(true, PluginMessages.MessageEnum.GAME_GAME_STARTS));
         getGame().startGame();
     }
     

+ 48 - 0
missilewars-plugin/src/main/java/de/butzlabben/missilewars/initialization/ConfigLoader.java

@@ -0,0 +1,48 @@
+package de.butzlabben.missilewars.initialization;
+
+import de.butzlabben.missilewars.Logger;
+import de.butzlabben.missilewars.configuration.Config;
+import de.butzlabben.missilewars.configuration.PluginMessages;
+import org.bukkit.configuration.file.YamlConfiguration;
+
+import java.io.*;
+import java.nio.charset.StandardCharsets;
+
+public class ConfigLoader {
+    
+    public static void loadConfigs() {
+        
+        Config.load();
+        PluginMessages.load();
+        
+    }
+    
+    public static YamlConfiguration loadConfigFile(File file) {
+        
+        // check if the directory and the file exists or create it new
+        FileManager.createNewConfig(file);
+        
+        // try to load the config
+        YamlConfiguration cfg = getLoadedConfig(file);
+        
+        // copy the config input
+        cfg.options().copyDefaults(true);
+        
+        return cfg;
+    }
+    
+    public static YamlConfiguration getLoadedConfig(File file) {
+        String fileName = file.getName();
+        YamlConfiguration cfg;
+
+        try {
+            cfg = YamlConfiguration.loadConfiguration(new InputStreamReader(new FileInputStream(file), StandardCharsets.UTF_8));
+        } catch (FileNotFoundException e) {
+            Logger.ERROR.log("Couldn't load " + fileName + "!");
+            e.printStackTrace();
+            return null;
+        }
+        return cfg;
+    }
+    
+}

+ 181 - 0
missilewars-plugin/src/main/java/de/butzlabben/missilewars/initialization/FileManager.java

@@ -0,0 +1,181 @@
+package de.butzlabben.missilewars.initialization;
+
+import de.butzlabben.missilewars.Logger;
+import de.butzlabben.missilewars.MissileWars;
+import de.butzlabben.missilewars.configuration.Config;
+import de.butzlabben.missilewars.player.PlayerData;
+import org.apache.commons.io.FileUtils;
+import org.bukkit.Bukkit;
+import org.bukkit.configuration.file.YamlConfiguration;
+import org.bukkit.configuration.serialization.ConfigurationSerialization;
+import org.bukkit.plugin.java.JavaPlugin;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipInputStream;
+
+public class FileManager {
+    
+    public static void setupRoutine() {
+        
+        deleteTempWorlds();
+        
+        ConfigLoader.loadConfigs();
+        
+        saveDefaultResource(Config.getMissilesFolder(), "missiles.zip", MissileWars.getInstance());
+        saveDefaultResource(Config.getShieldsFolder(), "shields.zip", MissileWars.getInstance());
+        
+        ConfigurationSerialization.registerClass(PlayerData.class);
+    }
+    
+    public static void shotDownRoutine() {
+        
+        deleteTempWorlds();
+        
+    }
+    
+    /**
+     * This methode deletes the old MissileWars (temporary) arena world from the last server session, if still exists.
+     */
+    private static void deleteTempWorlds() {
+        File[] dirs = Bukkit.getWorldContainer().listFiles();
+        if (dirs == null) return;
+
+        for (File dir : dirs) {
+            if (dir.getName().startsWith("mw-")) {
+                try {
+                    FileUtils.deleteDirectory(dir);
+                } catch (Exception ignored) {
+                }
+            }
+        }
+    }
+    
+    /**
+     * Extracts a ZIP file from the plugin's resource folder and saves the contents
+     * into the specified targetPath.
+     * 
+     * @param targetPath The directory where the extracted files should be saved.
+     * @param defaultArchiveFile The name of the ZIP file in the plugin's resource folder.
+     */
+    public static void saveDefaultResource(String targetPath, String defaultArchiveFile, JavaPlugin plugin) {
+        // Ensure the target directory exists
+        File targetDir = new File(targetPath);
+        
+        // Check if the target directory already exists; if so, skip extraction
+        if (targetDir.exists()) {
+            Logger.NORMAL.log("Directory '" + targetDir.getPath() + "' already exists. Skipping extraction.");
+            return;
+        }
+        
+        // Create the target directory if it does not exist
+        if (!targetDir.mkdirs()) {
+            Logger.ERROR.log("Failed to create directory '" + targetDir.getPath() + "'");
+            return;
+        }
+        
+        // Get the resource as an InputStream
+        try (InputStream in = plugin.getResource(defaultArchiveFile)) {
+            if (in == null) {
+                Logger.ERROR.log("Unable to find resource '" + defaultArchiveFile + "'!");
+                return;
+            }
+    
+            // Unzip the resource to the target directory
+            Logger.NORMAL.log("Unzipping resource '" + defaultArchiveFile + "' to directory: " + targetDir.getPath());
+            unzip(in, targetDir);
+        } catch (IOException e) {
+            Logger.ERROR.log("Failed to unzip resource '" + defaultArchiveFile + "'!");
+            e.printStackTrace();
+        }
+    }
+    
+    private static void unzip(InputStream in, File targetDir) throws IOException {
+        try (ZipInputStream zis = new ZipInputStream(in)) {
+            ZipEntry entry;
+            while ((entry = zis.getNextEntry()) != null) {
+                File newFile = new File(targetDir, entry.getName());
+    
+                if (entry.isDirectory()) {
+                    // Handle directory entries
+                    if (!newFile.isDirectory() && !newFile.mkdirs()) {
+                        throw new IOException("Failed to create directory " + newFile);
+                    }
+                } else {
+                    // Check if file already exists and decide whether to overwrite or not
+                    if (newFile.exists()) {
+                        Logger.WARN.log("File " + newFile.getName() + " already exists. Skipping.");
+                        continue; // Skip if the file exists
+                    }
+    
+                    // Ensure parent directory exists
+                    File parent = newFile.getParentFile();
+                    if (!parent.isDirectory() && !parent.mkdirs()) {
+                        throw new IOException("Failed to create directory " + parent);
+                    }
+    
+                    // Write file content
+                    try (FileOutputStream fos = new FileOutputStream(newFile)) {
+                        byte[] buffer = new byte[1024];
+                        int len;
+                        while ((len = zis.read(buffer)) > 0) {
+                            fos.write(buffer, 0, len);
+                        }
+                    }
+                }
+                zis.closeEntry();
+            }
+        }
+    }
+    
+    public static void safeFile(File file, YamlConfiguration cfg) {
+        String fileName = file.getName();
+
+        try {
+            cfg.save(file);
+        } catch (IOException e) {
+            Logger.ERROR.log("Could not save " + fileName + "!");
+            e.printStackTrace();
+        }
+    }
+    
+    /**
+     * Creates a new configuration file in the specified directory if it does not already exist.
+     * 
+     * @param file The File object representing the configuration file to be created.
+     */
+    public static void createNewConfig(File file) {
+        String fileName = file.getName();
+        File dir = file.getParentFile(); // Get the parent directory of the file
+
+        // Check if the directory exists; if not, create it
+        if (dir != null && !dir.exists()) {
+            if (dir.mkdirs()) {
+                Logger.NORMAL.log("Directory '" + dir.getPath() + "' created.");
+            } else {
+                Logger.ERROR.log("Failed to create directory '" + dir.getPath() + "'.");
+                return;
+            }
+        }
+
+        // Check if the config file exists; if not, create it
+        if (!file.exists()) {
+            try {
+                if (file.createNewFile()) {
+                    Logger.NORMAL.log("Configuration file '" + fileName + "' created successfully.");
+                } else {
+                    Logger.ERROR.log("Failed to create configuration file '" + fileName + "'.");
+                }
+            } catch (IOException e) {
+                Logger.ERROR.log("Could not create " + fileName + " due to an IOException!");
+                e.printStackTrace();
+            }
+        } else {
+            Logger.NORMAL.log("Configuration file '" + fileName + "' already exists. Skipping creation.");
+        }
+    }
+    
+}

+ 29 - 0
missilewars-plugin/src/main/java/de/butzlabben/missilewars/initialization/GamesInitialization.java

@@ -0,0 +1,29 @@
+package de.butzlabben.missilewars.initialization;
+
+import de.butzlabben.missilewars.MissileWars;
+import de.butzlabben.missilewars.game.Arenas;
+import de.butzlabben.missilewars.game.GameManager;
+import de.butzlabben.missilewars.game.signs.SignUpdateRunnable;
+import org.bukkit.Bukkit;
+import org.bukkit.entity.Player;
+
+public class GamesInitialization {
+    
+    public static void initialize() {
+        
+        // TODO Ref
+        Arenas.load();
+        GameManager.getInstance().loadGamesOnStartup();
+        
+        GameManager.getInstance().getGames().values().forEach(game -> {
+            for (Player player : Bukkit.getOnlinePlayers()) {
+                if (!game.isIn(player.getLocation())) continue;
+                game.teleportToLobbySpawn(player);
+            }
+        });
+        
+        Bukkit.getScheduler().runTaskTimerAsynchronously(MissileWars.getInstance(), new SignUpdateRunnable(), 20, 20 * 10);
+        
+    }
+    
+}

+ 5 - 5
missilewars-plugin/src/main/java/de/butzlabben/missilewars/listener/PlayerListener.java

@@ -158,7 +158,7 @@ public class PlayerListener implements Listener {
         if (!onJoinGame.isCancelled()) {
             game.updateGameInfo();
             logEventDebugMessage(player, game);
-            Logger.NORMAL.log(player.getName() + " joint the MW game " + game.getLobby().getName());
+            Logger.NORMAL.log(player.getName() + " joint the MW game " + game.getGameConfig().getName());
         } else {
             Logger.DEBUG.log("Canceling game join for " + player.getName());
         }
@@ -172,7 +172,7 @@ public class PlayerListener implements Listener {
 
         game.updateGameInfo();
         logEventDebugMessage(player, game);
-        Logger.NORMAL.log(player.getName() + " left the MW game " + game.getLobby().getName());
+        Logger.NORMAL.log(player.getName() + " left the MW game " + game.getGameConfig().getName());
 
         return onLeaveGame;
     }
@@ -196,12 +196,12 @@ public class PlayerListener implements Listener {
 
         Logger.DEBUG.log("Location: " + player.getLocation());
         Logger.DEBUG.log("Current game amount: " + GameManager.getInstance().getGameAmount());
-        Logger.DEBUG.log("Lobby: " + game.getLobby().getDisplayName());
+        Logger.DEBUG.log("Lobby: " + game.getGameConfig().getDisplayName());
         Logger.DEBUG.log("Team 1: " + game.getTeamManager().getTeam1());
         Logger.DEBUG.log("Team 2: " + game.getTeamManager().getTeam2());
 
-        if (game.getArena() != null) {
-            Logger.DEBUG.log("Arena: " + game.getArena().getDisplayName());
+        if (game.getArenaConfig() != null) {
+            Logger.DEBUG.log("Arena: " + game.getArenaConfig().getDisplayName());
         } else {
             Logger.DEBUG.log("Arena: not yet selected (Map Voting)");
         }

+ 10 - 10
missilewars-plugin/src/main/java/de/butzlabben/missilewars/listener/SignListener.java

@@ -19,7 +19,7 @@
 package de.butzlabben.missilewars.listener;
 
 import de.butzlabben.missilewars.MissileWars;
-import de.butzlabben.missilewars.configuration.Messages;
+import de.butzlabben.missilewars.configuration.PluginMessages;
 import de.butzlabben.missilewars.game.Game;
 import de.butzlabben.missilewars.game.GameManager;
 import de.butzlabben.missilewars.game.signs.MWSign;
@@ -82,14 +82,14 @@ public class SignListener implements Listener {
         * For the sake of completeness, the color is generally removed here so that the string search 
         * with the Lobby name always works correctly.
          */
-        String lobbyName = ChatColor.stripColor(event.getLine(1));
-        if ((lobbyName == null) || (lobbyName.isBlank())) {
-            player.sendMessage(Messages.getMessage(true, Messages.MessageEnum.SIGNEDIT_EMPTY_LOBBY));
+        String gameName = ChatColor.stripColor(event.getLine(1));
+        if ((gameName == null) || (gameName.isBlank())) {
+            player.sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.SIGNEDIT_EMPTY_GAME));
             event.setCancelled(true);
             return;
         }
         
-        Game game = GameManager.getInstance().getGame(lobbyName);
+        Game game = GameManager.getInstance().getGame(gameName);
         if (game != null) {
             
             // Removing old sign entry if exists:
@@ -97,17 +97,17 @@ public class SignListener implements Listener {
             if (sign != null) getSignRepository().getSigns().remove(sign);
             
             // Updating sign content:
-            sign = new MWSign(event.getBlock().getLocation(), lobbyName);
+            sign = new MWSign(event.getBlock().getLocation(), gameName);
             sign.update();
             
             // (Re-)Saving sign in MissileWars in '/data/signs.json':
             getSignRepository().getSigns().add(sign);
             getSignRepository().saveData();
 
-            player.sendMessage(Messages.getMessage(true, Messages.MessageEnum.SIGNEDIT_SIGN_CREATED));
+            player.sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.SIGNEDIT_SIGN_CREATED));
             
         } else {
-            player.sendMessage(Messages.getMessage(true, Messages.MessageEnum.SIGNEDIT_LOBBY_NOT_FOUND).replace("%input%", lobbyName));
+            player.sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.SIGNEDIT_GAME_NOT_FOUND).replace("%input%", gameName));
             event.setCancelled(true);
             
         }
@@ -128,9 +128,9 @@ public class SignListener implements Listener {
             getSignRepository().getSigns().remove(sign);
             getSignRepository().saveData();
 
-            player.sendMessage(Messages.getMessage(true, Messages.MessageEnum.SIGNEDIT_SIGN_REMOVED));
+            player.sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.SIGNEDIT_SIGN_REMOVED));
         } else {
-            player.sendMessage(Messages.getMessage(true, Messages.MessageEnum.SIGNEDIT_SIGN_REMOVE_DESC));
+            player.sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.SIGNEDIT_SIGN_REMOVE_DESC));
             event.setCancelled(true);
         }
     }

+ 8 - 8
missilewars-plugin/src/main/java/de/butzlabben/missilewars/listener/game/EndListener.java

@@ -19,7 +19,7 @@
 package de.butzlabben.missilewars.listener.game;
 
 import de.butzlabben.missilewars.Logger;
-import de.butzlabben.missilewars.configuration.Messages;
+import de.butzlabben.missilewars.configuration.PluginMessages;
 import de.butzlabben.missilewars.event.PlayerArenaJoinEvent;
 import de.butzlabben.missilewars.event.PlayerArenaLeaveEvent;
 import de.butzlabben.missilewars.game.Game;
@@ -53,7 +53,7 @@ public class EndListener extends GameBoundListener {
     public void onRespawn(PlayerRespawnEvent event) {
         if (!isInGameWorld(event.getPlayer().getLocation())) return;
 
-        event.setRespawnLocation(getGame().getArena().getSpectatorSpawn());
+        event.setRespawnLocation(getGame().getArenaConfig().getSpectatorSpawn());
     }
 
     @EventHandler(priority = EventPriority.HIGH)
@@ -64,7 +64,7 @@ public class EndListener extends GameBoundListener {
         MWPlayer mwPlayer = getGame().getPlayer(player);
 
         event.setDeathMessage(null);
-        if (getGame().getArena().isAutoRespawn()) getGame().autoRespawnPlayer(mwPlayer);
+        if (getGame().getArenaConfig().isAutoRespawn()) getGame().autoRespawnPlayer(mwPlayer);
     }
 
     @EventHandler
@@ -113,14 +113,14 @@ public class EndListener extends GameBoundListener {
         
         Player player = event.getPlayer();
 
-        JoinIngameBehavior joinBehavior = getGame().getLobby().getJoinIngameBehavior();
-        RejoinIngameBehavior rejoinBehavior = getGame().getLobby().getRejoinIngameBehavior();
+        JoinIngameBehavior joinBehavior = getGame().getGameConfig().getJoinIngameBehavior();
+        RejoinIngameBehavior rejoinBehavior = getGame().getGameConfig().getRejoinIngameBehavior();
         boolean isKnownPlayer = getGame().getGameLeaveManager().isKnownPlayer(player.getUniqueId());
         Team lastTeam = getGame().getGameLeaveManager().getLastTeamOfKnownPlayer(player.getUniqueId());
         
         // A: Forbidden the game join:
         if ((!isKnownPlayer && joinBehavior == JoinIngameBehavior.FORBIDDEN) || (isKnownPlayer && rejoinBehavior == RejoinIngameBehavior.FORBIDDEN)) {
-            event.getPlayer().sendMessage(Messages.getMessage(true, Messages.MessageEnum.GAME_NOT_ENTER_ARENA));
+            event.getPlayer().sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.GAME_NOT_ENTER_ARENA));
             event.setCancelled(true);
             return;
         }
@@ -133,7 +133,7 @@ public class EndListener extends GameBoundListener {
                 getGame().getGameJoinManager().runPlayerJoin(player, TeamType.SPECTATOR);
                 
             } else {
-                event.getPlayer().sendMessage(Messages.getMessage(true, Messages.MessageEnum.TEAM_SPECTATOR_TEAM_MAX_REACHED));
+                event.getPlayer().sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.TEAM_SPECTATOR_TEAM_MAX_REACHED));
                 event.setCancelled(true);
                 
             }
@@ -148,7 +148,7 @@ public class EndListener extends GameBoundListener {
                 getGame().getGameJoinManager().runPlayerJoin(player, TeamType.SPECTATOR);
                 
             } else {
-                event.getPlayer().sendMessage(Messages.getMessage(true, Messages.MessageEnum.TEAM_SPECTATOR_TEAM_MAX_REACHED));
+                event.getPlayer().sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.TEAM_SPECTATOR_TEAM_MAX_REACHED));
                 event.setCancelled(true);
                 
             }

+ 21 - 21
missilewars-plugin/src/main/java/de/butzlabben/missilewars/listener/game/GameListener.java

@@ -20,8 +20,8 @@ package de.butzlabben.missilewars.listener.game;
 
 import de.butzlabben.missilewars.Logger;
 import de.butzlabben.missilewars.MissileWars;
-import de.butzlabben.missilewars.configuration.Messages;
-import de.butzlabben.missilewars.configuration.arena.FallProtectionConfiguration;
+import de.butzlabben.missilewars.configuration.PluginMessages;
+import de.butzlabben.missilewars.configuration.arena.modules.FallProtectionConfig;
 import de.butzlabben.missilewars.event.PlayerArenaJoinEvent;
 import de.butzlabben.missilewars.event.PlayerArenaLeaveEvent;
 import de.butzlabben.missilewars.game.Game;
@@ -70,7 +70,7 @@ public class GameListener extends GameBoundListener {
         if (!isInGameWorld(event.getLocation())) return;
 
         if (event.getEntity().getType() != EntityType.FIREBALL) return;
-        if (getGame().getArena().getFireballConfiguration().isDestroysPortal()) return;
+        if (getGame().getArenaConfig().getFireballConfig().isDestroysPortal()) return;
 
         event.blockList().removeIf(b -> b.getType() == Material.NETHER_PORTAL);
     }
@@ -103,7 +103,7 @@ public class GameListener extends GameBoundListener {
             event.setCancelled(true);
 
             // Can missiles only be spawned if the item interaction was performed on a block (no air)?
-            boolean isOnlyBlockPlaceable = getGame().getArena().getMissileConfiguration().isOnlyBlockPlaceable();
+            boolean isOnlyBlockPlaceable = getGame().getArenaConfig().getMissileConfig().isOnlyBlockPlaceable();
             if (isOnlyBlockPlaceable) {
                 if (event.getAction() != Action.RIGHT_CLICK_BLOCK) return;
             }
@@ -139,7 +139,7 @@ public class GameListener extends GameBoundListener {
             // or a projectile hit before.
             if (!snowball.isDead()) getGame().spawnShield(shooter, snowball);
             
-        }, getGame().getArena().getShieldConfiguration().getFlyTime());
+        }, getGame().getArenaConfig().getShieldConfig().getFlyTime());
     }
 
     @EventHandler
@@ -173,7 +173,7 @@ public class GameListener extends GameBoundListener {
 
         // same team
         if (team == getGame().getPlayer(player).getTeam()) {
-            shooter.sendMessage(Messages.getMessage(true, Messages.MessageEnum.TEAM_HURT_TEAMMATES));
+            shooter.sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.TEAM_HURT_TEAMMATES));
             event.setCancelled(true);
         }
     }
@@ -193,12 +193,12 @@ public class GameListener extends GameBoundListener {
             getGame().setPlayerAttributes(player);
             getGame().getPlayer(player).getPlayerEquipmentRandomizer().resetPlayerInterval();
 
-            FallProtectionConfiguration fallProtection = getGame().getArena().getFallProtection();
+            FallProtectionConfig fallProtection = getGame().getArenaConfig().getFallProtection();
             if (fallProtection.isEnabled()) {
                 new RespawnGoldBlock(player, fallProtection.getDuration(), fallProtection.isMessageOnlyOnStart(), getGame());
             }
         } else {
-            event.setRespawnLocation(getGame().getArena().getSpectatorSpawn());
+            event.setRespawnLocation(getGame().getArenaConfig().getSpectatorSpawn());
         }
     }
 
@@ -219,16 +219,16 @@ public class GameListener extends GameBoundListener {
             EntityDamageEvent.DamageCause damageCause = player.getLastDamageCause().getCause();
 
             if (damageCause == EntityDamageEvent.DamageCause.BLOCK_EXPLOSION || damageCause == EntityDamageEvent.DamageCause.ENTITY_EXPLOSION) {
-                deathBroadcast = Messages.getMessage(true, Messages.MessageEnum.DIED_EXPLOSION).replace("%player%", player.getDisplayName());
+                deathBroadcast = PluginMessages.getMessage(true, PluginMessages.MessageEnum.DIED_EXPLOSION).replace("%player%", player.getDisplayName());
             } else {
-                deathBroadcast = Messages.getMessage(true, Messages.MessageEnum.DIED_NORMAL).replace("%player%", player.getDisplayName());
+                deathBroadcast = PluginMessages.getMessage(true, PluginMessages.MessageEnum.DIED_NORMAL).replace("%player%", player.getDisplayName());
             }
 
             getGame().broadcast(deathBroadcast);
         }
 
         event.setDeathMessage(null);
-        if (getGame().getArena().isAutoRespawn()) getGame().autoRespawnPlayer(mwPlayer);
+        if (getGame().getArenaConfig().isAutoRespawn()) getGame().autoRespawnPlayer(mwPlayer);
     }
 
     @EventHandler
@@ -304,10 +304,10 @@ public class GameListener extends GameBoundListener {
         if (player.getGameMode() != GameMode.SURVIVAL) return;
 
         int toY = event.getTo().getBlockY();
-        if (toY > getGame().getArena().getMaxMoveHeight()) {
+        if (toY > getGame().getArenaConfig().getMaxMoveHeight()) {
             player.teleport(event.getFrom());
-            player.sendMessage(Messages.getMessage(true, Messages.MessageEnum.ARENA_NOT_HIGHER));
-        } else if (toY < getGame().getArena().getDeathHeight()) {
+            player.sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.ARENA_NOT_HIGHER));
+        } else if (toY < getGame().getArenaConfig().getDeathHeight()) {
             player.setLastDamageCause(new EntityDamageEvent(player, EntityDamageEvent.DamageCause.FALL, 20));
             player.damage(20.0D);
         }
@@ -317,7 +317,7 @@ public class GameListener extends GameBoundListener {
 
         if (!getGame().isInGameArea(event.getTo())) {
             if (to != null) Game.knockbackEffect(player, from, to);
-            player.sendMessage(Messages.getMessage(true, Messages.MessageEnum.ARENA_REACHED_BORDER));
+            player.sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.ARENA_REACHED_BORDER));
         }
     }
 
@@ -327,14 +327,14 @@ public class GameListener extends GameBoundListener {
 
         Player player = event.getPlayer();
 
-        JoinIngameBehavior joinBehavior = getGame().getLobby().getJoinIngameBehavior();
-        RejoinIngameBehavior rejoinBehavior = getGame().getLobby().getRejoinIngameBehavior();
+        JoinIngameBehavior joinBehavior = getGame().getGameConfig().getJoinIngameBehavior();
+        RejoinIngameBehavior rejoinBehavior = getGame().getGameConfig().getRejoinIngameBehavior();
         boolean isKnownPlayer = getGame().getGameLeaveManager().isKnownPlayer(player.getUniqueId());
         Team lastTeam = getGame().getGameLeaveManager().getLastTeamOfKnownPlayer(player.getUniqueId());
         
         // A: Forbidden the game join:
         if ((!isKnownPlayer && joinBehavior == JoinIngameBehavior.FORBIDDEN) || (isKnownPlayer && rejoinBehavior == RejoinIngameBehavior.FORBIDDEN)) {
-            event.getPlayer().sendMessage(Messages.getMessage(true, Messages.MessageEnum.GAME_NOT_ENTER_ARENA));
+            event.getPlayer().sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.GAME_NOT_ENTER_ARENA));
             event.setCancelled(true);
             return;
         }
@@ -348,11 +348,11 @@ public class GameListener extends GameBoundListener {
                 
             } else if (isKnownPlayer && rejoinBehavior == RejoinIngameBehavior.LAST_TEAM && lastTeam.getTeamType() == TeamType.PLAYER 
                     && !getGame().areTooManySpectators()) {
-                event.getPlayer().sendMessage(Messages.getMessage(true, Messages.MessageEnum.TEAM_PLAYER_TEAM_MAX_REACHED));
+                event.getPlayer().sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.TEAM_PLAYER_TEAM_MAX_REACHED));
                 getGame().getGameJoinManager().runPlayerJoin(player, TeamType.SPECTATOR);
                 
             } else {
-                event.getPlayer().sendMessage(Messages.getMessage(true, Messages.MessageEnum.GAME_MAX_REACHED));
+                event.getPlayer().sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.GAME_MAX_REACHED));
                 event.setCancelled(true);
                 
             }
@@ -370,7 +370,7 @@ public class GameListener extends GameBoundListener {
                 getGame().getGameJoinManager().runPlayerJoin(player, TeamType.PLAYER);
                 
             } else {
-                event.getPlayer().sendMessage(Messages.getMessage(true, Messages.MessageEnum.TEAM_SPECTATOR_TEAM_MAX_REACHED));
+                event.getPlayer().sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.TEAM_SPECTATOR_TEAM_MAX_REACHED));
                 event.setCancelled(true);
                 
             }

+ 4 - 4
missilewars-plugin/src/main/java/de/butzlabben/missilewars/listener/game/LobbyListener.java

@@ -19,7 +19,7 @@
 package de.butzlabben.missilewars.listener.game;
 
 import de.butzlabben.missilewars.Logger;
-import de.butzlabben.missilewars.configuration.Messages;
+import de.butzlabben.missilewars.configuration.PluginMessages;
 import de.butzlabben.missilewars.event.PlayerArenaJoinEvent;
 import de.butzlabben.missilewars.event.PlayerArenaLeaveEvent;
 import de.butzlabben.missilewars.game.Game;
@@ -102,7 +102,7 @@ public class LobbyListener extends GameBoundListener {
     public void onRespawn(PlayerRespawnEvent event) {
         if (!isInLobbyArea(event.getPlayer().getLocation())) return;
 
-        event.setRespawnLocation(getGame().getLobby().getSpawnPoint());
+        event.setRespawnLocation(getGame().getGameConfig().getLobbyConfig().getSpawnPoint());
     }
 
     @EventHandler
@@ -168,11 +168,11 @@ public class LobbyListener extends GameBoundListener {
             getGame().getGameJoinManager().runPlayerJoin(player, TeamType.PLAYER);
             
         } else if (!getGame().areTooManySpectators()) {
-            event.getPlayer().sendMessage(Messages.getMessage(true, Messages.MessageEnum.TEAM_PLAYER_TEAM_MAX_REACHED));
+            event.getPlayer().sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.TEAM_PLAYER_TEAM_MAX_REACHED));
             getGame().getGameJoinManager().runPlayerJoin(player, TeamType.SPECTATOR);
             
         } else {
-            event.getPlayer().sendMessage(Messages.getMessage(true, Messages.MessageEnum.GAME_MAX_REACHED));
+            event.getPlayer().sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.GAME_MAX_REACHED));
             event.setCancelled(true);
             
         }

+ 4 - 4
missilewars-plugin/src/main/java/de/butzlabben/missilewars/menus/ItemRequirement.java

@@ -1,6 +1,6 @@
 package de.butzlabben.missilewars.menus;
 
-import de.butzlabben.missilewars.configuration.Messages;
+import de.butzlabben.missilewars.configuration.PluginMessages;
 import de.butzlabben.missilewars.player.MWPlayer;
 import org.bukkit.configuration.ConfigurationSection;
 
@@ -28,9 +28,9 @@ public class ItemRequirement {
         if (type == Type.NULL) return true;
 
         boolean result = false;
-        String finalPermission = Messages.getPapiMessage(permission, mwPlayer.getPlayer());
-        String finalInput = Messages.getPapiMessage(input, mwPlayer.getPlayer());
-        String finalOutput = Messages.getPapiMessage(output, mwPlayer.getPlayer());
+        String finalPermission = PluginMessages.getPapiMessage(permission, mwPlayer.getPlayer());
+        String finalInput = PluginMessages.getPapiMessage(input, mwPlayer.getPlayer());
+        String finalOutput = PluginMessages.getPapiMessage(output, mwPlayer.getPlayer());
         
         if (type == Type.HAS_PERMISSION) {
             if ((finalPermission.isEmpty()) || (finalPermission.isBlank())) return false;

+ 3 - 3
missilewars-plugin/src/main/java/de/butzlabben/missilewars/menus/MenuItem.java

@@ -4,7 +4,7 @@ import com.mojang.authlib.GameProfile;
 import com.mojang.authlib.properties.Property;
 import de.butzlabben.missilewars.Logger;
 import de.butzlabben.missilewars.configuration.ActionSet;
-import de.butzlabben.missilewars.configuration.Messages;
+import de.butzlabben.missilewars.configuration.PluginMessages;
 import de.butzlabben.missilewars.player.MWPlayer;
 import lombok.Getter;
 import lombok.RequiredArgsConstructor;
@@ -112,11 +112,11 @@ public class MenuItem {
     }
     
     private void updatePapiValues(Player player) {
-        finalDisplayName = Messages.getPapiMessage(displayName, player);
+        finalDisplayName = PluginMessages.getPapiMessage(displayName, player);
 
         finalLoreList.clear();
         for (String lore : loreList) {
-            finalLoreList.add(Messages.getPapiMessage(lore, player));
+            finalLoreList.add(PluginMessages.getPapiMessage(lore, player));
         }
     }
     

+ 12 - 13
missilewars-plugin/src/main/java/de/butzlabben/missilewars/menus/inventory/MapVoteMenu.java

@@ -6,9 +6,8 @@ import com.github.stefvanschie.inventoryframework.pane.OutlinePane;
 import com.github.stefvanschie.inventoryframework.pane.PaginatedPane;
 import com.github.stefvanschie.inventoryframework.pane.component.PercentageBar;
 import de.butzlabben.missilewars.configuration.Config;
-import de.butzlabben.missilewars.configuration.arena.Arena;
+import de.butzlabben.missilewars.configuration.arena.ArenaConfig;
 import de.butzlabben.missilewars.game.Game;
-import de.butzlabben.missilewars.game.enums.MapChooseProcedure;
 import de.butzlabben.missilewars.menus.MenuItem;
 import de.butzlabben.missilewars.menus.MenuUtils;
 import de.butzlabben.missilewars.player.MWPlayer;
@@ -20,7 +19,7 @@ import java.util.Map;
 
 public class MapVoteMenu {
     
-    private final Map<String, Arena> arenaDisplayNames = new HashMap<>();
+    private final Map<String, ArenaConfig> arenaDisplayNames = new HashMap<>();
     
     private final MWPlayer mwPlayer;
     private final Game game;
@@ -49,8 +48,8 @@ public class MapVoteMenu {
         MenuItem.setDisplayName(forwardsItemActive, Config.MapVoteMenuItems.FORWARDS_ITEM_ACTIVE.getMessage());
         MenuItem.setDisplayName(forwardsItemInactive, Config.MapVoteMenuItems.FORWARDS_ITEM_INACTIVE.getMessage());
         
-        for (Arena arena : game.getLobby().getArenas()) {
-            arenaDisplayNames.put(arena.getDisplayName(), arena);
+        for (ArenaConfig arenaConfig : game.getGameConfig().getArenas()) {
+            arenaDisplayNames.put(arenaConfig.getDisplayName(), arenaConfig);
         }
         
         gui = new ChestGui(6, getTitle());
@@ -73,7 +72,7 @@ public class MapVoteMenu {
         backwards = new OutlinePane(3, 5, 1, 1);
         forwards = new OutlinePane(5, 5, 1, 1);
         
-        int maxPages = (int) Math.ceil(game.getLobby().getArenas().size() / 5d);
+        int maxPages = (int) Math.ceil(game.getGameConfig().getArenas().size() / 5d);
         int offset = 0;
         for (int page = 1; page <= maxPages; page++) {
             
@@ -86,27 +85,27 @@ public class MapVoteMenu {
                 
                 // Are there any other arenas?
                 int nextArenaId = (offset * 5) + n - 1;
-                if (game.getLobby().getArenas().size() < (nextArenaId + 1)) break;
+                if (game.getGameConfig().getArenas().size() < (nextArenaId + 1)) break;
                 
-                Arena arena = game.getLobby().getArenas().get(nextArenaId);
+                ArenaConfig arenaConfig = game.getGameConfig().getArenas().get(nextArenaId);
                 
                 // arena item:
-                ItemStack item = new ItemStack(Material.valueOf(arena.getDisplayMaterial().toUpperCase()));
+                ItemStack item = new ItemStack(Material.valueOf(arenaConfig.getDisplayMaterial().toUpperCase()));
                 MenuItem.hideMetaValues(item);
                 MenuItem.setDisplayName(item, Config.MapVoteMenuItems.MAP_ITEM.getMessage()
-                        .replace("{arena-name}", arena.getDisplayName()));
-                if (game.getMapVoting().isVotedMapOfPlayer(arena, mwPlayer)) MenuItem.setEnchantment(item);
+                        .replace("{arena-name}", arenaConfig.getDisplayName()));
+                if (game.getMapVoting().isVotedMapOfPlayer(arenaConfig, mwPlayer)) MenuItem.setEnchantment(item);
                 
                 arenas.addItem(new GuiItem(item));
                 
                 // vote percent display
                 voteResultBar = new PercentageBar(1, n - 1, 8, 1);
-                voteResultBar.setPercentage((float) (game.getMapVoting().getPercentOf(arena) / 100));
+                voteResultBar.setPercentage((float) (game.getMapVoting().getPercentOf(arenaConfig) / 100));
                 
                 ItemStack impactDisplayItem = new ItemStack(Material.YELLOW_STAINED_GLASS_PANE);
                 MenuItem.hideMetaValues(item);
                 MenuItem.setDisplayName(impactDisplayItem, Config.MapVoteMenuItems.VOTE_RESULT_BAR.getMessage()
-                        .replace("{vote-percent}", game.getMapVoting().getPercentOfMsg(arena)));
+                        .replace("{vote-percent}", game.getMapVoting().getPercentOfMsg(arenaConfig)));
                 voteResultBar.setFillItem(new GuiItem(impactDisplayItem));
                 
                 ItemStack backgroundItem = new ItemStack(Material.GRAY_STAINED_GLASS_PANE);

+ 2 - 2
missilewars-plugin/src/main/java/de/butzlabben/missilewars/util/MoneyUtil.java

@@ -19,7 +19,7 @@
 package de.butzlabben.missilewars.util;
 
 import de.butzlabben.missilewars.Logger;
-import de.butzlabben.missilewars.configuration.Messages;
+import de.butzlabben.missilewars.configuration.PluginMessages;
 import java.util.UUID;
 import net.milkbowl.vault.economy.Economy;
 import net.milkbowl.vault.economy.EconomyResponse;
@@ -67,7 +67,7 @@ public class MoneyUtil {
             Logger.WARN.log("Message: " + r.errorMessage);
         } else {
             if (Bukkit.getPlayer(uuid) != null)
-                Bukkit.getPlayer(uuid).sendMessage(Messages.getMessage(true, Messages.MessageEnum.GAME_RESULT_MONEY).replace("%money%", Integer.toString(money)));
+                Bukkit.getPlayer(uuid).sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.GAME_RESULT_MONEY).replace("%money%", Integer.toString(money)));
         }
     }
 }

+ 0 - 34
missilewars-plugin/src/main/java/de/butzlabben/missilewars/util/PlayerUtil.java

@@ -1,34 +0,0 @@
-package de.butzlabben.missilewars.util;
-
-import net.md_5.bungee.api.ChatMessageType;
-import net.md_5.bungee.api.chat.TextComponent;
-import org.bukkit.Location;
-import org.bukkit.entity.Player;
-import org.bukkit.util.Vector;
-
-public class PlayerUtil {
-
-    /**
-     * This method sends the desired message above the player's action bar.
-     * 
-     * @param player (Player) the target player
-     * @param message (String) the actionbar message
-     */
-    public static void sendActionbarMsg(Player player, String message) {
-        player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(message));
-    }
-
-    /**
-     * This method teleports the player to the specified location. Before the teleport, however, 
-     * the velocity is set to zero so that the player does not take over any fall damage due to 
-     * the previous fall / fly. This is mainly relevant in the 'Survival-Mode'.
-     * 
-     * @param player (Player) the target player
-     * @param targetLocation (Location) the target teleport-location
-     */
-    public static void teleportSafely(Player player, Location targetLocation) {
-        player.setVelocity(new Vector(0, 0, 0));
-        player.teleport(targetLocation);
-    }
-    
-}

+ 0 - 245
missilewars-plugin/src/main/java/de/butzlabben/missilewars/util/SetupUtil.java

@@ -1,245 +0,0 @@
-/*
- * This file is part of MissileWars (https://github.com/Butzlabben/missilewars).
- * Copyright (c) 2018-2021 Daniel Nägele.
- *
- * MissileWars is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * MissileWars is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with MissileWars.  If not, see <https://www.gnu.org/licenses/>.
- */
-
-package de.butzlabben.missilewars.util;
-
-import de.butzlabben.missilewars.Logger;
-import de.butzlabben.missilewars.MissileWars;
-import de.butzlabben.missilewars.configuration.Config;
-import org.bukkit.configuration.file.YamlConfiguration;
-import org.bukkit.plugin.java.JavaPlugin;
-
-import java.io.*;
-import java.net.URL;
-import java.nio.charset.StandardCharsets;
-import java.nio.file.Files;
-import java.util.Enumeration;
-import java.util.jar.JarEntry;
-import java.util.jar.JarFile;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipInputStream;
-
-/**
- * @author Butzlabben
- * @since 14.08.2018
- */
-public class SetupUtil {
-
-    private static final int BUFFER_SIZE = 4096;
-
-    private SetupUtil() {
-    }
-
-    public static boolean isNewConfig(File dir, File file) {
-        String fileName = file.getName();
-
-        // check if the directory exists
-        if (!dir.exists()) {
-            dir.mkdirs();
-        }
-
-        // check if the config file exists
-        if (!file.exists()) {
-            try {
-                file.createNewFile();
-            } catch (IOException e) {
-                Logger.ERROR.log("Could not create " + fileName + "!");
-                e.printStackTrace();
-            }
-            return true;
-        }
-
-        return false;
-    }
-
-    public static YamlConfiguration getLoadedConfig(File file) {
-        String fileName = file.getName();
-        YamlConfiguration cfg;
-
-        try {
-            cfg = YamlConfiguration.loadConfiguration(new InputStreamReader(new FileInputStream(file), StandardCharsets.UTF_8));
-        } catch (FileNotFoundException e) {
-            Logger.ERROR.log("Couldn't load " + fileName + "!");
-            e.printStackTrace();
-            return null;
-        }
-        return cfg;
-    }
-
-    public static void safeFile(File file, YamlConfiguration cfg) {
-        String fileName = file.getName();
-
-        try {
-            cfg.save(file);
-        } catch (IOException e) {
-            Logger.ERROR.log("Could not save " + fileName + "!");
-            e.printStackTrace();
-        }
-    }
-    
-    public static void checkMap(String worldName) {
-        File arenasFolder = new File(Config.getArenasFolder());
-        File file = new File(arenasFolder, worldName);
-        if (!file.isDirectory()) {
-            String resource = "MissileWars-Arena.zip";
-
-            Logger.WARN.log("There was no map found with the name \"" + worldName + "\"");
-            Logger.BOOT.log("Copying default map (" + resource + ")");
-
-            try {
-                copyZip(resource, file.getPath());
-            } catch (IOException e) {
-                Logger.ERROR.log("Unable to copy new map!");
-                e.printStackTrace();
-            }
-        }
-    }
-
-    public static void saveDefaultSchematics(File schematicFile, String defaultFile) {
-        if (!schematicFile.isDirectory()) {
-
-            Logger.BOOT.log("Copying default schematic ressource folder (" + defaultFile + ")");
-
-            try {
-                copyZip(defaultFile, schematicFile.getPath());
-            } catch (IOException e) {
-                Logger.ERROR.log("Unable to copy schematic ressource folder '" + defaultFile + "'!");
-                e.printStackTrace();
-            }
-        }
-    }
-
-    private static void copyFile(String resource, String out) {
-        File file = new File(out);
-        if (!file.exists()) {
-            try {
-                InputStream in = MissileWars.getInstance().getResource(resource);
-                Files.copy(in, file.toPath());
-            } catch (IOException e) {
-                Logger.ERROR.log("Wasn't able to create Config");
-                e.printStackTrace();
-            }
-        }
-    }
-
-    private static void copyFolder(String resource, String outputFolder) throws IOException {
-        copyResourcesToDirectory(jarForClass(MissileWars.class, null), resource, outputFolder);
-    }
-
-    public static void copyZip(String resource, String outputFolder) throws IOException {
-        File out = new File(MissileWars.getInstance().getDataFolder(), resource);
-
-        InputStream in = JavaPlugin.getPlugin(MissileWars.class).getResource(resource);
-
-        Files.copy(in, out.toPath());
-
-        unzip(out.getPath(), outputFolder);
-
-        // delete the ZIP files after server stopping
-        out.deleteOnExit();
-    }
-
-    public static void unzip(String zipFilePath, String destDirectory) throws IOException {
-        File destDir = new File(destDirectory);
-        if (!destDir.exists()) {
-            destDir.mkdir();
-        }
-        ZipInputStream zipIn = new ZipInputStream(new FileInputStream(zipFilePath));
-
-        ZipEntry entry = zipIn.getNextEntry();
-        // iterates over entries in the zip file
-        while (entry != null) {
-            String filePath = destDirectory + File.separator + entry.getName();
-            if (!entry.isDirectory()) {
-                // if the entry is a file, extracts it
-                extractFile(zipIn, filePath);
-            } else {
-                // if the entry is a directory, make the directory
-                File dir = new File(filePath);
-                dir.mkdir();
-            }
-            zipIn.closeEntry();
-            entry = zipIn.getNextEntry();
-        }
-        zipIn.close();
-    }
-
-    /**
-     * Extracts a zip entry (file entry)
-     *
-     * @param zipIn    the input stream
-     * @param filePath the path to extract it to
-     */
-    private static void extractFile(ZipInputStream zipIn, String filePath) throws IOException {
-        BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(filePath));
-        byte[] bytesIn = new byte[BUFFER_SIZE];
-        int read;
-        while ((read = zipIn.read(bytesIn)) != -1) {
-            bos.write(bytesIn, 0, read);
-        }
-        bos.close();
-    }
-
-    public static JarFile jarForClass(Class<?> clazz, JarFile defaultJar) {
-        String path = "/" + clazz.getName().replace('.', '/') + ".class";
-        URL jarUrl = clazz.getResource(path);
-        if (jarUrl == null) {
-            return defaultJar;
-        }
-
-        String url = jarUrl.toString();
-        int bang = url.indexOf("!");
-        String JAR_URI_PREFIX = "jar:file:";
-        if (url.startsWith(JAR_URI_PREFIX) && bang != -1) {
-            try {
-                return new JarFile(url.substring(JAR_URI_PREFIX.length(), bang));
-            } catch (IOException e) {
-                throw new IllegalStateException("Error loading jar file.", e);
-            }
-        } else {
-            return defaultJar;
-        }
-    }
-
-    /**
-     * Copies a directory from a jar file to an external directory.
-     */
-    public static void copyResourcesToDirectory(JarFile fromJar, String jarDir, String destDir) throws IOException {
-        for (Enumeration<JarEntry> entries = fromJar.entries(); entries.hasMoreElements(); ) {
-            JarEntry entry = entries.nextElement();
-            if (entry.getName().startsWith(jarDir + "/") && !entry.isDirectory()) {
-                File dest = new File(destDir + "/" + entry.getName().substring(jarDir.length() + 1));
-                File parent = dest.getParentFile();
-                if (parent != null) {
-                    parent.mkdirs();
-                }
-
-                try (FileOutputStream out = new FileOutputStream(dest); InputStream in = fromJar.getInputStream(entry)) {
-                    byte[] buffer = new byte[8 * 1024];
-
-                    int s;
-                    while ((s = in.read(buffer)) > 0) {
-                        out.write(buffer, 0, s);
-                    }
-                } catch (IOException e) {
-                    throw new IOException("Could not copy asset from jar file", e);
-                }
-            }
-        }
-    }
-}

+ 4 - 4
missilewars-plugin/src/main/java/de/butzlabben/missilewars/util/geometry/GameArea.java

@@ -18,7 +18,7 @@
 
 package de.butzlabben.missilewars.util.geometry;
 
-import de.butzlabben.missilewars.configuration.arena.AreaConfiguration;
+import de.butzlabben.missilewars.configuration.arena.modules.AreaConfig;
 import lombok.Getter;
 import lombok.Setter;
 import org.bukkit.Location;
@@ -97,7 +97,7 @@ public class GameArea {
      * @param world      (World) the target world for the desired area
      * @param areaConfig (AreaConfiguration) the loaded Area-Configuration from which the data is taken
      */
-    public GameArea(World world, AreaConfiguration areaConfig) {
+    public GameArea(World world, AreaConfig areaConfig) {
 
         this.world = world;
 
@@ -153,8 +153,8 @@ public class GameArea {
         }
     }
 
-    public AreaConfiguration getAreaConfiguration() {
-        return new AreaConfiguration(position1.getBlockX(), position1.getBlockY(), position1.getBlockZ(),
+    public AreaConfig getAreaConfiguration() {
+        return new AreaConfig(position1.getBlockX(), position1.getBlockY(), position1.getBlockZ(),
                 position2.getBlockX(), position2.getBlockY(), position2.getBlockZ());
     }
 

+ 2 - 2
missilewars-plugin/src/main/java/de/butzlabben/missilewars/util/stats/PlayerGuiFactory.java

@@ -22,7 +22,7 @@ import com.mojang.authlib.GameProfile;
 import de.butzlabben.missilewars.Logger;
 import de.butzlabben.missilewars.MissileWars;
 import de.butzlabben.missilewars.configuration.Config;
-import de.butzlabben.missilewars.configuration.Messages;
+import de.butzlabben.missilewars.configuration.PluginMessages;
 import de.butzlabben.missilewars.game.stats.PlayerStats;
 import de.butzlabben.missilewars.game.stats.PlayerStatsComparator;
 import de.butzlabben.missilewars.inventory.OrcItem;
@@ -76,7 +76,7 @@ public class PlayerGuiFactory {
         int currentSize = names.size();
         if (realSize > currentSize) {
             if (Config.isContactAuth()) {
-                player.sendMessage(Messages.getMessage(true, Messages.MessageEnum.STATS_FETCHING_PLAYERS)
+                player.sendMessage(PluginMessages.getMessage(true, PluginMessages.MessageEnum.STATS_FETCHING_PLAYERS)
                         .replace("%current_size%", Integer.toString(currentSize))
                         .replace("%real_size%", Integer.toString(realSize)));
                 ForkJoinPool.commonPool().execute(() -> {

+ 37 - 21
missilewars-plugin/src/main/java/de/butzlabben/missilewars/util/version/VersionUtil.java

@@ -35,32 +35,48 @@ public class VersionUtil {
     public static int getVersion() {
 
         if (version == 0) {
-            // Detect version
+            // Detect version:
             String v = Bukkit.getVersion();
-            if (v.contains("1.20")) version = 20;
-            else if (v.contains("1.19")) version = 19;
-            else if (v.contains("1.18")) version = 18;
-            else if (v.contains("1.17")) version = 17;
-            else if (v.contains("1.16")) version = 16;
-            else if (v.contains("1.15")) version = 15;
-            else if (v.contains("1.14")) version = 14;
-            else if (v.contains("1.13")) version = 13;
-            else if (v.contains("1.12")) version = 12;
-            else if (v.contains("1.11")) version = 11;
-            else if (v.contains("1.10")) version = 10;
-            else if (v.contains("1.9")) version = 9;
-            else if (v.contains("1.8")) version = 8;
-            else if (v.contains("1.7")) version = 7;
-            else if (v.contains("1.6")) version = 6;
-            else if (v.contains("1.5")) version = 5;
-            else if (v.contains("1.4")) version = 4;
-            else if (v.contains("1.3")) version = 3;
+
+            if (v.startsWith("1.22")) {
+                version = 22;
+            } else if (v.startsWith("1.21")) {
+                version = 21;
+            } else if (v.startsWith("1.20")) {
+                version = 20;
+            } else if (v.startsWith("1.19")) {
+                version = 19;
+            } else if (v.startsWith("1.18")) {
+                version = 18;
+            } else if (v.startsWith("1.17")) {
+                version = 17;
+            } else if (v.startsWith("1.16")) {
+                version = 16;
+            } else if (v.startsWith("1.15")) {
+                version = 15;
+            } else if (v.startsWith("1.14")) {
+                version = 14;
+            } else if (v.startsWith("1.13")) {
+                version = 13;
+            } else if (v.startsWith("1.12")) {
+                version = 12;
+            } else if (v.startsWith("1.11")) {
+                version = 11;
+            } else if (v.startsWith("1.10")) {
+                version = 10;
+            } else if (v.startsWith("1.9")) {
+                version = 9;
+            } else if (v.startsWith("1.8")) {
+                version = 8;
+            } else {
+                version = 0;
+            }
         }
 
         if (version == 0) {
             Logger.WARN.log("Unknown version: " + Bukkit.getVersion());
-            Logger.WARN.log("Choosing version 1.13");
-            version = 13;
+            Logger.WARN.log("Choosing version 1.8");
+            version = 8;
         }
         return version;
     }

+ 6 - 1
pom.xml

@@ -98,6 +98,12 @@
             <version>1.18.34</version>
             <scope>provided</scope>
         </dependency>
+        
+        <dependency>
+            <groupId>de.redstoneworld.redutilities</groupId>
+            <artifactId>redutilities</artifactId>
+            <version>0.0.14-Snapshot</version>
+        </dependency>
     </dependencies>
 
     <build>
@@ -131,7 +137,6 @@
                 <artifactId>maven-shade-plugin</artifactId>
                 <version>3.5.2</version>
                 <configuration>
-                    <dependencyReducedPomLocation>${project.build.directory}/dependency-reduced-pom.xml</dependencyReducedPomLocation>
                     <relocations>
                         <relocation>
                             <pattern>org.bstats</pattern>