Skip to content

Commit

Permalink
Add support for xbox players
Browse files Browse the repository at this point in the history
  • Loading branch information
ExcuseMi committed Aug 26, 2016
1 parent b547255 commit 7bbfe1d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.excuseme.rocketleaguelivestats.model;

public enum GamingSystem {
STEAM("steam","gamingsystem/steam.png", 3), PS4("ps4","gamingsystem/Ps4.png",2), XBOX("xbox","",3), BOT("other", "", null);
STEAM("steam","gamingsystem/steam.png", 3), PS4("ps4","gamingsystem/Ps4.png",2), XBOX("xbox","",1), BOT("other", "", null);

private String qualifier;
private String iconPath;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,21 @@ public static Game map(GameData gameData) {
final List<Player> players = new ArrayList<Player>();

for (PlayerName playerName : playerNames) {

PlayerId playerId = findPlayerId(playerIds, playerName.getNumber());
if (playerId == null) {
final PlayerName extensionPlayer = findExtensionPlayer(playerNames, playerName.getName());
if (extensionPlayer != null) {
playerId = findPlayerId(playerIds, extensionPlayer.getNumber());
}
}
int number = playerId != null ? playerId.getNumber() : -1;
String system = playerId != null ? playerId.getSystem() : null;
GamingSystem gamingSystem = mapSystem(system);
String id = playerId != null ? playerId.getId() : null;

int number = playerId != null ? playerId.getNumber() : -1;

String id = GamingSystem.XBOX.equals(gamingSystem) ? playerName.getName() : playerId != null ? playerId.getId() : null;

boolean ownPlayer = calculateOwnPlayer(playerId, gameData.getOwnPlayer(), gamingSystem);
String nickName = playerName.getName();
int row = 0;
Expand Down Expand Up @@ -102,7 +106,7 @@ private static GamingSystem mapSystem(String system) {
return GamingSystem.STEAM;
} else if ("PS4".equalsIgnoreCase(system)) {
return GamingSystem.PS4;
} else if ("XBOX".equalsIgnoreCase(system)) {
} else if ("XboxOne".equalsIgnoreCase(system)) {
return GamingSystem.XBOX;
} else {
return GamingSystem.BOT;
Expand Down

0 comments on commit 7bbfe1d

Please sign in to comment.