add: Thread protection Player.java
This commit is contained in:
parent
058d069ff2
commit
22950cd155
|
@ -11,18 +11,9 @@ public abstract class Player {
|
|||
this.board = new Board(size);
|
||||
}
|
||||
|
||||
public synchronized void receiveShoot(Point point) {
|
||||
HitResponse hitResponse = board.getHitResponsOnPoint(point);
|
||||
if (!(hitResponse == null)){
|
||||
enemy.receiveHit(hitResponse);
|
||||
} else {
|
||||
enemy.receiveHit(this.board.hit(point));
|
||||
}
|
||||
}
|
||||
public abstract void receiveShoot(Point point);
|
||||
|
||||
public synchronized void receiveHit(HitResponse hitResponse) {
|
||||
enemy.board.addHits(hitResponse);
|
||||
}
|
||||
public abstract void receiveHit(HitResponse hitResponse);
|
||||
|
||||
public void click(Point point) {
|
||||
|
||||
|
|
Loading…
Reference in New Issue