diff --git a/README.md b/README.md
index 0302c2e..5bb7c2b 100644
--- a/README.md
+++ b/README.md
@@ -4,9 +4,10 @@
[![Maven Central](https://img.shields.io/maven-central/v/fr.mrmicky/fastboard.svg?label=Maven%20Central)](https://central.sonatype.com/artifact/fr.mrmicky/fastboard)
[![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.20 support.
+Lightweight packet-based scoreboard API for Bukkit plugins, with 1.7.10 to 1.20.x support.
-⚠️ To use FastBoard on a 1.8 server, the server must be on 1.8.8.
+> [!IMPORTANT]
+> To use FastBoard on a 1.8 server, the server must be on 1.8.8.
## Features
@@ -20,6 +21,7 @@ Lightweight packet-based scoreboard API for Bukkit plugins, with 1.7.10 to 1.20
* 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
+* No scoreboard scores on 1.20.3 and higher
* [Adventure](https://github.com/KyoriPowered/adventure) components support
## Installation
@@ -57,12 +59,13 @@ Lightweight packet-based scoreboard API for Bukkit plugins, with 1.7.10 to 1.20
fr.mrmicky
fastboard
- 2.0.1
+ 2.0.2
```
-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`).
+> [!NOTE]
+> 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
@@ -76,7 +79,7 @@ repositories {
}
dependencies {
- implementation 'fr.mrmicky:fastboard:2.0.1'
+ implementation 'fr.mrmicky:fastboard:2.0.2'
}
shadowJar {
diff --git a/pom.xml b/pom.xml
index 625b3cb..1afc6f7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
fr.mrmicky
fastboard
- 2.0.1
+ 2.0.2
FastBoard
Lightweight packet-based scoreboard API for Bukkit plugins.
diff --git a/src/main/java/fr/mrmicky/fastboard/FastBoardBase.java b/src/main/java/fr/mrmicky/fastboard/FastBoardBase.java
index 70a553d..e804de8 100644
--- a/src/main/java/fr/mrmicky/fastboard/FastBoardBase.java
+++ b/src/main/java/fr/mrmicky/fastboard/FastBoardBase.java
@@ -32,15 +32,7 @@
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Optional;
+import java.util.*;
import java.util.concurrent.ThreadLocalRandom;
import java.util.stream.Stream;
@@ -51,7 +43,7 @@
* The project is on GitHub.
*
* @author MrMicky
- * @version 2.0.1
+ * @version 2.0.2
*/
public abstract class FastBoardBase {
@@ -78,6 +70,7 @@ public abstract class FastBoardBase {
private static final Class> DISPLAY_SLOT_TYPE;
private static final Class> ENUM_SB_HEALTH_DISPLAY;
private static final Class> ENUM_SB_ACTION;
+ private static final Object BLANK_NUMBER_FORMAT;
private static final Object SIDEBAR_DISPLAY_SLOT;
private static final Object ENUM_SB_HEALTH_DISPLAY_INTEGER;
private static final Object ENUM_SB_ACTION_CHANGE;
@@ -132,13 +125,17 @@ public abstract class FastBoardBase {
Optional> numberFormat = FastReflection.nmsOptionalClass("network.chat.numbers", "NumberFormat");
MethodHandle packetSbSetScore;
MethodHandle packetSbResetScore = null;
+ Object blankNumberFormat = null;
if (numberFormat.isPresent()) { // 1.20.3
+ Class> blankFormatClass = FastReflection.nmsClass("network.chat.numbers", "BlankFormat");
Class> resetScoreClass = FastReflection.nmsClass(gameProtocolPackage, "ClientboundResetScorePacket");
MethodType setScoreType = MethodType.methodType(void.class, String.class, String.class, int.class, CHAT_COMPONENT_CLASS, numberFormat.get());
MethodType removeScoreType = MethodType.methodType(void.class, String.class, String.class);
+ Optional blankField = Arrays.stream(blankFormatClass.getFields()).filter(f -> f.getType() == blankFormatClass).findAny();
packetSbSetScore = lookup.findConstructor(packetSbScoreClass, setScoreType);
packetSbResetScore = lookup.findConstructor(resetScoreClass, removeScoreType);
+ blankNumberFormat = blankField.isPresent() ? blankField.get().get(null) : null;
} else if (VersionType.V1_17.isHigherOrEqual()) {
Class> enumSbAction = FastReflection.nmsClass("server", "ScoreboardServer$Action");
MethodType scoreType = MethodType.methodType(void.class, enumSbAction, String.class, String.class, int.class);
@@ -151,6 +148,7 @@ public abstract class FastBoardBase {
PACKET_SB_RESET_SCORE = packetSbResetScore;
PACKET_SB_TEAM = FastReflection.findPacketConstructor(packetSbTeamClass, lookup);
PACKET_SB_SERIALIZABLE_TEAM = sbTeamClass == null ? null : FastReflection.findPacketConstructor(sbTeamClass, lookup);
+ BLANK_NUMBER_FORMAT = blankNumberFormat;
for (Class> clazz : Arrays.asList(packetSbObjClass, packetSbDisplayObjClass, packetSbScoreClass, packetSbTeamClass, sbTeamClass)) {
if (clazz == null) {
@@ -530,7 +528,7 @@ private void sendModernScorePacket(int score, ScoreboardAction action) throws Th
return;
}
- sendPacket(PACKET_SB_SET_SCORE.invoke(objName, this.id, score, null, null));
+ sendPacket(PACKET_SB_SET_SCORE.invoke(objName, this.id, score, null, BLANK_NUMBER_FORMAT));
}
protected void sendTeamPacket(int score, TeamMode mode) throws Throwable {