Skip to content

Commit

Permalink
Version 2.0 - Add Adventure API support (#29)
Browse files Browse the repository at this point in the history
Closes #7 

Co-authored-by: Emmanuel Lampe <[email protected]>
  • Loading branch information
MrMicky-FR and rexlManu authored Jun 7, 2023
1 parent dcb8dbd commit 4d473fb
Show file tree
Hide file tree
Showing 6 changed files with 793 additions and 539 deletions.
41 changes: 34 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# FastBoard

[![Java CI](https://github.com/MrMicky-FR/FastBoard/actions/workflows/build.yml/badge.svg)](https://github.com/MrMicky-FR/FastBoard/actions/workflows/build.yml)
[![Language grade](https://img.shields.io/lgtm/grade/java/github/MrMicky-FR/FastBoard.svg?logo=lgtm&logoWidth=18&label=code%20quality)](https://lgtm.com/projects/g/MrMicky-FR/FastBoard/context:java)
[![Maven Central](https://img.shields.io/maven-central/v/fr.mrmicky/fastboard.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:%22fr.mrmicky%22%20AND%20a:%22fastboard%22)
[![Discord](https://img.shields.io/discord/390919659874156560.svg?colorB=5865f2&label=Discord&logo=discord&logoColor=white)](https://discord.gg/q9UwaBT)

Lightweight packet-based scoreboard API for Bukkit plugins, with 1.7.10 to 1.19 support.
Lightweight packet-based scoreboard API for Bukkit plugins, with 1.7.10 to 1.20 support.

⚠️ To use FastBoard on a 1.8 server, the server must be on 1.8.8.

## Features

* No flickering (without using a buffer)
* Works with all versions from 1.7.10 to 1.19
* Works with all versions from 1.7.10 to 1.20
* Very small (around 600 lines of code with the JavaDoc) and no dependencies
* Easy to use
* Dynamic scoreboard size: you don't need to add/remove lines, you can directly give a string list (or array) to change all the lines
Expand All @@ -20,6 +20,7 @@ Lightweight packet-based scoreboard API for Bukkit plugins, with 1.7.10 to 1.19
* 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
* [Adventure](https://github.com/KyoriPowered/adventure) components support

## Installation

Expand Down Expand Up @@ -56,24 +57,26 @@ Lightweight packet-based scoreboard API for Bukkit plugins, with 1.7.10 to 1.19
<dependency>
<groupId>fr.mrmicky</groupId>
<artifactId>fastboard</artifactId>
<version>1.2.1</version>
<version>2.0.0</version>
</dependency>
</dependencies>
```

When using Maven, make sure to build directly with Maven and not with your IDE configuration. (on IntelliJ IDEA: in the `Maven` tab on the right, in `Lifecycle`, use `package`).

### Gradle

```groovy
plugins {
id 'com.github.johnrengelman.shadow' version '7.1.2'
id 'com.github.johnrengelman.shadow' version '8.1.1'
}
repositories {
mavenCentral()
}
dependencies {
implementation 'fr.mrmicky:fastboard:1.2.1'
implementation 'fr.mrmicky:fastboard:2.0.0'
}
shadowJar {
Expand All @@ -84,7 +87,7 @@ shadowJar {

### Manual

Copy `FastBoard.java` and `FastReflection.java` in your plugin.
Copy `FastBoardBase.java`, `FastBoard.java` and `FastReflection.java` in your plugin.

## Usage

Expand Down Expand Up @@ -176,3 +179,27 @@ public final class ExamplePlugin extends JavaPlugin implements Listener {
}
}
```

## Adventure support

For servers on modern [PaperMC](https://papermc.io) versions, FastBoard supports
using [Adventure](https://github.com/KyoriPowered/adventure) components instead of strings,
by using the class `fr.mrmicky.fastboard.adventure.FastBoard`.

## RGB colors

When using the non-Adventure version of FastBoard, RGB colors can be added on 1.16 and higher with `ChatColor.of("#RRGGBB")` (`net.md_5.bungee.api.ChatColor` import).

## ViaBackwards compatibility

When using ViaBackwards on a post-1.13 server with pre-1.13 clients, older clients
might get incomplete lines. To solve this issue, you can override the method `hasLinesMaxLength()` and return `true` for older clients.
For example using the ViaVersion API:
```java
FastBoard board = new FastBoard(player) {
@Override
public boolean hasLinesMaxLength() {
return Via.getAPI().getPlayerVersion(getPlayer()) < ProtocolVersion.v1_13.getVersion(); // or just 'return true;'
}
});
```
14 changes: 13 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>fr.mrmicky</groupId>
<artifactId>fastboard</artifactId>
<version>1.2.1</version>
<version>2.0.0</version>

<name>FastBoard</name>
<description>Lightweight packet-based scoreboard API for Bukkit plugins.</description>
Expand Down Expand Up @@ -55,6 +55,18 @@
<version>1.16.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-api</artifactId>
<version>4.13.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-text-serializer-legacy</artifactId>
<version>4.13.0</version>
<scope>provided</scope>
</dependency>
</dependencies>

<repositories>
Expand Down
Loading

0 comments on commit 4d473fb

Please sign in to comment.