Battle ships API 2015-09-06

Provides easy functions to create a battleships plugin

  1. cc007
    Battleships API

    Provides easy functions to create a battleships plugin.

    How to use

    1. The plugin creator is able to create a game by instantiating a new Game object from the API package (com.github.cc007.battleshipsapi)
    2. The game object contains two battleships Player objects (will maybe change to BSPlayer in the future to prevent bukkit Player confusion). The players are accessable through <gameobject>.getPlayer1() and <gameobject>.getPlayer2().
    3. The game starts in a ship setup state, where ships can be set up. This can be done through <playerobject>.placeShip(<kind of ship>, <letter of column>, <number of row>, <direction of ship>). The coordinate given is the top most or left most point (dependent on the vertical or horizontal direction) of the ship.
    4. Before the <playerobject>.ready() command is issued , player ships can be moved. This is done using the method moveShip with the same parameters as placeShip uses.
    5. Issueing the ready() method will check if all ships are placed. Only then the command will set the player to ready. If both players are set to ready, the game will start.
    6. Players are able to alternate shooting, starting with player1, using <playerobject>.shootOpponent(<letter of column>, <number of row>)
    7. Players are able to see their own board data by using <playerobject>.getOwnGrid() They check coordinate values by using <gridobject>.get(<letter of column).get(<number of row>). This returns a FieldState object that is EMPTY or OCCUPIED when not shot and HIT or MISS when shot.
    8. Players can also see what they know of the enemy grid. You can get the coodinate values in the same way as above. It will show EMPTY for unknown fields and HIT or MISS for fields that were shot.
    9. The game will end automatically when one of the players has lost all ships. You can ask the game if the game is over with <gameobject>.isGameOver() and check which player won with <playerobject>.hasWon(), both methods returning a boolean
    10. When a game is done you can either create a new Game object to start a new game, or you could call <gameobject.reset() to reset the game.
    Example implementation

    An example implementation for this api is BattleConsole, a windows command prompt/unix shell based implementation using this api.

    Possible implementations for minecraft

    • Using inventories to display the boards and select the fields to shoot
    • Using blocks to display the boards and commands to shoot
    • Using custom skinned heads to display the boards and punching a head to shoot.

Recent Reviews

    Version: 2015-09-06
    This is the first bad review I have given on spigot. There is no api documentation. Why do you think there is only 9 downloads for this so called "API". Put more information on this. Seriously.
    1. cc007
      Author's Response
      As stated, the description would be added later. Could you please reconsider your review now I updated the description?