From 8f19cf400cc0623586791a6af68d2dffd600fa56 Mon Sep 17 00:00:00 2001 From: Katchan Date: Thu, 21 Oct 2021 15:54:53 +0200 Subject: [PATCH] Fix omissions + Optimize import --- .../java/fr/lnl/game/server/games/action/Action.java | 2 -- .../fr/lnl/game/server/games/action/DeployShield.java | 1 - .../fr/lnl/game/server/games/action/DropBomb.java | 1 - .../java/fr/lnl/game/server/games/action/Move.java | 11 +++++++++++ .../java/fr/lnl/game/server/games/action/Shot.java | 11 +++++++++++ .../main/java/fr/lnl/game/server/games/grid/Grid.java | 2 +- .../lnl/game/server/games/player/AbstractPlayer.java | 1 - .../fr/lnl/game/server/games/player/ClassPlayer.java | 1 - .../lnl/game/server/games/player/ComputerPlayer.java | 2 -- .../game/server/games/player/DefaultClassPlayer.java | 2 ++ .../fr/lnl/game/server/games/player/HumanPlayer.java | 1 - 11 files changed, 25 insertions(+), 10 deletions(-) diff --git a/server/src/main/java/fr/lnl/game/server/games/action/Action.java b/server/src/main/java/fr/lnl/game/server/games/action/Action.java index 6ee599e..910921a 100644 --- a/server/src/main/java/fr/lnl/game/server/games/action/Action.java +++ b/server/src/main/java/fr/lnl/game/server/games/action/Action.java @@ -1,7 +1,5 @@ package fr.lnl.game.server.games.action; -import fr.lnl.game.server.games.grid.Grid; -import fr.lnl.game.server.games.player.Player; public interface Action { void doAction(); diff --git a/server/src/main/java/fr/lnl/game/server/games/action/DeployShield.java b/server/src/main/java/fr/lnl/game/server/games/action/DeployShield.java index 9e21ad5..55320bb 100644 --- a/server/src/main/java/fr/lnl/game/server/games/action/DeployShield.java +++ b/server/src/main/java/fr/lnl/game/server/games/action/DeployShield.java @@ -1,7 +1,6 @@ package fr.lnl.game.server.games.action; import fr.lnl.game.server.games.Game; -import fr.lnl.game.server.games.player.AbstractPlayer; public class DeployShield extends AbstractAction { public DeployShield(Game game){ diff --git a/server/src/main/java/fr/lnl/game/server/games/action/DropBomb.java b/server/src/main/java/fr/lnl/game/server/games/action/DropBomb.java index 9baa749..32d88d7 100644 --- a/server/src/main/java/fr/lnl/game/server/games/action/DropBomb.java +++ b/server/src/main/java/fr/lnl/game/server/games/action/DropBomb.java @@ -1,7 +1,6 @@ package fr.lnl.game.server.games.action; import fr.lnl.game.server.games.Game; -import fr.lnl.game.server.games.player.AbstractPlayer; public class DropBomb extends DropObject { diff --git a/server/src/main/java/fr/lnl/game/server/games/action/Move.java b/server/src/main/java/fr/lnl/game/server/games/action/Move.java index 853f12c..b502127 100644 --- a/server/src/main/java/fr/lnl/game/server/games/action/Move.java +++ b/server/src/main/java/fr/lnl/game/server/games/action/Move.java @@ -1,8 +1,19 @@ package fr.lnl.game.server.games.action; +import fr.lnl.game.server.games.Game; + public class Move extends AbstractAction { + public Move(Game game) { + super(game); + } + @Override public void doAction() { } + + @Override + public boolean isPossible() { + return false; + } } diff --git a/server/src/main/java/fr/lnl/game/server/games/action/Shot.java b/server/src/main/java/fr/lnl/game/server/games/action/Shot.java index e101eeb..dca771b 100644 --- a/server/src/main/java/fr/lnl/game/server/games/action/Shot.java +++ b/server/src/main/java/fr/lnl/game/server/games/action/Shot.java @@ -1,8 +1,19 @@ package fr.lnl.game.server.games.action; +import fr.lnl.game.server.games.Game; + public class Shot extends AbstractAction { + public Shot(Game game) { + super(game); + } + @Override public void doAction() { } + + @Override + public boolean isPossible() { + return false; + } } diff --git a/server/src/main/java/fr/lnl/game/server/games/grid/Grid.java b/server/src/main/java/fr/lnl/game/server/games/grid/Grid.java index 09de6c7..b532d89 100644 --- a/server/src/main/java/fr/lnl/game/server/games/grid/Grid.java +++ b/server/src/main/java/fr/lnl/game/server/games/grid/Grid.java @@ -72,7 +72,7 @@ public class Grid { System.out.print("\n"); for (int j = 0; j < y; j++) { Pair value = board.get(new Point(i, j)); - if(value.getA() instanceof Player){ + if(value.getA() != null){ System.out.print(" \033[0;34mP\033[0m"); } else if (value.getB() instanceof Wall) { diff --git a/server/src/main/java/fr/lnl/game/server/games/player/AbstractPlayer.java b/server/src/main/java/fr/lnl/game/server/games/player/AbstractPlayer.java index 8e76985..0ff96ad 100644 --- a/server/src/main/java/fr/lnl/game/server/games/player/AbstractPlayer.java +++ b/server/src/main/java/fr/lnl/game/server/games/player/AbstractPlayer.java @@ -2,7 +2,6 @@ package fr.lnl.game.server.games.player; import fr.lnl.game.server.games.action.Action; import fr.lnl.game.server.games.weapon.Weapon; -import fr.lnl.game.server.utils.Point; public abstract class AbstractPlayer implements Player { diff --git a/server/src/main/java/fr/lnl/game/server/games/player/ClassPlayer.java b/server/src/main/java/fr/lnl/game/server/games/player/ClassPlayer.java index b355ef8..2125b2c 100644 --- a/server/src/main/java/fr/lnl/game/server/games/player/ClassPlayer.java +++ b/server/src/main/java/fr/lnl/game/server/games/player/ClassPlayer.java @@ -1,7 +1,6 @@ package fr.lnl.game.server.games.player; import fr.lnl.game.server.games.weapon.Weapon; -import fr.lnl.game.server.utils.Point; public interface ClassPlayer { diff --git a/server/src/main/java/fr/lnl/game/server/games/player/ComputerPlayer.java b/server/src/main/java/fr/lnl/game/server/games/player/ComputerPlayer.java index a51003d..ed38862 100644 --- a/server/src/main/java/fr/lnl/game/server/games/player/ComputerPlayer.java +++ b/server/src/main/java/fr/lnl/game/server/games/player/ComputerPlayer.java @@ -1,7 +1,5 @@ package fr.lnl.game.server.games.player; -import fr.lnl.game.server.utils.Point; - public class ComputerPlayer extends AbstractPlayer{ public ComputerPlayer(int id, boolean shieldDeploy, ClassPlayer classPlayer) { diff --git a/server/src/main/java/fr/lnl/game/server/games/player/DefaultClassPlayer.java b/server/src/main/java/fr/lnl/game/server/games/player/DefaultClassPlayer.java index 10a0de4..f05fca1 100644 --- a/server/src/main/java/fr/lnl/game/server/games/player/DefaultClassPlayer.java +++ b/server/src/main/java/fr/lnl/game/server/games/player/DefaultClassPlayer.java @@ -3,6 +3,8 @@ package fr.lnl.game.server.games.player; import fr.lnl.game.server.games.weapon.Firearm; import fr.lnl.game.server.games.weapon.Weapon; +@SuppressWarnings("all") + public class DefaultClassPlayer implements ClassPlayer{ private final int ENERGY = 800; diff --git a/server/src/main/java/fr/lnl/game/server/games/player/HumanPlayer.java b/server/src/main/java/fr/lnl/game/server/games/player/HumanPlayer.java index 6d7f97f..42cb219 100644 --- a/server/src/main/java/fr/lnl/game/server/games/player/HumanPlayer.java +++ b/server/src/main/java/fr/lnl/game/server/games/player/HumanPlayer.java @@ -1,6 +1,5 @@ package fr.lnl.game.server.games.player; -import fr.lnl.game.server.utils.Point; public class HumanPlayer extends AbstractPlayer {