Class HvZGame

java.lang.Object
edu.uw.calebcha.hvz.HvZGame
All Implemented Interfaces:
org.bukkit.event.Listener

public class HvZGame
extends java.lang.Object
implements org.bukkit.event.Listener
Represents a game of Humans vs Zombies.
Author:
Caleb Chan (cccfire)
  • Constructor Summary

    Constructors 
    Constructor Description
    HvZGame​(java.lang.String name, HvZMap map)
    Initializes the HvZGame
    HvZGame​(java.lang.String name, HvZMap map, HvZPlayerRegistry playerRegistry, HvZGraveyard graveyard)
    Initializes the HvZGame with existing players.
  • Method Summary

    Modifier and Type Method Description
    void add​(org.bukkit.entity.Player player)
    Adds player to this HvZ game
    void countdown()
    Starts countdown to start the game.
    void endGame()
    Ends the game.
    java.lang.String getCreatorName()
    Get the name of player who created this game.
    HvZGraveyard getGraveyard()
    Gets this game's graveyard.
    HvZPlayerRegistry getPlayerRegistry()
    Gets this game's player registry.
    int getTimeLimit()
    Gets the time limit for this game
    void onPlayerQuit​(org.bukkit.event.player.PlayerQuitEvent event)  
    void remove​(org.bukkit.entity.Player player)
    Removes given player from this HvZ game
    void setTimeLimit​(int timeLimit)
    Sets the time limit for this game
    int size()
    Returns number of players
    void start()
    Starts this game.
    boolean winnerIsHuman()
    Returns whether the humans win.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • HvZGame

      public HvZGame​(java.lang.String name, HvZMap map, HvZPlayerRegistry playerRegistry, HvZGraveyard graveyard)
      Initializes the HvZGame with existing players.

      Mainly used for when humans win and decide to continue the game with the same remaining players as humans.

      Parameters:
      name - name of the player who created this game
      map - the map used in this game
      playerRegistry - existing player registry from previous game
      graveyard - existing graveyard from previous game
    • HvZGame

      public HvZGame​(java.lang.String name, HvZMap map)
      Initializes the HvZGame
      Parameters:
      name - name of the player who created this game
      map - the map used in this game
  • Method Details

    • getCreatorName

      public java.lang.String getCreatorName()
      Get the name of player who created this game. Mainly used for distinguishing games when listing them in a menu.
      Returns:
      name of player who created this game
    • size

      public int size()
      Returns number of players
      Returns:
      number of players
    • add

      public void add​(org.bukkit.entity.Player player)
      Adds player to this HvZ game
      Parameters:
      player - player to be added to game
    • remove

      public void remove​(org.bukkit.entity.Player player)
      Removes given player from this HvZ game
      Parameters:
      player - player to be removed from game
    • countdown

      public void countdown()
      Starts countdown to start the game.
    • start

      public void start()
      Starts this game.
    • endGame

      public void endGame()
      Ends the game.
    • winnerIsHuman

      public boolean winnerIsHuman()
      Returns whether the humans win. To be overridden for missions with different win conditions.
      Returns:
      true if humans win, false otherwise
    • getPlayerRegistry

      public HvZPlayerRegistry getPlayerRegistry()
      Gets this game's player registry.
      Returns:
      this HvZ game's player registry
    • getGraveyard

      public HvZGraveyard getGraveyard()
      Gets this game's graveyard.
      Returns:
      this HvZ game's graveyard
    • setTimeLimit

      public void setTimeLimit​(int timeLimit)
      Sets the time limit for this game
      Parameters:
      timeLimit - value of time limit
    • getTimeLimit

      public int getTimeLimit()
      Gets the time limit for this game
      Returns:
      time limit of this game
    • onPlayerQuit

      public void onPlayerQuit​(org.bukkit.event.player.PlayerQuitEvent event)