Package com.minigameworld.frames
Class TeamBattleMiniGame
java.lang.Object
com.minigameworld.frames.MiniGame
com.minigameworld.frames.TeamBattleMiniGame
- All Implemented Interfaces:
 GameEventListener
[Info]
- Minigame frame players battle with each teams
- min team count: 2 or more
- all teams have the same score
- team util class, methods
 
[Custom Option]
- group-chat: If true, send message only to team members (default: true)
- team-pvp: If true, team members can not attack each other(pvp option have to be set to true), (default: false)
- team-size: Related with
 
[Team Register Mode]
- Participants divied into teams when game starts with mode
- See
 
[Rule]
- Create Teams with createTeams()
- When use initGame(), must call super.initGame()
- If need different team types, override
- If use TeamRegisterMode.NONE, should register players to team with registerPlayersToTeam()
- Minigame frame players battle with each teams
- min team count: 2 or more
- all teams have the same score
- team util class, methods
[Custom Option]
- group-chat: If true, send message only to team members (default: true)
- team-pvp: If true, team members can not attack each other(pvp option have to be set to true), (default: false)
- team-size: Related with
MiniGameSetting.getMaxPlayers(), if
 "max-players" is 12 and "team-size" is 4 then 3 teams will be created.
 (default: 2)[Team Register Mode]
- Participants divied into teams when game starts with mode
- See
TeamBattleMiniGame.TeamRegisterMode [Rule]
- Create Teams with createTeams()
- When use initGame(), must call super.initGame()
- If need different team types, override
createTeams() without
 "super.createTeams()" and create custom teams (e.g. Boss player team vs
 challengers team) (recommended creating teams with teamSize())- If use TeamRegisterMode.NONE, should register players to team with registerPlayersToTeam()
- 
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassTeam which used in TeamBattleMiniGame frame
Manage: teamName, maxMemberCount, members, colorstatic classTeam register mode
- Participants divied into teams when game starts with mode
- If use TeamRegisterMode.NONE, should register players to team with registerPlayersToTeam()
[Team Register Mode]
- NONE, FAIR, FILL, FAIR_FILL, RANDOM or can divide overriding "registerPlayersToTeam()"
- e.g. - 
Field Summary
 - 
Constructor Summary
ConstructorsConstructorDescriptionTeamBattleMiniGame(String title, int minPlayers, int maxPlayers, int playTime, int waitingTime)maxPlayers is sum of all teams member size - 
Method Summary
Modifier and TypeMethodDescriptionprotected voidRegisters team to listprotected voidcreateTeam(TeamBattleMiniGame.Team... teams)Registers teams to listprotected voidCreates team with overriding this methodGets minigame frame type (e.g.protected intGets live teams countprotected List<TeamBattleMiniGame.Team>Gets live teamsprotected TeamBattleMiniGame.TeamGets team which has maximum team player countprotected TeamBattleMiniGame.TeamGets team which has minimum player countprotected TeamBattleMiniGame.TeamGets random teamprotected TeamBattleMiniGame.TeamgetRandomTeam(List<TeamBattleMiniGame.Team> teams)Gets random team in given listprotected TeamBattleMiniGame.TeamgetTeam(int teamNumber)Gets teamprotected TeamBattleMiniGame.TeamGets teamprotected TeamBattleMiniGame.TeamgetTeam(org.bukkit.entity.Player p)Gets player's teamprotected intGets all team countintGets team register modegetTeams()Gets all team listprotected intgetTeamScore(int teamNumber)Gets team score with indexprotected intgetTeamScore(String teamName)Gets team score with team nameprotected intgetTeamScore(org.bukkit.entity.Player p)Gets score of team which player belongsintGet team sizeprotected booleanhasTeam(org.bukkit.entity.Player p)Check player has team or notprotected voidinitGame()Executed every time when game startsprotected booleanCheck group chat is enabledprotected booleanCounting unit changed: "player" to "team"
[IMPORTANT] Must overrideMiniGame.isLessThanPlayersLeft(), because will be checked inMiniGame.checkGameFinishCondition()andMiniGamePlayer.setLive(boolean)protected booleanCounting unit changed: "player" to "team"
[IMPORTANT] Must overrideMiniGame.isLessThanPlayersLive(), because will be checked inMiniGame.checkGameFinishCondition()andMiniGamePlayer.setLive(boolean)protected booleanSame with theisLessThanPlayersLeft()protected booleanSame with theisLessThanPlayersLive()protected booleanCounting unit changed: "player" to "team"
[IMPORTANT] Must overrideMiniGame.isMoreThanPlayersLive(), because will be checked inMiniGame.checkGameFinishCondition()andMiniGamePlayer.setLive(boolean)protected booleanSame with theisMoreThanPlayersLive()protected booleanisSameTeam(org.bukkit.entity.Player p1, org.bukkit.entity.Player p2)Check two team is the same teamprotected booleanCheck team pvp is enabledprotected voidminusTeamScore(int teamNumber, int amount)Minus team score with team indexprotected voidminusTeamScore(String teamName, int amount)Minus team score with team nameprotected voidminusTeamScore(org.bukkit.entity.Player p, int amount)Minus score of the team which player belongsprotected List<TeamBattleMiniGame.Team>Returns not empty(exist one or more players) team listprotected voidonChat(org.bukkit.event.player.AsyncPlayerChatEvent e)protected voidonException(MiniGameExceptionEvent exception)Called only in play state and when exception is passed
Exceptionprotected voidonStart()Executed immediately after game startedprotected voidonTeamPvp(org.bukkit.event.entity.EntityDamageByEntityEvent e)protected voidplusTeamScore(int teamNumber, int amount)Plus team score with team indexprotected voidplusTeamScore(String teamName, int amount)Plus team score with team nameprotected voidplusTeamScore(org.bukkit.entity.Player p, int amount)Plus score of the team which player belongsprotected voidPrint scores to all players
Can print format differently depending on game typeList<? extends MiniGameRank>rank()Gets team rankprotected voidRegisters players to team if TeamRegisterMode is NONEprotected voidregisterPlayerToMaxPlayerCountTeam(org.bukkit.entity.Player p)Registers player to team which has maximum player countprotected voidregisterPlayerToMinPlayerCountTeam(org.bukkit.entity.Player p)Registers player to team which has minimum player countprotected voidregisterPlayerToRandomTeam(org.bukkit.entity.Player p)Registers player to random teamprotected booleanregisterPlayerToTeam(org.bukkit.entity.Player p, int teamNumber)Registers player to team with indexprotected booleanregisterPlayerToTeam(org.bukkit.entity.Player p, TeamBattleMiniGame.Team team)Registers player to team with team instanceprotected booleanregisterPlayerToTeam(org.bukkit.entity.Player p, String teamName)Registers player to team with nameprotected voidRemove team from playing minigameprotected voidsetGroupChat(boolean groupChat)Sets group chatprotected voidsetTeamPVP(boolean teamPvp)Sets team pvp (contains projectile damage)
If true, team members can damage each other
If false, team members can NOT damage each otherprotected voidsetTeamRegisterMode(TeamBattleMiniGame.TeamRegisterMode teamRegisterMode)Sets team register modeprotected voidsetTeamSize(int teamSize)Set team size
Example) max-players: 10, team-size: 2 -> There are 5 teamsprotected booleanunregisterPlayerFromTeam(org.bukkit.entity.Player p)Unregisters player from teamMethods inherited from class com.minigameworld.frames.MiniGame
checkGameFinishCondition, className, coloredTitle, containsPlayer, customData, customOption, dataManager, equals, finishGame, gamePlayer, gamePlayers, handleException, id, initCustomData, initSettings, inventoryManager, isActive, isEmpty, isFull, isLive, isSameTemplate, isStarted, joinGame, leaveGame, leftPlayTime, leftWaitingTime, livePlayers, livePlayersCount, loadCustomData, location, locationManager, maxPlayers, minigame, minPlayers, minusEveryoneScore, minusScore, onFinish, onFinishDelay, onJoin, onLeave, onUnview, onView, particle, particle, particles, playerCount, players, playSound, playSounds, playTime, plusEveryoneScore, plusScore, randomPlayer, score, scoreboardManager, sendMessage, sendMessage, sendMessages, sendMessages, sendTitle, sendTitle, sendTitles, sendTitles, setLive, setting, startGame, taskManager, title, titleWithClassName, topPlayer, tutorial, tutorials, updateScoreboard, viewManager, waitingTime 
- 
Constructor Details
- 
TeamBattleMiniGame
public TeamBattleMiniGame(String title, int minPlayers, int maxPlayers, int playTime, int waitingTime)maxPlayers is sum of all teams member size 
 - 
 - 
Method Details
- 
registerPlayersToTeam
protected void registerPlayersToTeam()Registers players to team if TeamRegisterMode is NONE - 
createTeam
Registers team to list- Parameters:
 team- Team to register
 - 
createTeam
Registers teams to list- Parameters:
 teams- Teams to register
 - 
removeTeam
Remove team from playing minigame- Parameters:
 team- Team to remove
 - 
getTeam
Gets team- Parameters:
 teamNumber- Index of list- Returns:
 - Team
 
 - 
getTeam
Gets team- Parameters:
 teamName- Team name- Returns:
 - Team
 
 - 
getTeam
Gets player's team- Parameters:
 p- Target player- Returns:
 - Player team
 
 - 
hasTeam
protected boolean hasTeam(org.bukkit.entity.Player p)Check player has team or not- Parameters:
 p- Player to check- Returns:
 - True if player has a team
 
 - 
isSameTeam
protected boolean isSameTeam(org.bukkit.entity.Player p1, org.bukkit.entity.Player p2)Check two team is the same team- Parameters:
 p1- Player of first teamp2- Player of second team- Returns:
 - True if two team is the same
 
 - 
getRandomTeam
Gets random team- Returns:
 - Random team
 
 - 
getRandomTeam
Gets random team in given list- Parameters:
 teams- Teams to randomize- Returns:
 - Random Team
 
 - 
notEmptyTeamList
Returns not empty(exist one or more players) team list- Returns:
 - Not empty team list
 
 - 
getMinPlayerCountTeam
Gets team which has minimum player count- Returns:
 - Min player count team
 
 - 
getMaxPlayerCountTeam
Gets team which has maximum team player count- Returns:
 - Max player count team
 
 - 
registerPlayerToMinPlayerCountTeam
protected void registerPlayerToMinPlayerCountTeam(org.bukkit.entity.Player p)Registers player to team which has minimum player count- Parameters:
 p- Player to join team
 - 
registerPlayerToMaxPlayerCountTeam
protected void registerPlayerToMaxPlayerCountTeam(org.bukkit.entity.Player p)Registers player to team which has maximum player count- Parameters:
 p- Player to join team
 - 
registerPlayerToRandomTeam
protected void registerPlayerToRandomTeam(org.bukkit.entity.Player p)Registers player to random team- Parameters:
 p- Player to join team
 - 
registerPlayerToTeam
protected boolean registerPlayerToTeam(org.bukkit.entity.Player p, int teamNumber)Registers player to team with index- Parameters:
 p- Player to join teamteamNumber- Team index of list- Returns:
 - True if player join team, or false
 
 - 
registerPlayerToTeam
Registers player to team with name- Parameters:
 p- Player to join teamteamName- Team index of list- Returns:
 - True if player join team, or false
 
 - 
registerPlayerToTeam
Registers player to team with team instance- Parameters:
 p- Player to join teamteam- Team index of list- Returns:
 - True if player join team, or false
 
 - 
unregisterPlayerFromTeam
protected boolean unregisterPlayerFromTeam(org.bukkit.entity.Player p)Unregisters player from team- Parameters:
 p- Player to unregister from team- Returns:
 - True if player is in any team, or false
 
 - 
setTeamRegisterMode
Sets team register mode- Parameters:
 teamRegisterMode- TeamRegisterMode
 - 
getTeamRegisterMode
Gets team register mode- Returns:
 - TeamRegisterMode
 
 - 
setGroupChat
protected void setGroupChat(boolean groupChat)Sets group chat- Parameters:
 groupChat- groupChat
 - 
isGroupChat
protected boolean isGroupChat()Check group chat is enabled- Returns:
 - True if enabled
 
 - 
setTeamPVP
protected void setTeamPVP(boolean teamPvp)Sets team pvp (contains projectile damage)
If true, team members can damage each other
If false, team members can NOT damage each other- Parameters:
 teamPvp- groupChat
 - 
isTeamPvp
protected boolean isTeamPvp()Check team pvp is enabled- Returns:
 - True if enabled
 
 - 
setTeamSize
protected void setTeamSize(int teamSize)Set team size
Example) max-players: 10, team-size: 2 -> There are 5 teams- Parameters:
 teamSize- Team size
 - 
getTeamSize
public int getTeamSize()Get team size- Returns:
 - Team size
 
 - 
getTeamCountLimit
public int getTeamCountLimit() - 
getTeams
Gets all team list- Returns:
 - Team list
 
 - 
getTeamCount
protected int getTeamCount()Gets all team count- Returns:
 - Team count
 
 - 
getLiveTeams
Gets live teams- Returns:
 - Live teams
 
 - 
getLiveTeamCount
protected int getLiveTeamCount()Gets live teams count- Returns:
 - Live teams count
 
 - 
plusTeamScore
protected void plusTeamScore(int teamNumber, int amount)Plus team score with team index- Parameters:
 teamNumber- Team indexamount- Amount to plus
 - 
plusTeamScore
Plus team score with team name- Parameters:
 teamName- Team nameamount- Amount to plus
 - 
plusTeamScore
protected void plusTeamScore(org.bukkit.entity.Player p, int amount)Plus score of the team which player belongs- Parameters:
 p- Team of Playeramount- Amount to plus
 - 
minusTeamScore
protected void minusTeamScore(int teamNumber, int amount)Minus team score with team index- Parameters:
 teamNumber- Team indexamount- Amount to minus
 - 
minusTeamScore
Minus team score with team name- Parameters:
 teamName- Team nameamount- Amount to minus
 - 
minusTeamScore
protected void minusTeamScore(org.bukkit.entity.Player p, int amount)Minus score of the team which player belongs- Parameters:
 p- Team of Playeramount- Amount to minus
 - 
getTeamScore
protected int getTeamScore(int teamNumber)Gets team score with index- Parameters:
 teamNumber- Team index- Returns:
 - Team score
 
 - 
getTeamScore
Gets team score with team name- Parameters:
 teamName- Team name- Returns:
 - Team score
 
 - 
getTeamScore
protected int getTeamScore(org.bukkit.entity.Player p)Gets score of team which player belongs- Parameters:
 p- Team of player- Returns:
 - Team score
 
 - 
isLessThanPlayersLive
protected boolean isLessThanPlayersLive()Counting unit changed: "player" to "team"
[IMPORTANT] Must overrideMiniGame.isLessThanPlayersLive(), because will be checked inMiniGame.checkGameFinishCondition()andMiniGamePlayer.setLive(boolean)- Overrides:
 isLessThanPlayersLivein classMiniGame- Returns:
 - True if 
MiniGame.livePlayersCount()is less thanMiniGameSetting.getGameFinishConditionPlayerCount() 
 - 
isLessThanTeamsLive
protected boolean isLessThanTeamsLive()Same with theisLessThanPlayersLive()- Returns:
 - True if live teams are less than
         
MiniGameSetting.getGameFinishConditionPlayerCount() 
 - 
isMoreThanPlayersLive
protected boolean isMoreThanPlayersLive()Counting unit changed: "player" to "team"
[IMPORTANT] Must overrideMiniGame.isMoreThanPlayersLive(), because will be checked inMiniGame.checkGameFinishCondition()andMiniGamePlayer.setLive(boolean)- Overrides:
 isMoreThanPlayersLivein classMiniGame- Returns:
 - True if 
MiniGame.livePlayersCount()is more thanMiniGameSetting.getGameFinishConditionPlayerCount() 
 - 
isMoreThanTeamsLive
protected boolean isMoreThanTeamsLive()Same with theisMoreThanPlayersLive()- Returns:
 - True if live teams are more than
         
MiniGameSetting.getGameFinishConditionPlayerCount() 
 - 
isLessThanPlayersLeft
protected boolean isLessThanPlayersLeft()Counting unit changed: "player" to "team"
[IMPORTANT] Must overrideMiniGame.isLessThanPlayersLeft(), because will be checked inMiniGame.checkGameFinishCondition()andMiniGamePlayer.setLive(boolean)- Overrides:
 isLessThanPlayersLeftin classMiniGame- Returns:
 - True if 
MiniGame.playerCount()is less thanMiniGameSetting.getGameFinishConditionPlayerCount() 
 - 
isLessThanTeamsLeft
protected boolean isLessThanTeamsLeft()Same with theisLessThanPlayersLeft()- Returns:
 - True if left teams are less than
         
MiniGameSetting.getGameFinishConditionPlayerCount() 
 - 
initGame
protected void initGame()Description copied from class:MiniGameExecuted every time when game starts - 
createTeams
protected void createTeams()Creates team with overriding this method - 
onStart
protected void onStart()Description copied from class:MiniGameExecuted immediately after game started - 
onTeamPvp
protected void onTeamPvp(org.bukkit.event.entity.EntityDamageByEntityEvent e) - 
onChat
protected void onChat(org.bukkit.event.player.AsyncPlayerChatEvent e) - 
printScores
protected void printScores()Description copied from class:MiniGamePrint scores to all players
Can print format differently depending on game type- Overrides:
 printScoresin classMiniGame
 - 
rank
Gets team rank - 
onException
Description copied from class:MiniGameCalled only in play state and when exception is passed
Exception- Overrides:
 onExceptionin classMiniGame
 - 
frameType
Description copied from class:MiniGameGets minigame frame type (e.g. "Solo", "SoloBattle", "Team", "TeamBattle")
Override this method for custom frame minigame class- Overrides:
 frameTypein classMiniGame- Returns:
 - Minigame frame type
 - See Also:
 SoloMiniGame,SoloBattleMiniGame,TeamMiniGame,TeamBattleMiniGame
 
 -