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
Modifier and TypeClassDescriptionclass
Team which used in TeamBattleMiniGame frame
Manage: teamName, maxMemberCount, members, colorstatic class
Team 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
ConstructorDescriptionTeamBattleMiniGame(String title, int minPlayers, int maxPlayers, int playTime, int waitingTime)
maxPlayers is sum of all teams member size -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Registers team to listprotected void
createTeam(TeamBattleMiniGame.Team... teams)
Registers teams to listprotected void
Creates team with overriding this methodGets minigame frame type (e.g.protected int
Gets live teams countprotected List<TeamBattleMiniGame.Team>
Gets live teamsprotected TeamBattleMiniGame.Team
Gets team which has maximum team player countprotected TeamBattleMiniGame.Team
Gets team which has minimum player countprotected TeamBattleMiniGame.Team
Gets random teamprotected TeamBattleMiniGame.Team
getRandomTeam(List<TeamBattleMiniGame.Team> teams)
Gets random team in given listprotected TeamBattleMiniGame.Team
getTeam(int teamNumber)
Gets teamprotected TeamBattleMiniGame.Team
Gets teamprotected TeamBattleMiniGame.Team
getTeam(org.bukkit.entity.Player p)
Gets player's teamprotected int
Gets all team countint
Gets team register modegetTeams()
Gets all team listprotected int
getTeamScore(int teamNumber)
Gets team score with indexprotected int
getTeamScore(String teamName)
Gets team score with team nameprotected int
getTeamScore(org.bukkit.entity.Player p)
Gets score of team which player belongsint
Get team sizeprotected boolean
hasTeam(org.bukkit.entity.Player p)
Check player has team or notprotected void
initGame()
Executed every time when game startsprotected boolean
Check group chat is enabledprotected boolean
Counting unit changed: "player" to "team"
[IMPORTANT] Must overrideMiniGame.isLessThanPlayersLeft()
, because will be checked inMiniGame.checkGameFinishCondition()
andMiniGamePlayer.setLive(boolean)
protected boolean
Counting unit changed: "player" to "team"
[IMPORTANT] Must overrideMiniGame.isLessThanPlayersLive()
, because will be checked inMiniGame.checkGameFinishCondition()
andMiniGamePlayer.setLive(boolean)
protected boolean
Same with theisLessThanPlayersLeft()
protected boolean
Same with theisLessThanPlayersLive()
protected boolean
Counting unit changed: "player" to "team"
[IMPORTANT] Must overrideMiniGame.isMoreThanPlayersLive()
, because will be checked inMiniGame.checkGameFinishCondition()
andMiniGamePlayer.setLive(boolean)
protected boolean
Same with theisMoreThanPlayersLive()
protected boolean
isSameTeam(org.bukkit.entity.Player p1, org.bukkit.entity.Player p2)
Check two team is the same teamprotected boolean
Check team pvp is enabledprotected void
minusTeamScore(int teamNumber, int amount)
Minus team score with team indexprotected void
minusTeamScore(String teamName, int amount)
Minus team score with team nameprotected void
minusTeamScore(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 void
onChat(org.bukkit.event.player.AsyncPlayerChatEvent e)
protected void
onException(MiniGameExceptionEvent exception)
Called only in play state and when exception is passed
Exception
protected void
onStart()
Executed immediately after game startedprotected void
onTeamPvp(org.bukkit.event.entity.EntityDamageByEntityEvent e)
protected void
plusTeamScore(int teamNumber, int amount)
Plus team score with team indexprotected void
plusTeamScore(String teamName, int amount)
Plus team score with team nameprotected void
plusTeamScore(org.bukkit.entity.Player p, int amount)
Plus score of the team which player belongsprotected void
Print scores to all players
Can print format differently depending on game typeList<? extends MiniGameRank>
rank()
Gets team rankprotected void
Registers players to team if TeamRegisterMode is NONEprotected void
registerPlayerToMaxPlayerCountTeam(org.bukkit.entity.Player p)
Registers player to team which has maximum player countprotected void
registerPlayerToMinPlayerCountTeam(org.bukkit.entity.Player p)
Registers player to team which has minimum player countprotected void
registerPlayerToRandomTeam(org.bukkit.entity.Player p)
Registers player to random teamprotected boolean
registerPlayerToTeam(org.bukkit.entity.Player p, int teamNumber)
Registers player to team with indexprotected boolean
registerPlayerToTeam(org.bukkit.entity.Player p, TeamBattleMiniGame.Team team)
Registers player to team with team instanceprotected boolean
registerPlayerToTeam(org.bukkit.entity.Player p, String teamName)
Registers player to team with nameprotected void
Remove team from playing minigameprotected void
setGroupChat(boolean groupChat)
Sets group chatprotected 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 otherprotected void
setTeamRegisterMode(TeamBattleMiniGame.TeamRegisterMode teamRegisterMode)
Sets team register modeprotected void
setTeamSize(int teamSize)
Set team size
Example) max-players: 10, team-size: 2 -> There are 5 teamsprotected boolean
unregisterPlayerFromTeam(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:
isLessThanPlayersLive
in 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:
isMoreThanPlayersLive
in 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:
isLessThanPlayersLeft
in 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:MiniGame
Executed every time when game starts -
createTeams
protected void createTeams()Creates team with overriding this method -
onStart
protected void onStart()Description copied from class:MiniGame
Executed 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:MiniGame
Print scores to all players
Can print format differently depending on game type- Overrides:
printScores
in classMiniGame
-
rank
Gets team rank -
onException
Description copied from class:MiniGame
Called only in play state and when exception is passed
Exception
- Overrides:
onException
in classMiniGame
-
frameType
Description copied from class:MiniGame
Gets minigame frame type (e.g. "Solo", "SoloBattle", "Team", "TeamBattle")
Override this method for custom frame minigame class- Overrides:
frameType
in classMiniGame
- Returns:
- Minigame frame type
- See Also:
SoloMiniGame
,SoloBattleMiniGame
,TeamMiniGame
,TeamBattleMiniGame
-