fix deprecated function calls
This commit is contained in:
parent
f3d56b37c7
commit
11c7dda19b
|
@ -7,8 +7,15 @@ public class GameController {
|
|||
|
||||
public void startLocalGame(Class<? extends LocalPlayer> localPlayerClass, Class<? extends AiPlayer> enemyClass, int size) throws InstantiationException, IllegalAccessException {
|
||||
|
||||
LocalPlayer localPlayer = localPlayerClass.newInstance();
|
||||
AiPlayer aiPlayer = enemyClass.newInstance();
|
||||
LocalPlayer localPlayer;
|
||||
AiPlayer aiPlayer;
|
||||
try {
|
||||
localPlayer = localPlayerClass.getDeclaredConstructor().newInstance();
|
||||
aiPlayer = enemyClass.getDeclaredConstructor().newInstance();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
localPlayer.setEnemy(aiPlayer);
|
||||
aiPlayer.setEnemy(localPlayer);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue