Class FastBoardBase<T>
java.lang.Object
fr.mrmicky.fastboard.FastBoardBase<T>
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumstatic enumstatic enum -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedFastBoardBase(org.bukkit.entity.Player player) Creates a new FastBoard. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns whether the server supports custom scoreboard scores (1.20.3+ servers only).voiddelete()Deletes this FastBoard and removes the scoreboard from the associated player if they are online.protected abstract TgetId()Returns the scoreboard ID.getLine(int line) Returns the specified scoreboard line.protected TgetLineByScore(int score) protected TgetLineByScore(List<T> lines, int score) getLines()Returns the scoreboard lines.org.bukkit.entity.PlayerReturns the player who has the scoreboard.getScore(int line) Returns how a specific line's score is displayed.protected intgetScoreByLine(int line) getTitle()Returns the scoreboard title.booleanReturns whether this FastBoard has been deleted.voidremoveLine(int line) Removes a scoreboard line.voidremoveScore(int line) Resets a line's score back to default (blank).protected voidsendDisplayObjectivePacket(Object objective) protected abstract voidsendLineChange(int score) protected Objectprotected voidsendScorePacket(int score, FastBoardBase.ScoreboardAction action) protected voidsendTeamPacket(int score, FastBoardBase.TeamMode mode) protected voidsendTeamPacket(int score, FastBoardBase.TeamMode mode, T prefix, T suffix) protected abstract StringserializeLine(T value) intsize()Returns the scoreboard size (the number of lines).protected abstract ObjecttoMinecraftComponent(T value) voidupdateLine(int line, T score) Updates a single scoreboard line.voidupdateLine(int line, T score, T scoreText) Updates a single scoreboard line including how its score is displayed.voidupdateLines(Collection<T> lines) Updates the lines of the scoreboard.voidupdateLines(Collection<T> lines, Collection<T> scores) Updates the lines and how their score is displayed on the scoreboard.voidupdateLines(T... lines) Updates all the scoreboard lines.voidupdateScore(int line, T score) Updates how a specified line's score is displayed on the scoreboard.voidupdateScores(Collection<T> scores) Updates how all lines' scores are displayed.voidupdateScores(T... scores) Updates how all lines' scores are displayed.voidupdateTitle(T title) Updates the scoreboard title.
-
Field Details
-
COLOR_CODES
-
-
Constructor Details
-
FastBoardBase
protected FastBoardBase(org.bukkit.entity.Player player) Creates a new FastBoard.- Parameters:
player- the owner of the scoreboard
-
-
Method Details
-
getTitle
-
updateTitle
Updates the scoreboard title.- Parameters:
title- the new scoreboard title- Throws:
IllegalArgumentException- if the title is longer than 32 chars on 1.12 or lower
-
getLines
-
getLine
Returns the specified scoreboard line.- Parameters:
line- the line number- Returns:
- the line
- Throws:
IllegalArgumentException- if the line number is out of range
-
getScore
Returns how a specific line's score is displayed. On 1.20.2 or below, the value returned isn't used.- Parameters:
line- the line number- Returns:
- the text of how the line is displayed
- Throws:
IllegalArgumentException- if the line number is out of range
-
updateLine
Updates a single scoreboard line.- Parameters:
line- the line numberscore- the new line text- Throws:
IllegalArgumentException- if the line number is out of range
-
updateLine
Updates a single scoreboard line including how its score is displayed. The score will only be displayed on 1.20.3 and higher.- Parameters:
line- the line numberscore- the new line textscoreText- the new line score, or null to use the default blank score- Throws:
IllegalArgumentException- if the line number is out of range
-
removeLine
public void removeLine(int line) Removes a scoreboard line.- Parameters:
line- the line number
-
updateLines
Updates all the scoreboard lines.- Parameters:
lines- the new lines- Throws:
IllegalArgumentException- if one line is longer than 30 chars on 1.12 or lowerIllegalStateException- if this FastBoard has already been deleted
-
updateLines
Updates the lines of the scoreboard.- Parameters:
lines- the new scoreboard lines- Throws:
IllegalArgumentException- if one line is longer than 30 chars on 1.12 or lowerIllegalStateException- if this FastBoard has already been deleted
-
updateLines
Updates the lines and how their score is displayed on the scoreboard. The scores will only be displayed for servers on 1.20.3 and higher.- Parameters:
lines- the new scoreboard linesscores- the custom score text for each line, or null to use the default blank scores- Throws:
IllegalArgumentException- if one line is longer than 30 chars on 1.12 or lowerIllegalArgumentException- if lines and scores are not the same sizeIllegalStateException- if this FastBoard has already been deleted
-
updateScore
Updates how a specified line's score is displayed on the scoreboard. A null value will reset the displayed text back to default. The scores will only be displayed for servers on 1.20.3 and higher.- Parameters:
line- the line numberscore- the new line score, or null to use the default blank score- Throws:
IllegalArgumentException- if the line number is not in rangeIllegalStateException- if this FastBoard has already been deleted
-
removeScore
public void removeScore(int line) Resets a line's score back to default (blank). The score will only be displayed for servers on 1.20.3 and higher.- Parameters:
line- the line number- Throws:
IllegalArgumentException- if the line number is not in rangeIllegalStateException- if this FastBoard has already been deleted
-
updateScores
Updates how all lines' scores are displayed. A value of null will reset the displayed text back to default. The scores will only be displayed for servers on 1.20.3 and higher.- Parameters:
scores- the custom score texts for the lines, or null to use the default blank scores- Throws:
IllegalArgumentException- if the size of the texts does not match the current size of the boardIllegalStateException- if this FastBoard has already been deleted
-
updateScores
Updates how all lines' scores are displayed. A null value will reset the displayed text back to default (blank). Only available on 1.20.3+ servers.- Parameters:
scores- the set of texts to be displayed as the scores- Throws:
IllegalArgumentException- if the size of the texts does not match the current size of the boardIllegalStateException- if this FastBoard has already been deleted
-
getPlayer
public org.bukkit.entity.Player getPlayer()Returns the player who has the scoreboard.- Returns:
- current player for this FastBoard
-
getId
-
isDeleted
public boolean isDeleted()Returns whether this FastBoard has been deleted.- Returns:
- true if the scoreboard is deleted
-
customScoresSupported
public boolean customScoresSupported()Returns whether the server supports custom scoreboard scores (1.20.3+ servers only).- Returns:
- true if the server supports custom scores
-
size
public int size()Returns the scoreboard size (the number of lines).- Returns:
- the size
-
delete
public void delete()Deletes this FastBoard and removes the scoreboard from the associated player if they are online. After deletion, all scoreboard update methods will throw anIllegalStateException. -
sendLineChange
-
toMinecraftComponent
-
serializeLine
-
emptyLine
-
getScoreByLine
protected int getScoreByLine(int line) -
getLineByScore
-
getLineByScore
-
sendObjectivePacket
- Throws:
Throwable
-
sendDisplayObjectivePacket
-
sendScorePacket
- Throws:
Throwable
-
sendTeamPacket
- Throws:
Throwable
-
sendTeamPacket
protected void sendTeamPacket(int score, FastBoardBase.TeamMode mode, T prefix, T suffix) throws Throwable - Throws:
Throwable
-