|
5 | 5 | import com.shanebeestudios.hg.api.game.GameBorderData;
|
6 | 6 | import com.shanebeestudios.hg.api.game.GameRegion;
|
7 | 7 | import com.shanebeestudios.hg.api.parsers.LocationParser;
|
| 8 | +import com.shanebeestudios.hg.api.status.Status; |
8 | 9 | import com.shanebeestudios.hg.api.util.Pair;
|
9 | 10 | import com.shanebeestudios.hg.api.util.Util;
|
10 | 11 | import com.shanebeestudios.hg.plugin.HungerGames;
|
@@ -84,26 +85,35 @@ public void loadAllArenas() {
|
84 | 85 | Util.warning("Could not create arenas directory!");
|
85 | 86 | }
|
86 | 87 | }
|
87 |
| - int count = 0; |
| 88 | + int readyCount = 0; |
| 89 | + int brokenCount = 0; |
88 | 90 | for (File arenaFile : this.arenaDirectory.listFiles()) {
|
89 | 91 | String name = arenaFile.getName();
|
90 | 92 | if (name.endsWith(".yml")) {
|
91 | 93 | YamlConfiguration arenaConfig = YamlConfiguration.loadConfiguration(arenaFile);
|
92 | 94 | name = name.replace(".yml", "");
|
93 |
| - loadArena(arenaConfig, name); |
| 95 | + boolean isReady = loadArena(arenaConfig, name); |
94 | 96 | this.fileConfigMap.put(name, Pair.of(arenaFile, arenaConfig));
|
95 |
| - count++; |
| 97 | + if (isReady) { |
| 98 | + readyCount++; |
| 99 | + } else { |
| 100 | + brokenCount++; |
| 101 | + } |
96 | 102 | }
|
97 | 103 | }
|
98 |
| - if (count > 0) { |
99 |
| - Util.log("- <aqua>%s <grey>arenas have been <green>successfully loaded!", count); |
100 |
| - } else { |
| 104 | + if (readyCount == 0 && brokenCount == 0) { |
101 | 105 | Util.log("- <red>No Arenas found. <grey>Time to create some!");
|
102 | 106 | }
|
| 107 | + if (readyCount > 0) { |
| 108 | + Util.log("- <aqua>%s <grey>arenas have been <green>successfully loaded!", readyCount); |
| 109 | + } |
| 110 | + if (brokenCount > 0) { |
| 111 | + Util.log("- <aqua>%s <grey>arenas have <red>failed to successfully loaded!", brokenCount); |
| 112 | + } |
103 | 113 | }
|
104 | 114 |
|
105 | 115 | @SuppressWarnings("DataFlowIssue")
|
106 |
| - public void loadArena(FileConfiguration arenaConfig, String arenaName) { |
| 116 | + public boolean loadArena(FileConfiguration arenaConfig, String arenaName) { |
107 | 117 | boolean isReady = true;
|
108 | 118 | List<Location> spawns = new ArrayList<>();
|
109 | 119 | Location lobbysign = null;
|
@@ -229,7 +239,14 @@ public void loadArena(FileConfiguration arenaConfig, String arenaName) {
|
229 | 239 | arenaName, world.getName());
|
230 | 240 | Util.debug(exception);
|
231 | 241 | }
|
232 |
| - Util.log("- Loaded arena <white>'<aqua>%s<white>'<grey>", arenaName); |
| 242 | + if (gameArenaData.getStatus() == Status.BROKEN) { |
| 243 | + Util.warning("<red>Failed to properly initiate arena <white>'<aqua>%s<white>'<grey>", arenaName); |
| 244 | + Util.warning("Run <white>'<aqua>/hg debug %s<white>' <yellow>to check the status of the arena.", arenaName); |
| 245 | + isReady = false; |
| 246 | + } else { |
| 247 | + Util.log("- Loaded arena <white>'<aqua>%s<white>'<grey>", arenaName); |
| 248 | + } |
| 249 | + return isReady; |
233 | 250 | }
|
234 | 251 |
|
235 | 252 | /**
|
|
0 commit comments