WROracer / UNO-Engine

Undocumented class found JAVA-D1000
Documentation
Minor
12 occurrences in this check
Consider adding a doc comment for UnoException
 1package de.wroracer.unoengine.exeptions;
 2
 3public class UnoException extends Exception { 4    public UnoException() { 5        super(); 6    } 7 8    public UnoException(String message) { 9        super(message);10    }1112    public UnoException(String message, Throwable cause) {13        super(message, cause);14    }1516    public UnoException(Throwable cause) {17        super(cause);18    }19}
Consider adding a doc comment for PlayerHasNoCardException
 3import de.wroracer.unoengine.Player;
 4import de.wroracer.unoengine.cards.Card;
 5
 6public class PlayerHasNoCardException extends UnoException{ 7 8    public PlayerHasNoCardException(Player player, Card card) { 9        super("The Player "+player+" has´nt got the Card "+card);10    }11}
Consider adding a doc comment for NotPlayableCardException
 2
 3import de.wroracer.unoengine.cards.Card;
 4
 5public class NotPlayableCardException extends UnoException{ 6 7    public NotPlayableCardException(Card played,Card card) { 8        super("The Card "+played+" can not be Played on "+card); 9    }10}
Consider adding a doc comment for CantPlayBlackException
1package de.wroracer.unoengine.exeptions;
2
3public class CantPlayBlackException extends UnoException{4    public CantPlayBlackException() {5            super("Cant Play Black Card.");6    }7}
Consider adding a doc comment for WildDrawFourCard
 3import de.wroracer.unoengine.Game;
 4import de.wroracer.unoengine.Player;
 5
 6public class WildDrawFourCard extends Card{ 7    private final static int cardsToDraw = 4; 8    private int currentDrawCards = 0; 9    public WildDrawFourCard() {10        super(CardType.WILD, CardColor.BLACK);11    }1213    @Override14    public void setColor(CardColor color) {15        super.setColor(color);16    }1718    @Override19    public boolean isPlayable(Card card) {20        return card.getColor() == getColor();21    }2223    @Override24    public boolean canPlayedOn(Card card) {25        return true;26    }2728    @Override29    public void play(Game game, Player player) {30        if (game.getCurrentCard() instanceof DrawTwoCard){31            this.currentDrawCards = ((DrawTwoCard) game.getCurrentCard()).getCurrentDrawCards();32            this.currentDrawCards += cardsToDraw;33        }else if (game.getCurrentCard() instanceof WildDrawFourCard){34            this.currentDrawCards = ((WildDrawFourCard) game.getCurrentCard()).getCurrentDrawCards();35            this.currentDrawCards += cardsToDraw;36        }else {37            game.nextPlayer();38            for (int i = 0; i < currentDrawCards; i++) {39                game.drawCard(game.getCurrentPlayer());40            }41        }42        super.play(game, player);43    }4445    public int getCurrentDrawCards() {46        return currentDrawCards;47    }4849    @Override50    public String toString() {51        return "WildDrawFourCard{" +52                "currentDrawCards=" + currentDrawCards +53                "} " + super.toString();54    }55}
Consider adding a doc comment for WildCard
 3import de.wroracer.unoengine.Game;
 4import de.wroracer.unoengine.Player;
 5
 6public class WildCard extends Card { 7    public WildCard() { 8        super(CardType.WILD, CardColor.BLACK); 9    }1011    @Override12    public void setColor(CardColor color) {13        super.setColor(color);14    }1516    @Override17    public boolean isPlayable(Card card) {18        return card.getColor() == getColor();19    }2021    @Override22    public boolean canPlayedOn(Card card) {23        return true;24    }2526    @Override27    public void play(Game game, Player player) {28        super.play(game, player);29    }3031}
Consider adding a doc comment for SkipCard
 3import de.wroracer.unoengine.Game;
 4import de.wroracer.unoengine.Player;
 5
 6public class SkipCard extends Card{ 7    public SkipCard( CardColor color) { 8        super(CardType.SKIP, color); 9    }10    @Override11    public void setColor(CardColor color) {12        super.setColor(color);13    }1415    @Override16    public boolean isPlayable(Card card) {17        return card.getColor() == getColor();18    }1920    @Override21    public boolean canPlayedOn(Card card) {22        return card.getColor() == getColor();23    }2425    @Override26    public void play(Game game, Player player) {27        game.nextPlayer();28        super.play(game, player);29    }30}
Consider adding a doc comment for ReverseCard
 3import de.wroracer.unoengine.Game;
 4import de.wroracer.unoengine.Player;
 5
 6public class ReverseCard extends Card{ 7    public ReverseCard(CardColor color) { 8        super(CardType.REVERSE, color); 9    }1011    @Override12    public boolean isPlayable(Card card) {13        return card.getColor() == getColor();14    }1516    @Override17    public boolean canPlayedOn(Card card) {18        return card.getColor() == getColor();19    }2021    @Override22    public void play(Game game, Player player) {23        game.changeDirection();24        super.play(game,player);25    }2627}
Consider adding a doc comment for DrawTwoCard
 3import de.wroracer.unoengine.Game;
 4import de.wroracer.unoengine.Player;
 5
 6public class DrawTwoCard extends Card{ 7    private final static int cardsToDraw = 2; 8    private int currentDrawCards = 0; 9    public DrawTwoCard(CardColor color) {10        super(CardType.DRAW_TWO, color);11    }1213    @Override14    public boolean isPlayable(Card card) {15        return card.getColor() == getColor();16    }1718    @Override19    public boolean canPlayedOn(Card card) {20        return card.getColor() == getColor();21    }2223    @Override24    public void play(Game game, Player player) {25        if (game.getCurrentCard() instanceof DrawTwoCard){26            this.currentDrawCards = ((DrawTwoCard) game.getCurrentCard()).getCurrentDrawCards();27            this.currentDrawCards += cardsToDraw;28        }else if (game.getCurrentCard() instanceof WildDrawFourCard){29            this.currentDrawCards = ((WildDrawFourCard) game.getCurrentCard()).getCurrentDrawCards();30            this.currentDrawCards += cardsToDraw;31        }else {32            game.nextPlayer();33            for (int i = 0; i < currentDrawCards; i++) {34                game.drawCard(game.getCurrentPlayer());35            }36        }37        super.play(game, player);38    }3940    public int getCurrentDrawCards() {41        return currentDrawCards;42    }4344    @Override45    public String toString() {46        return "DrawTwoCard{" +47                "currentDrawCards=" + currentDrawCards +48                "} " + super.toString();49    }50}
Consider adding a doc comment for Card
 3import de.wroracer.unoengine.Game;
 4import de.wroracer.unoengine.Player;
 5
 6public class Card { 7    private CardColor color; 8    private CardType type; 9    public Card(CardType type,CardColor color){10        this.type = type;11        this.color = color;12    }1314    public CardColor getColor() {15        return color;16    }1718    public CardType getType() {19        return type;20    }2122    protected void setType(CardType type) {23        this.type = type;24    }2526    protected void setColor(CardColor color) {27        this.color = color;28    }2930    public boolean isPlayable(Card card){31        if (!card.getType().isNumber())return card.canPlayedOn(this);32        if (card.getColor() == color)return true;33        if (card.getType().getNumber()+1== type.getNumber())return true;34        return card.getType().getNumber() - 1 == type.getNumber();35    }3637    public boolean canPlayedOn(Card card){38        if (card.getColor() == color)return true;39        if (card.getType().getNumber()+1== type.getNumber())return true;40        return card.getType().getNumber() - 1 == type.getNumber();41    }4243    /**44     * This method is executed, when this card is played.45     * @param game the game, where the card is played.46     */47    public void play(Game game, Player player){48        game.nextPlayer();49    }5051    @Override52    public String toString() {53        return "Card{" +54                "color=" + color +55                ", type=" + type +56                '}';57    }58}
Consider adding a doc comment for Player
 2
 3import java.util.UUID;
 4
 5public class Player { 6    private UUID uuid; 7    private int id; 8    public Player(){ 9        this.uuid = UUID.randomUUID();10    }1112    protected Player(int id){13        this();14        this.id = id;15    }1617    public UUID getUuid() {18        return uuid;19    }2021    @Override22    public String toString() {23        return "Player{" +24                "uuid=" + uuid +25                ", id=" + id +26                '}';27    }28}
Consider adding a doc comment for DeckUtils
 5import java.util.ArrayList;
 6import java.util.List;
 7
 8public class DeckUtils { 9    public static List<Card> getDeck(){10        List<Card> cards = new ArrayList<>();11        for (CardColor color : CardColor.values()) {12            if (color != CardColor.BLACK){13                for (CardType number : CardType.getNumbers()) {14                    cards.add(new Card(number,color));15                    if (number!=CardType.ZERO)16                        cards.add(new Card(number,color));17                }18                cards.add(new DrawTwoCard(color));19                cards.add(new DrawTwoCard(color));20                cards.add(new ReverseCard(color));21                cards.add(new ReverseCard(color));22                cards.add(new SkipCard(color));23                cards.add(new SkipCard(color));24            }2526        }27        for (int i = 0; i < 4; i++) {28            cards.add(new WildCard());29            cards.add(new WildDrawFourCard());30        }31        return cards;32    }33}