make the combatmanager an enum

This commit is contained in:
igoudt 2017-04-26 10:21:24 +02:00
parent 5b21f34941
commit ce26e5c8dd
2 changed files with 4 additions and 10 deletions

View file

@ -19,20 +19,14 @@ import java.util.UUID;
/**
* @author noxx
*/
public class CombatManager {
public enum CombatManager {
private static CombatManager combatManager;
instance;
private final Map<UUID, Integer> combatAttackers = new HashMap<>();
private final Map<UUID, Integer> combatBlockers = new HashMap<>();
private int globalBlockersCount; // we need global counter as there are several combat groups
public static CombatManager getInstance() {
if (combatManager == null) {
combatManager = new CombatManager();
}
return combatManager;
}
private Point parentPoint;

View file

@ -860,9 +860,9 @@ public final class GamePanel extends javax.swing.JPanel {
showRevealed(game);
showLookedAt(game);
if (!game.getCombat().isEmpty()) {
CombatManager.getInstance().showCombat(game.getCombat(), gameId);
CombatManager.instance.showCombat(game.getCombat(), gameId);
} else {
CombatManager.getInstance().hideCombat(gameId);
CombatManager.instance.hideCombat(gameId);
}
for (PlayerView player : game.getPlayers()) {