Added warnings for missing enemy cores

This commit is contained in:
Anuken 2018-10-13 15:49:18 -04:00
parent ae6a5b2512
commit f8d0682810
2 changed files with 19 additions and 5 deletions

View file

@ -216,7 +216,8 @@ text.custom=Custom
text.builtin=Built-In
text.map.delete.confirm=Are you sure you want to delete this map? This action cannot be undone!
text.map.random=[accent]Random Map
text.map.nospawn=This map does not have any cores for the player to spawn in! Add a [ROYAL]blue[] core to this map in the editor.
text.map.nospawn=This map does not have any cores for the player to spawn in! Add a[ROYAL] blue[] core to this map in the editor.
text.map.nospawn.pvp=This map does not have any enemy cores for player to spawn into! Add[SCARLET] red[] cores to this map in the editor.
text.map.invalid=Error loading map: corrupted or invalid map file.
text.editor.brush=Brush
text.editor.slope=\\

View file

@ -254,14 +254,27 @@ public class World extends Module{
return;
}
if(!headless && state.teams.get(players[0].getTeam()).cores.size == 0){
ui.showError("$text.map.nospawn");
threads.runDelay(() -> state.set(State.menu));
invalidMap = true;
if(!headless){
if(state.teams.get(players[0].getTeam()).cores.size == 0){
ui.showError("$text.map.nospawn");
invalidMap = true;
}else if(state.mode.isPvp){
invalidMap = true;
for(Team team : Team.all){
if(state.teams.get(team).cores.size != 0 && team != players[0].getTeam()){
invalidMap = false;
}
}
if(invalidMap){
ui.showError("$text.map.nospawn.pvp");
}
}
}else{
invalidMap = false;
}
if(invalidMap) threads.runDelay(() -> state.set(State.menu));
endMapLoad();
}