Package com.alexlew.gameapi.types
Class Game
- java.lang.Object
-
- com.alexlew.gameapi.util.GameManager
-
- com.alexlew.gameapi.types.Game
-
public class Game extends GameManager
-
-
Constructor Summary
Constructors Constructor Description Game(java.lang.String name)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addPlayer(org.bukkit.entity.Player player)
Add a player to your Game/Teamvoid
addTeam(Team team)
Add a team to your gameGame
delete()
Delete your Game/Teamjava.lang.String
getDisplayName()
java.util.HashMap<java.lang.String,java.lang.String>
getEndMessage()
static Game
getGameOfPlayer(org.bukkit.entity.Player player)
Return the game where the player is.static java.util.HashMap<java.lang.String,Game>
getGames()
java.util.HashMap<java.lang.String,java.lang.String>
getJoinMessage()
The Join Messagejava.util.HashMap<java.lang.String,java.lang.String>
getLeaveMessage()
The Leave Messageorg.bukkit.Location
getLobby()
java.lang.Integer
getMaxPlayer()
java.lang.Integer
getMinPlayer()
java.lang.String
getName()
java.util.List<org.bukkit.entity.Player>
getPlayers()
org.bukkit.Location
getSpawn()
java.lang.Integer
getState()
Team
getTeam(java.lang.String team)
Return a team from its namestatic Team
getTeamOfPlayer(org.bukkit.entity.Player player)
Return the team where the player is.java.util.HashMap<java.lang.String,Team>
getTeams()
java.lang.Integer
getTimer()
java.lang.String
getTimerMessageAs()
java.util.HashMap<java.lang.Integer,java.lang.String>
getTimerMessages()
The Timer MessagesTeam
getWinner()
org.bukkit.World
getWorld()
java.lang.Boolean
hasPlayer(org.bukkit.entity.Player player)
void
removePlayer(org.bukkit.entity.Player player)
Remove a player from your Game/Teamvoid
setDisplayName(java.lang.String displayName)
Set the display name of your Game/Teamvoid
setLobby(org.bukkit.Location lobby)
Set the location of the lobby of your Game/Team.void
setMaxPlayer(java.lang.Integer maxPlayer)
Set the maximum of player that your Game/Team require before startvoid
setMinPlayer(java.lang.Integer minPlayer)
Set the minimum of player that your Game/Team require before startvoid
setName(java.lang.String name)
Set the name of your Game/Teamvoid
setSpawn(org.bukkit.Location spawn)
Set the location of the spawn of your Game/Team.void
setState(java.lang.Integer state)
Set the state of the game: - State 0 --> Waiting - State 1 --> Launch the game - State 2 --> Started/In game - State 3 --> Endedvoid
setTimer(java.lang.Integer timer)
Set the timer before the game starts (in seconds)void
setTimerMessageAs(java.lang.String timerMessageAs)
Set the timer message as title or action barvoid
setWinner(Team winner)
Set the winner of the gamevoid
setWorld(org.bukkit.World world)
Set the world where the game is supposed to be in.void
start()
void
stop()
java.lang.Boolean
teamExists(java.lang.String team)
-
-
-
Method Detail
-
getGames
public static java.util.HashMap<java.lang.String,Game> getGames()
-
getGameOfPlayer
public static Game getGameOfPlayer(org.bukkit.entity.Player player)
Return the game where the player is.- Parameters:
player
- The player that we need to know the game where he is.- Returns:
- The game where is the player
-
getTeamOfPlayer
public static Team getTeamOfPlayer(org.bukkit.entity.Player player)
Return the team where the player is.- Parameters:
player
- The player that we need to know the team where he is.- Returns:
- The team where is the player
-
start
public void start()
-
stop
public void stop()
-
delete
public Game delete()
Description copied from class:GameManager
Delete your Game/Team- Specified by:
delete
in classGameManager
-
getTeams
public java.util.HashMap<java.lang.String,Team> getTeams()
-
getState
public java.lang.Integer getState()
-
setState
public void setState(java.lang.Integer state)
Set the state of the game: - State 0 --> Waiting - State 1 --> Launch the game - State 2 --> Started/In game - State 3 --> Ended- Parameters:
state
- The new state of the game
-
getTeam
public Team getTeam(java.lang.String team)
Return a team from its name- Parameters:
team
- The team which will be return
-
addTeam
public void addTeam(Team team)
Add a team to your game- Parameters:
team
- The team which will be added
-
teamExists
public java.lang.Boolean teamExists(java.lang.String team)
- Parameters:
team
- The team that you need to check existence- Returns:
- If the team exists or not
-
getWorld
public org.bukkit.World getWorld()
- Returns:
- The world where the game is
-
setWorld
public void setWorld(org.bukkit.World world)
Set the world where the game is supposed to be in.- Parameters:
world
- The world where the game will be play
-
getTimer
public java.lang.Integer getTimer()
- Returns:
- The timer before the game starts (in seconds)
-
setTimer
public void setTimer(java.lang.Integer timer)
Set the timer before the game starts (in seconds)- Parameters:
timer
- The new timer before the game starts (in seconds)
-
getTimerMessageAs
public java.lang.String getTimerMessageAs()
- Returns:
- The timer message type (title or action bar)
-
setTimerMessageAs
public void setTimerMessageAs(java.lang.String timerMessageAs)
Set the timer message as title or action bar- Parameters:
timerMessageAs
- The new timer message type
-
getWinner
public Team getWinner()
- Returns:
- The winner of the game
-
setWinner
public void setWinner(Team winner)
Set the winner of the game- Parameters:
winner
- The new winner of the game
-
getJoinMessage
public java.util.HashMap<java.lang.String,java.lang.String> getJoinMessage()
The Join Message- Returns:
- A hashmap of the Join Message
-
getLeaveMessage
public java.util.HashMap<java.lang.String,java.lang.String> getLeaveMessage()
The Leave Message- Returns:
- A hashmap of the Leave Message
-
getTimerMessages
public java.util.HashMap<java.lang.Integer,java.lang.String> getTimerMessages()
The Timer Messages- Returns:
- A hashmap of all messages during the timer
-
getName
public java.lang.String getName()
- Specified by:
getName
in classGameManager
- Returns:
- The name of the Game/Team
-
setName
public void setName(java.lang.String name)
Description copied from class:GameManager
Set the name of your Game/Team- Specified by:
setName
in classGameManager
- Parameters:
name
- The name of your Game/Team
-
getDisplayName
public java.lang.String getDisplayName()
- Specified by:
getDisplayName
in classGameManager
- Returns:
- The display name of your Game/Team
-
setDisplayName
public void setDisplayName(java.lang.String displayName)
Description copied from class:GameManager
Set the display name of your Game/Team- Specified by:
setDisplayName
in classGameManager
- Parameters:
displayName
- The display name of your Game/Team
-
getMinPlayer
public java.lang.Integer getMinPlayer()
- Specified by:
getMinPlayer
in classGameManager
- Returns:
- The minimum of player that your Game/Team require before start
-
setMinPlayer
public void setMinPlayer(java.lang.Integer minPlayer)
Description copied from class:GameManager
Set the minimum of player that your Game/Team require before start- Specified by:
setMinPlayer
in classGameManager
- Parameters:
minPlayer
- The minimum of player that your Game/Team require before start
-
getMaxPlayer
public java.lang.Integer getMaxPlayer()
- Specified by:
getMaxPlayer
in classGameManager
- Returns:
- The maximum of player that your Game/Team require before start
-
setMaxPlayer
public void setMaxPlayer(java.lang.Integer maxPlayer)
Description copied from class:GameManager
Set the maximum of player that your Game/Team require before start- Specified by:
setMaxPlayer
in classGameManager
- Parameters:
maxPlayer
- The maximum of player that your Game/Team require before start
-
getLobby
public org.bukkit.Location getLobby()
- Specified by:
getLobby
in classGameManager
- Returns:
- Lobby of your Game/Team
-
setLobby
public void setLobby(org.bukkit.Location lobby)
Description copied from class:GameManager
Set the location of the lobby of your Game/Team. It's where players join your Game/Team.- Specified by:
setLobby
in classGameManager
- Parameters:
lobby
- Lobby of your Game/Team
-
getSpawn
public org.bukkit.Location getSpawn()
- Specified by:
getSpawn
in classGameManager
- Returns:
- The spawn of your Game/Team
-
setSpawn
public void setSpawn(org.bukkit.Location spawn)
Description copied from class:GameManager
Set the location of the spawn of your Game/Team. It's where players will be teleported when they will join your Game/Team.- Specified by:
setSpawn
in classGameManager
- Parameters:
spawn
- The spawn of your Game/Team
-
getPlayers
public java.util.List<org.bukkit.entity.Player> getPlayers()
- Specified by:
getPlayers
in classGameManager
- Returns:
- Players in your Game/Team
-
addPlayer
public void addPlayer(org.bukkit.entity.Player player)
Description copied from class:GameManager
Add a player to your Game/Team- Specified by:
addPlayer
in classGameManager
- Parameters:
player
- The player who will join the Game/Team
-
removePlayer
public void removePlayer(org.bukkit.entity.Player player)
Description copied from class:GameManager
Remove a player from your Game/Team- Specified by:
removePlayer
in classGameManager
- Parameters:
player
- The player who will leave the Game/Team
-
hasPlayer
public java.lang.Boolean hasPlayer(org.bukkit.entity.Player player)
- Specified by:
hasPlayer
in classGameManager
- Parameters:
player
- The player to check if he is in the Game/Team- Returns:
- If the player is in your Game/Team or not
-
getEndMessage
public java.util.HashMap<java.lang.String,java.lang.String> getEndMessage()
-
-