Fix multi source maps not working

This commit is contained in:
Sam 2018-07-06 19:14:18 +01:00 committed by Alexander Meech
parent 04dc72fa77
commit ce66748dc3
2 changed files with 14 additions and 7 deletions

View File

@ -426,6 +426,7 @@ public abstract class Game extends ListenerComponent implements Lifetimed
// Scoreboard // Scoreboard
Scoreboard = new GameScoreboard(this); Scoreboard = new GameScoreboard(this);
WorldData = new WorldData(this);
// Stat Trackers // Stat Trackers
registerStatTrackers( registerStatTrackers(

View File

@ -367,7 +367,7 @@ public class GameCreationManager implements Listener
{ {
MapPref = MapPref.replace(" ", ""); MapPref = MapPref.replace(" ", "");
System.out.println("Map Preference: " + MapPref); System.out.println("Map Preference: " + MapPref + " in " + MapSource);
Map<GameType, List<String>> matches = new HashMap<>(); Map<GameType, List<String>> matches = new HashMap<>();
@ -375,21 +375,27 @@ public class GameCreationManager implements Listener
{ {
GameType entryType = entry.getKey(); GameType entryType = entry.getKey();
List<String> maps = entry.getValue(); List<String> maps = entry.getValue();
if (MapSource != null && entryType != MapSource)
{
continue;
}
List<String> matchList = new ArrayList<>(); List<String> matchList = new ArrayList<>();
maps.forEach(map -> maps.forEach(map ->
{ {
if (map.replace(" ", "").toLowerCase().contains(MapPref.toLowerCase())) if (map.replace(" ", "").toLowerCase().contains(MapPref.toLowerCase()))
{ {
if (MapSource == null || entryType == MapSource) matchList.add(map);
{ System.out.print("Map Preference Found: " + map);
matchList.add(map);
System.out.print("Map Preference Found: " + map);
}
} }
}); });
matches.put(entryType, matchList); if (!matchList.isEmpty())
{
matches.put(entryType, matchList);
}
} }
if (!matches.isEmpty()) if (!matches.isEmpty())