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 voidaddPlayer(org.bukkit.entity.Player player)Add a player to your Game/TeamvoidaddTeam(Team team)Add a team to your gameGamedelete()Delete your Game/Teamjava.lang.StringgetDisplayName()java.util.HashMap<java.lang.String,java.lang.String>getEndMessage()static GamegetGameOfPlayer(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.LocationgetLobby()java.lang.IntegergetMaxPlayer()java.lang.IntegergetMinPlayer()java.lang.StringgetName()java.util.List<org.bukkit.entity.Player>getPlayers()org.bukkit.LocationgetSpawn()java.lang.IntegergetState()TeamgetTeam(java.lang.String team)Return a team from its namestatic TeamgetTeamOfPlayer(org.bukkit.entity.Player player)Return the team where the player is.java.util.HashMap<java.lang.String,Team>getTeams()java.lang.IntegergetTimer()java.lang.StringgetTimerMessageAs()java.util.HashMap<java.lang.Integer,java.lang.String>getTimerMessages()The Timer MessagesTeamgetWinner()org.bukkit.WorldgetWorld()java.lang.BooleanhasPlayer(org.bukkit.entity.Player player)voidremovePlayer(org.bukkit.entity.Player player)Remove a player from your Game/TeamvoidsetDisplayName(java.lang.String displayName)Set the display name of your Game/TeamvoidsetLobby(org.bukkit.Location lobby)Set the location of the lobby of your Game/Team.voidsetMaxPlayer(java.lang.Integer maxPlayer)Set the maximum of player that your Game/Team require before startvoidsetMinPlayer(java.lang.Integer minPlayer)Set the minimum of player that your Game/Team require before startvoidsetName(java.lang.String name)Set the name of your Game/TeamvoidsetSpawn(org.bukkit.Location spawn)Set the location of the spawn of your Game/Team.voidsetState(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 --> EndedvoidsetTimer(java.lang.Integer timer)Set the timer before the game starts (in seconds)voidsetTimerMessageAs(java.lang.String timerMessageAs)Set the timer message as title or action barvoidsetWinner(Team winner)Set the winner of the gamevoidsetWorld(org.bukkit.World world)Set the world where the game is supposed to be in.voidstart()voidstop()java.lang.BooleanteamExists(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:GameManagerDelete your Game/Team- Specified by:
deletein 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:
getNamein classGameManager- Returns:
- The name of the Game/Team
-
setName
public void setName(java.lang.String name)
Description copied from class:GameManagerSet the name of your Game/Team- Specified by:
setNamein classGameManager- Parameters:
name- The name of your Game/Team
-
getDisplayName
public java.lang.String getDisplayName()
- Specified by:
getDisplayNamein classGameManager- Returns:
- The display name of your Game/Team
-
setDisplayName
public void setDisplayName(java.lang.String displayName)
Description copied from class:GameManagerSet the display name of your Game/Team- Specified by:
setDisplayNamein classGameManager- Parameters:
displayName- The display name of your Game/Team
-
getMinPlayer
public java.lang.Integer getMinPlayer()
- Specified by:
getMinPlayerin 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:GameManagerSet the minimum of player that your Game/Team require before start- Specified by:
setMinPlayerin classGameManager- Parameters:
minPlayer- The minimum of player that your Game/Team require before start
-
getMaxPlayer
public java.lang.Integer getMaxPlayer()
- Specified by:
getMaxPlayerin 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:GameManagerSet the maximum of player that your Game/Team require before start- Specified by:
setMaxPlayerin classGameManager- Parameters:
maxPlayer- The maximum of player that your Game/Team require before start
-
getLobby
public org.bukkit.Location getLobby()
- Specified by:
getLobbyin classGameManager- Returns:
- Lobby of your Game/Team
-
setLobby
public void setLobby(org.bukkit.Location lobby)
Description copied from class:GameManagerSet the location of the lobby of your Game/Team. It's where players join your Game/Team.- Specified by:
setLobbyin classGameManager- Parameters:
lobby- Lobby of your Game/Team
-
getSpawn
public org.bukkit.Location getSpawn()
- Specified by:
getSpawnin classGameManager- Returns:
- The spawn of your Game/Team
-
setSpawn
public void setSpawn(org.bukkit.Location spawn)
Description copied from class:GameManagerSet 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:
setSpawnin classGameManager- Parameters:
spawn- The spawn of your Game/Team
-
getPlayers
public java.util.List<org.bukkit.entity.Player> getPlayers()
- Specified by:
getPlayersin classGameManager- Returns:
- Players in your Game/Team
-
addPlayer
public void addPlayer(org.bukkit.entity.Player player)
Description copied from class:GameManagerAdd a player to your Game/Team- Specified by:
addPlayerin classGameManager- Parameters:
player- The player who will join the Game/Team
-
removePlayer
public void removePlayer(org.bukkit.entity.Player player)
Description copied from class:GameManagerRemove a player from your Game/Team- Specified by:
removePlayerin classGameManager- Parameters:
player- The player who will leave the Game/Team
-
hasPlayer
public java.lang.Boolean hasPlayer(org.bukkit.entity.Player player)
- Specified by:
hasPlayerin 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()
-
-