Class Location

java.lang.Object
io.sockit.gameserver.Location

public class Location
extends Object
A container for Game rooms. A set of rooms can be grouped into a location
  • Field Details

    • name

      public final String name
      The name of the location
    • game

      public final Game game
      The game to which the location belongs
  • Method Details

    • getFirstRoom

      public final Room getFirstRoom​(RoomType type)
      returns the first room of the given type in this location
      Parameters:
      type - - the type of the room
      Returns:
      Room - the first room of the given type in this location
    • addRoom

      public final boolean addRoom​(Room room)
      adds a room to this location
      Parameters:
      room - - the room to add
      Returns:
      boolean - true if room added successfully else false
    • getRooms

      public final Collection<Room> getRooms​(RoomType roomType)
      returns all the rooms of the given type in this location. Override the compareTo method of the Room class to set the order of the rooms
      Parameters:
      roomType - - the room type
      Returns:
      Collection<Room> - all the rooms of the given type in this location
    • noOfRooms

      public final int noOfRooms()
      returns the total number of rooms in this location
      Returns:
      int - the total number of rooms in this location
    • noOfRooms

      public final int noOfRooms​(RoomType roomType)
      returns the total number of rooms of the given type in this location
      Parameters:
      roomType - - the room type
      Returns:
      int - the total number of rooms of the given type in this location
    • noOfSpectatorsAndPlayers

      public final int noOfSpectatorsAndPlayers()
      returns the total number of spectators and players in the location
      Returns:
      int - the total number of spectators and players in the location
    • noOfPlayers

      public final int noOfPlayers()
      returns the total number of players in the location
      Returns:
      int - the total number of players in the location
    • noOfSpectators

      public final int noOfSpectators()
      returns the total number of spectators in the location
      Returns:
      int - the total number of spectators in the location
    • noOfSpectatorsAndPlayers

      public final int noOfSpectatorsAndPlayers​(RoomType roomtype)
      returns the total number of spectators and players of the given room type in the location
      Parameters:
      roomtype - - the room type
      Returns:
      int - the total number of spectators and players of the given room type in the location
    • noOfPlayers

      public final int noOfPlayers​(RoomType roomtype)
      returns the total number of players of the given room type in the location
      Parameters:
      roomtype - - the room type
      Returns:
      int - the total number of players of the given room type in the location
    • noOfSpectators

      public final int noOfSpectators​(RoomType roomtype)
      returns the total number of spectators of the given room type in the location
      Parameters:
      roomtype - - the room type
      Returns:
      int - the total number of spectators of the given room type in the location
    • isDestroyed

      public boolean isDestroyed()
      returns whether room is destroyed or not
      Returns:
      boolean - true if room is destroyed else false