Package fr.mrmicky.fastboard
Class FastBoard
java.lang.Object
fr.mrmicky.fastboard.FastBoard
Lightweight packet-based scoreboard API for Bukkit plugins.
It can be safely used asynchronously as everything is at packet level.
The project is on GitHub.
- Version:
- 1.2.1
- Author:
- MrMicky
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddelete()Delete this FastBoard, and will remove the scoreboard for the associated player if he is online.getId()Get the scoreboard id.getLine(int line) Get the specified scoreboard line.getLines()Get the scoreboard lines.org.bukkit.entity.PlayerGet the player who has the scoreboard.getTitle()Get the scoreboard title.protected booleanReturn if the player has a prefix/suffix characters limit.booleanGet if the scoreboard is deleted.voidremoveLine(int line) Remove a scoreboard line.intsize()Get the scoreboard size (the number of lines).voidupdateLine(int line, String text) Update a single scoreboard line.voidupdateLines(String... lines) Update all the scoreboard lines.voidupdateLines(Collection<String> lines) Update the lines of the scoreboardvoidupdateTitle(String title) Update the scoreboard title.
-
Constructor Details
-
FastBoard
public FastBoard(org.bukkit.entity.Player player) Creates a new FastBoard.- Parameters:
player- the owner of the scoreboard
-
-
Method Details
-
getTitle
Get the scoreboard title.- Returns:
- the scoreboard title
-
updateTitle
Update the scoreboard title.- Parameters:
title- the new scoreboard title- Throws:
IllegalArgumentException- if the title is longer than 32 chars on 1.12 or lowerIllegalStateException- ifdelete()was call before
-
getLines
Get the scoreboard lines.- Returns:
- the scoreboard lines
-
getLine
Get the specified scoreboard line.- Parameters:
line- the line number- Returns:
- the line
- Throws:
IndexOutOfBoundsException- if the line is higher thansize
-
updateLine
Update a single scoreboard line.- Parameters:
line- the line numbertext- the new line text- Throws:
IndexOutOfBoundsException- if the line is higher thansize() + 1
-
removeLine
public void removeLine(int line) Remove a scoreboard line.- Parameters:
line- the line number
-
updateLines
Update all the scoreboard lines.- Parameters:
lines- the new lines- Throws:
IllegalArgumentException- if one line is longer than 30 chars on 1.12 or lowerIllegalStateException- ifdelete()was call before
-
updateLines
Update 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- ifdelete()was call before
-
getPlayer
public org.bukkit.entity.Player getPlayer()Get the player who has the scoreboard.- Returns:
- current player for this FastBoard
-
getId
Get the scoreboard id.- Returns:
- the id
-
isDeleted
public boolean isDeleted()Get if the scoreboard is deleted.- Returns:
- true if the scoreboard is deleted
-
size
public int size()Get the scoreboard size (the number of lines).- Returns:
- the size
-
delete
public void delete()Delete this FastBoard, and will remove the scoreboard for the associated player if he is online. After this, all uses ofupdateLines(java.lang.String...)andupdateTitle(java.lang.String)will throws anIllegalStateException- Throws:
IllegalStateException- if this was already call before
-
hasLinesMaxLength
protected boolean hasLinesMaxLength()Return if the player has a prefix/suffix characters limit. By default, it returns true only in 1.12 or lower. This method can be overridden to fix compatibility with some versions support plugin.- Returns:
- max length
-