فهرست منبع

Undoing refactoring

RedstoneFuture 2 سال پیش
والد
کامیت
40d23fcb4b
1فایلهای تغییر یافته به همراه35 افزوده شده و 41 حذف شده
  1. 35 41
      missilewars-plugin/src/main/java/de/butzlabben/missilewars/commands/SetupCommands.java

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

@@ -21,9 +21,7 @@ package de.butzlabben.missilewars.commands;
 import co.aikar.commands.BaseCommand;
 import co.aikar.commands.annotation.*;
 import de.butzlabben.missilewars.configuration.Config;
-import de.butzlabben.missilewars.configuration.Lobby;
 import de.butzlabben.missilewars.configuration.Messages;
-import de.butzlabben.missilewars.configuration.arena.Arena;
 import de.butzlabben.missilewars.game.Game;
 import de.butzlabben.missilewars.game.GameManager;
 import org.bukkit.command.CommandSender;
@@ -72,8 +70,6 @@ public class SetupCommands extends BaseCommand {
     @Subcommand("lobby")
     public class lobbySetupCommands extends BaseCommand {
 
-        Lobby lobby = game.getLobby();
-
         @Subcommand("spawnpoint")
         public class spawnpointSetup extends BaseCommand {
 
@@ -83,8 +79,8 @@ public class SetupCommands extends BaseCommand {
                 if (!senderIsPlayer(sender)) return;
                 if (!isValidGame(args)) return;
 
-                lobby.setSpawnPoint(player.getLocation());
-                lobby.updateConfig();
+                game.getLobby().setSpawnPoint(player.getLocation());
+                game.getLobby().updateConfig();
                 player.sendMessage(Messages.getPrefix() + "§fSet new 'spawnPoint' to " + player.getLocation() + ".");
             }
 
@@ -94,7 +90,7 @@ public class SetupCommands extends BaseCommand {
                 if (!senderIsPlayer(sender)) return;
                 if (!isValidGame(args)) return;
 
-                player.teleport(lobby.getSpawnPoint());
+                player.teleport(game.getLobby().getSpawnPoint());
                 player.sendMessage(Messages.getPrefix() + "§fTeleported to 'spawnPoint'.");
             }
 
@@ -109,8 +105,8 @@ public class SetupCommands extends BaseCommand {
                 if (!senderIsPlayer(sender)) return;
                 if (!isValidGame(args)) return;
 
-                lobby.setAfterGameSpawn(player.getLocation());
-                lobby.updateConfig();
+                game.getLobby().setAfterGameSpawn(player.getLocation());
+                game.getLobby().updateConfig();
                 player.sendMessage(Messages.getPrefix() + "§fSet new 'afterGameSpawn' to " + player.getLocation() + ".");
             }
 
@@ -120,7 +116,7 @@ public class SetupCommands extends BaseCommand {
                 if (!senderIsPlayer(sender)) return;
                 if (!isValidGame(args)) return;
 
-                player.teleport(lobby.getAfterGameSpawn());
+                player.teleport(game.getLobby().getAfterGameSpawn());
                 player.sendMessage(Messages.getPrefix() + "§fTeleported to 'afterGameSpawn'.");
             }
 
@@ -138,9 +134,9 @@ public class SetupCommands extends BaseCommand {
                     if (!senderIsPlayer(sender)) return;
                     if (!isValidGame(args)) return;
 
-                    lobby.getArea().setPosition1(player.getLocation());
-                    lobby.setAreaConfig(lobby.getArea().getAreaConfiguration());
-                    lobby.updateConfig();
+                    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() + ".");
                 }
 
@@ -150,8 +146,8 @@ public class SetupCommands extends BaseCommand {
                     if (!senderIsPlayer(sender)) return;
                     if (!isValidGame(args)) return;
 
-                    player.teleport(lobby.getArea().getPosition1());
-                    player.sendMessage(Messages.getPrefix() + "§fTeleported to 'lobby area' (position 1): " + lobby.getArea().getPosition1().toString());
+                    player.teleport(game.getLobby().getArea().getPosition1());
+                    player.sendMessage(Messages.getPrefix() + "§fTeleported to 'lobby area' (position 1): " + game.getLobby().getArea().getPosition1().toString());
                 }
                 
             }
@@ -165,9 +161,9 @@ public class SetupCommands extends BaseCommand {
                     if (!senderIsPlayer(sender)) return;
                     if (!isValidGame(args)) return;
 
-                    lobby.getArea().setPosition2(player.getLocation());
-                    lobby.setAreaConfig(lobby.getArea().getAreaConfiguration());
-                    lobby.updateConfig();
+                    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() + ".");
                 }
 
@@ -177,8 +173,8 @@ public class SetupCommands extends BaseCommand {
                     if (!senderIsPlayer(sender)) return;
                     if (!isValidGame(args)) return;
 
-                    player.teleport(lobby.getArea().getPosition2());
-                    player.sendMessage(Messages.getPrefix() + "§fTeleported to 'lobby area' (position 2): " + lobby.getArea().getPosition2().toString());
+                    player.teleport(game.getLobby().getArea().getPosition2());
+                    player.sendMessage(Messages.getPrefix() + "§fTeleported to 'lobby area' (position 2): " + game.getLobby().getArea().getPosition2().toString());
                 }
 
             }
@@ -189,8 +185,6 @@ public class SetupCommands extends BaseCommand {
     @Subcommand("arena")
     public class arenaSetupCommands extends BaseCommand {
 
-        Arena arena = game.getArena();
-
         @Subcommand("spectatorspawn")
         public class spectatorspawnSetup extends BaseCommand {
 
@@ -200,8 +194,8 @@ public class SetupCommands extends BaseCommand {
                 if (!senderIsPlayer(sender)) return;
                 if (!isValidGame(args)) return;
 
-                arena.setSpectatorSpawn(player.getLocation());
-                arena.updateConfig();
+                game.getArena().setSpectatorSpawn(player.getLocation());
+                game.getArena().updateConfig();
                 player.sendMessage(Messages.getPrefix() + "§fSet new 'spectatorSpawn' to " + player.getLocation() + ".");
             }
 
@@ -211,7 +205,7 @@ public class SetupCommands extends BaseCommand {
                 if (!senderIsPlayer(sender)) return;
                 if (!isValidGame(args)) return;
 
-                player.teleport(arena.getSpectatorSpawn());
+                player.teleport(game.getArena().getSpectatorSpawn());
                 player.sendMessage(Messages.getPrefix() + "§fTeleported to 'spectatorSpawn'.");
             }
 
@@ -226,8 +220,8 @@ public class SetupCommands extends BaseCommand {
                 if (!senderIsPlayer(sender)) return;
                 if (!isValidGame(args)) return;
 
-                arena.setTeam1Spawn(player.getLocation());
-                arena.updateConfig();
+                game.getArena().setTeam1Spawn(player.getLocation());
+                game.getArena().updateConfig();
                 player.sendMessage(Messages.getPrefix() + "§fSet new 'team1Spawn' to " + player.getLocation() + ".");
             }
 
@@ -237,7 +231,7 @@ public class SetupCommands extends BaseCommand {
                 if (!senderIsPlayer(sender)) return;
                 if (!isValidGame(args)) return;
 
-                player.teleport(arena.getTeam1Spawn());
+                player.teleport(game.getArena().getTeam1Spawn());
                 player.sendMessage(Messages.getPrefix() + "§fTeleported to 'team1Spawn'.");
             }
 
@@ -252,8 +246,8 @@ public class SetupCommands extends BaseCommand {
                 if (!senderIsPlayer(sender)) return;
                 if (!isValidGame(args)) return;
 
-                arena.setTeam2Spawn(player.getLocation());
-                arena.updateConfig();
+                game.getArena().setTeam2Spawn(player.getLocation());
+                game.getArena().updateConfig();
                 player.sendMessage(Messages.getPrefix() + "§fSet new 'team2Spawn' to " + player.getLocation() + ".");
             }
 
@@ -263,7 +257,7 @@ public class SetupCommands extends BaseCommand {
                 if (!senderIsPlayer(sender)) return;
                 if (!isValidGame(args)) return;
 
-                player.teleport(arena.getTeam2Spawn());
+                player.teleport(game.getArena().getTeam2Spawn());
                 player.sendMessage(Messages.getPrefix() + "§fTeleported to 'team2Spawn'.");
             }
 
@@ -281,9 +275,9 @@ public class SetupCommands extends BaseCommand {
                     if (!senderIsPlayer(sender)) return;
                     if (!isValidGame(args)) return;
 
-                    arena.getArea().setPosition1(player.getLocation());
-                    arena.setAreaConfig(arena.getArea().getAreaConfiguration());
-                    arena.updateConfig();
+                    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() + ".");
                 }
 
@@ -293,8 +287,8 @@ public class SetupCommands extends BaseCommand {
                     if (!senderIsPlayer(sender)) return;
                     if (!isValidGame(args)) return;
 
-                    player.teleport(arena.getArea().getPosition1());
-                    player.sendMessage(Messages.getPrefix() + "§fTeleported to 'arena area' (position 1): " + arena.getArea().getPosition1().toString());
+                    player.teleport(game.getArena().getArea().getPosition1());
+                    player.sendMessage(Messages.getPrefix() + "§fTeleported to 'arena area' (position 1): " + game.getArena().getArea().getPosition1().toString());
                 }
 
             }
@@ -308,9 +302,9 @@ public class SetupCommands extends BaseCommand {
                     if (!senderIsPlayer(sender)) return;
                     if (!isValidGame(args)) return;
 
-                    arena.getArea().setPosition2(player.getLocation());
-                    arena.setAreaConfig(arena.getArea().getAreaConfiguration());
-                    arena.updateConfig();
+                    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() + ".");
                 }
 
@@ -320,8 +314,8 @@ public class SetupCommands extends BaseCommand {
                     if (!senderIsPlayer(sender)) return;
                     if (!isValidGame(args)) return;
 
-                    player.teleport(arena.getArea().getPosition2());
-                    player.sendMessage(Messages.getPrefix() + "§fTeleported to 'arena area' (position 2): " + arena.getArea().getPosition2().toString());
+                    player.teleport(game.getArena().getArea().getPosition2());
+                    player.sendMessage(Messages.getPrefix() + "§fTeleported to 'arena area' (position 2): " + game.getArena().getArea().getPosition2().toString());
                 }
 
             }