FastBoard Documentation

repository·master·Indexed 20 days ago

https://github.com/mrmicky-fr/fastboard

A lightweight, packet-based, flicker-free, and dependency-free scoreboard API for Bukkit plugins. Compatible with Minecraft versions as old as 1.7.10, it supports Adventure components on modern PaperMC servers and RGB HEX colors for Minecraft 1.16+. Version 2.2.0 includes support for custom number formatting for scores on Minecraft 1.20.3 and higher.

Tokens
1.6K
Snippets
4
Records
8
Agent score
19%

What's inside FastBoard

  1. Use Adventure components with FastBoard

    master

    On modern PaperMC servers, you can use Adventure components instead of standard strings. To do this, use the fr.mrmicky.fastboard.adventure.FastBoard class.

    Warning: On servers below Minecraft 1.13, lines using Adventure components are truncated to a maximum of 16 characters. For older versions, use the standard fr.mrmicky.fastboard.FastBoard class.

  2. Install FastBoard via Gradle

    master

    To use FastBoard in a Gradle project, add the dependency and use the com.gradleup.shadow plugin to relocate the fr.mrmicky.fastboard package to your own plugin's package to prevent classpath conflicts.

    plugins {
        id 'com.gradleup.shadow' version '8.3.0'
    }
    
    repositories {
        mavenCentral()
    }
    
    dependencies {
        implementation 'fr.mrmicky:fastboard:2.2.0'
    }
    
    shadowJar {
        // Replace 'com.yourpackage' with the package of your plugin 
        relocate 'fr.mrmicky.fastboard', 'com.yourpackage.fastboard'
    }
  3. Install FastBoard via Maven

    master

    To use FastBoard in a Maven project, add the dependency to your pom.xml. It is highly recommended to use the maven-shade-plugin to relocate the fr.mrmicky.fastboard package to your own plugin's package to avoid conflicts with other plugins using FastBoard.

    <dependencies>
        <dependency>
            <groupId>fr.mrmicky</groupId>
            <artifactId>fastboard</artifactId>
            <version>2.2.0</version>
        </dependency>
    </dependencies>
    
    <!-- Recommended: Relocate the package using maven-shade-plugin -->
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.3.0</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <relocations>
                        <relocation>
                            <pattern>fr.mrmicky.fastboard</pattern>
                            <!-- Replace 'com.yourpackage' with the package of your plugin -->
                            <shadedPattern>com.yourpackage.fastboard</shadedPattern>
                        </relocation>
                    </relocations>
                </configuration>
            </plugin>
        </plugins>
    </build>
  4. Fix incomplete lines for ViaBackwards users

    master

    If you are running a post-1.13 server with ViaBackwards and users on pre-1.13 clients are receiving incomplete lines, you can override the hasLinesMaxLength() method in the FastBoard constructor to return true for those clients.

    FastBoard board = new FastBoard(player) {
        @Override
        public boolean hasLinesMaxLength() {
            // Example using ViaVersion API
            return Via.getAPI().getPlayerVersion(getPlayer()) < ProtocolVersion.v1_13.getVersion();
            // Or simply:
            // return true;
        }
    };
  5. Configure custom number formatting for scores

    master

    On Minecraft 1.20.3 and higher, FastBoard supports custom number formatting for scores. By default, scores are blank (not visible). You can customize them using the following methods:

    • FastBoard#updateLine(line, text, scoreText)
    • FastBoard#updateLines(lines, scores)
    • FastBoard#updateScore(line, text)

    Passing null as a score value will reset the line to the default blank formatting.

  6. Create and update a scoreboard

    master

    To use FastBoard, instantiate a new FastBoard object for a specific Player. You can then update the scoreboard title using updateTitle and the lines using updateLines. updateLines accepts a list or array of strings, allowing for a dynamic number of lines without manually adding or removing them.

    FastBoard board = new FastBoard(player);
    
    // Set the title
    board.updateTitle(ChatColor.GOLD + "FastBoard");
    
    // Change the lines
    board.updateLines(
            "", // Empty line
            "One line",
            "",
            "Second line"
    );