23 lines
608 B
Java
23 lines
608 B
Java
|
package de.towerdefence.server.match;
|
||
|
|
||
|
import de.towerdefence.server.player.Player;
|
||
|
import org.springframework.stereotype.Service;
|
||
|
|
||
|
import java.util.HashMap;
|
||
|
import java.util.Map;
|
||
|
|
||
|
@Service
|
||
|
public class MatchService {
|
||
|
private final Map<Player, Match> playerMatches = new HashMap<>();
|
||
|
|
||
|
public void createMatch(String matchId, Player player1, Player player2) {
|
||
|
Match match = new Match(matchId, player1, player2);
|
||
|
playerMatches.put(player1, match);
|
||
|
playerMatches.put(player2, match);
|
||
|
}
|
||
|
|
||
|
public Match get(Player player) {
|
||
|
return playerMatches.get(player);
|
||
|
}
|
||
|
}
|