You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PrismaticAPI is a Bukkit/Paper text-formatting library focused on RGB colors, gradients, rainbow effects, MiniMessage compatibility, and legacy fallback.
3
+
PrismaticAPI is a Bukkit/Paper text-formatting library for RGB colors, gradients, rainbows, MiniMessage-aware parsing and legacy-safe fallback.
4
4
5
-
It is designed for plugin code that needs one formatting pipeline but multiple output forms:
5
+
Version `1.4.0` reorganizes the public API around two facades backed by the same formatting engine:
6
6
7
-
- Plain legacy strings for `Player#sendMessage(...)`
8
-
- Adventure components when MiniMessage is available
9
-
- Automatic downsampling for older client versions through VNC
The old top-level methods such as `PrismaticAPI.colorize(...)` and `PrismaticAPI.applyGradient(...)` still exist and now delegate to `legacy()` for compatibility.
12
11
13
-
- Multiple RGB syntaxes in one parser
14
-
- Gradient and rainbow tags
15
-
- Optional MiniMessage integration
16
-
-`RichText` results when you want both component and legacy output
17
-
- Version-aware fallback using VNC and ViaVersion-aware player checks
12
+
## What Changed In 1.4.0
18
13
19
-
## Formatting pipeline
14
+
- Added `PrismaticAPI.legacy()` as the always-safe string formatter facade.
15
+
- Added `PrismaticAPI.adventure()` as the optional Adventure formatter facade.
16
+
- Added `PrismaticAPI.isAdventureAvailable()` to guard Adventure-only code paths.
17
+
- Removed `RichText`.
18
+
- Removed `colorizeText(...)`, `applyColorText(...)`, `applyGradientText(...)` and `applyRainbowText(...)`.
19
+
- Kept the existing legacy top-level helpers as compatibility delegates to `legacy()`.
20
20
21
-
`PrismaticAPI` processes text in this order:
21
+
## Features
22
22
23
-
1. MiniMessage, when Adventure MiniMessage is present at runtime
24
-
2. Prismatic multi-color blocks such as gradients and rainbows
25
-
3. Single RGB color syntaxes
26
-
4. Legacy ampersand formatting such as `&a`, `&l`, and `&r`
23
+
- One formatting engine for legacy strings and Adventure components.
24
+
- Multiple single-color RGB syntaxes.
25
+
- Gradient and rainbow tags.
26
+
- Optional MiniMessage support at runtime.
27
+
- Player-aware legacy fallback through VNC/ViaVersion support.
28
+
- Safe startup on runtimes where Adventure is not present.
27
29
28
-
This keeps MiniMessage and Prismatic tags from stepping on each other while still producing a final legacy string for Bukkit APIs.
30
+
## Coordinates
31
+
32
+
```text
33
+
groupId: me.croabeast
34
+
artifactId: PrismaticAPI
35
+
version: 1.4.0
36
+
```
29
37
30
-
## Supported formats
38
+
Add the repository that hosts your published artifact, then depend on `me.croabeast:PrismaticAPI:1.4.0`.
39
+
40
+
If your plugin calls `PrismaticAPI.adventure()`, keep the Adventure API on your compile classpath and ensure the required Adventure runtime classes are present when the plugin starts.
41
+
42
+
## Supported Syntax
31
43
32
44
### Single RGB colors
33
45
@@ -51,86 +63,158 @@ This keeps MiniMessage and Prismatic tags from stepping on each other while stil
51
63
-`<rainbow:1>Hello</rainbow>`
52
64
-`<r:1>Hello</r>`
53
65
54
-
## Quick usage
66
+
### Legacy formatting
67
+
68
+
-`&a`
69
+
-`&l`
70
+
-`&n`
71
+
-`&r`
72
+
73
+
### MiniMessage
74
+
75
+
When Adventure MiniMessage is present at runtime, standard MiniMessage tags can be mixed with Prismatic syntax in the same string.
76
+
77
+
## Formatting Pipeline
55
78
56
-
### 1. Get a legacy string
79
+
PrismaticAPI processes text in this order:
80
+
81
+
1. MiniMessage, when the Adventure runtime is available.
82
+
2. Prismatic multi-color blocks such as gradients and rainbows.
83
+
3. Single RGB syntaxes.
84
+
4. Legacy Bukkit formatting such as `&a`, `&l` and `&r`.
85
+
86
+
This lets MiniMessage and Prismatic tags coexist without forcing Adventure to be present on every runtime.
87
+
88
+
## API Overview
89
+
90
+
### `PrismaticAPI.legacy()`
91
+
92
+
`legacy()` returns `Formatter<String>`, which is always safe to use. It emits Bukkit/Bungee-compatible color-code strings.
When ViaVersion is installed, PrismaticAPI uses the player's effective version to decide whether RGB can be preserved or should be downsampled.
112
+
If Adventure is not available and you call `PrismaticAPI.adventure()` anyway, the method throws `IllegalStateException` with a controlled error message instead of crashing with `NoClassDefFoundError`.
113
+
114
+
### Top-level compatibility methods
72
115
73
-
### 3. Keep both component and legacy output
116
+
The classic entry points still work:
74
117
75
118
```java
76
-
RichText text =PrismaticAPI.colorizeText(player, "<#ff8800>PrismaticAPI");
0 commit comments