@Test public void whenTeleportSinglePlayer() { List<Location> locations = locations(10); List<? extends GamePlayer> players = players(5); UUID uuid = UUID.randomUUID(); GamePlayer gamePlayer = mock(GamePlayer.class); when(gamePlayer.getId()).thenReturn(uuid); when(storage.getPlayer(eq(uuid))).thenReturn(gamePlayer); createAndTeleport(locations, players, soloGameMap -> soloGameMap.teleportPlayer(uuid)); verify(gamePlayer).teleport(argThat(locations::contains)); }
@Override public void teleportPlayer(UUID playerId) { gamePlayerStorage .getPlayer(playerId) .teleport(spawnLocations.get(ThreadLocalRandom.current().nextInt(spawnLocations.size()))); }
SoloGameMap extends AbstractGameMap { @Override public void teleportPlayer(UUID playerId) { gamePlayerStorage .getPlayer(playerId) .teleport(spawnLocations.get(ThreadLocalRandom.current().nextInt(spawnLocations.size()))); } }
SoloGameMap extends AbstractGameMap { @Override public void teleportPlayer(UUID playerId) { gamePlayerStorage .getPlayer(playerId) .teleport(spawnLocations.get(ThreadLocalRandom.current().nextInt(spawnLocations.size()))); } SoloGameMap(String name, List<Location> spawnLocations, GamePlayerStorage<?> gamePlayerStorage); }
SoloGameMap extends AbstractGameMap { @Override public void teleportPlayer(UUID playerId) { gamePlayerStorage .getPlayer(playerId) .teleport(spawnLocations.get(ThreadLocalRandom.current().nextInt(spawnLocations.size()))); } SoloGameMap(String name, List<Location> spawnLocations, GamePlayerStorage<?> gamePlayerStorage); @Override void teleportPlayers(); @Override void teleportPlayer(UUID playerId); }
SoloGameMap extends AbstractGameMap { @Override public void teleportPlayer(UUID playerId) { gamePlayerStorage .getPlayer(playerId) .teleport(spawnLocations.get(ThreadLocalRandom.current().nextInt(spawnLocations.size()))); } SoloGameMap(String name, List<Location> spawnLocations, GamePlayerStorage<?> gamePlayerStorage); @Override void teleportPlayers(); @Override void teleportPlayer(UUID playerId);  }