Skip to content

Powerful feature-packed Minecraft scoreboard library

License

Notifications You must be signed in to change notification settings

MiniPlaceholders/ProtocolSidebar

 
 

Repository files navigation

ProtocolSidebar

Build Status Sonatype Nexus (Snapshots) Build Status

Unleash the power of your Minecraft server's scoreboard with ProtocolSidebar - the ultimate non-flickering, feature-packed sidebar library.

Requires ProtocolLib. Optionally supports ViaVersion.

Production warning ⚠️

This library is still in active development, so it may contain bugs and/or breaking changes. Not recommended for production use. Stable version will be available on Maven Central as soon as possible. Contributions are welcome.

Sidebar

Features

  • No flickering (without using a buffer)
  • Easy to use
  • Optionally supports Adventure API, MiniMessage
  • Extremely fast, can be used asynchronously
  • Cool inbuilt animations
  • Inbuilt pager for showing multiple sidebars to the player
  • Automatic score management system: sidebar reorders lines automatically
  • Everything is at the packet level, so it works with other plugins using scoreboard and/or teams
  • Supports up to 30 characters per line on 1.12.2 and below
  • No character limit on 1.13 and higher
  • Supports hex colors on 1.16 and higher

Adding to your project

Maven

<repository>
    <id>sonatype-snapshots</id>
    <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
</repository>
<dependency>
    <groupId>me.catcoder</groupId>
    <artifactId>bukkit-sidebar</artifactId>
    <version>6.1.2-SNAPSHOT</version>
</dependency>

Gradle

repositories {
    maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
}
dependencies {
    implementation 'me.catcoder:bukkit-sidebar:6.1.2-SNAPSHOT'
}

Gradle (Kotlin DSL)

repositories {
    maven("https://oss.sonatype.org/content/repositories/snapshots/")
}
dependencies {
    implementation("me.catcoder:bukkit-sidebar:6.1.2-SNAPSHOT")
}

Basic usage

// create sidebar which uses Adventure API
// you can also use other methods from ProtocolSidebar class
// for another text providers such as BungeeCord Chat, MiniMessage...
Sidebar<Component> sidebar = ProtocolSidebar.newAdventureSidebar(
        TextIterators.textFadeHypixel("SIDEBAR"), this);

// let's add some lines
sidebar.addLine(
    Component
        .text("Just a static line")
        .color(NamedTextColor.GREEN));
// add an empty line
sidebar.addBlankLine();
// also you can add updatable lines which applies to all players
sidebar.addUpdatableLine(
    player -> Component
        .text("Your Hunger: ")
        .append(Component.text(
                player.getFoodLevel())
        .color(NamedTextColor.GREEN))
    );

sidebar.addBlankLine();
sidebar.addUpdatableLine(
    player -> Component
        .text("Your Health: ")
        .append(Component.text(
                player.getHealth())
        .color(NamedTextColor.GREEN))
);
sidebar.addBlankLine();
sidebar.addLine(
    Component
        .text("https://github.com/CatCoderr/ProtocolSidebar")
        .color(NamedTextColor.YELLOW
));

// update all lines every 10 ticks
sidebar.updateLinesPeriodically(0, 10);

// ...

// show to the player
sidebar.addViewer(player);
// ...hide from the player
sidebar.removeViewer(player);

More examples available here.

Example

Sidebar title animations

Library has built-in title animations, but you can also create your own. Hypixel-like animation

Animations also can be used in updatable lines:

TextIterator animation = TextIterators.textFadeHypixel("Hello World!");
SidebarLine<?> line = sidebar.addUpdatableLine(sidebar.asLineUpdater(animation));

line.updatePeriodically(0, 1, sidebar);

Sidebar Pager

You can also use sidebar pager, which allows you to show player multiple pages of information.

Sidebar<Component> anotherSidebar = ProtocolSidebar.newAdventureSidebar(
        TextIterators.textFadeHypixel("ANOTHER SIDEBAR"), this);

Sidebar<Component> firstSidebar = ProtocolSidebar.newAdventureSidebar(
        TextIterators.textFadeHypixel("SIDEBAR"), this);

SidebarPager<Component> pager = new SidebarPager<>(
        Arrays.asList(firstSidebar, anotherSidebar), 20 * 5, this);

// add page status line to all sidebars in pager
pager.addPageLine((page, maxPage, sidebar) ->
        sidebar.addLine(Component
            .text("Page " + page + "/" + maxPage)
            .color(NamedTextColor.GREEN)));

pager.applyToAll(Sidebar::addBlankLine);

// ...add some lines
        
// show to player
pager.show(player);

// ...
// hide from the player
pager.hide(player);

Pager example

About

Powerful feature-packed Minecraft scoreboard library

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 96.7%
  • Shell 3.3%