|
24 | 24 | import net.kyori.adventure.key.Key;
|
25 | 25 | import net.kyori.adventure.text.Component;
|
26 | 26 | import net.kyori.adventure.text.JoinConfiguration;
|
| 27 | +import net.kyori.adventure.text.format.Style; |
| 28 | +import net.kyori.adventure.text.minimessage.tag.resolver.Formatter; |
27 | 29 | import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
28 | 30 | import net.thenextlvl.gopaint.GoPaintPlugin;
|
29 | 31 | import net.thenextlvl.gopaint.api.brush.PatternBrush;
|
@@ -250,56 +252,56 @@ public boolean exportSettings(ItemStack itemStack) {
|
250 | 252 |
|
251 | 253 | var lines = new ArrayList<Component>();
|
252 | 254 | lines.add(Component.empty());
|
253 |
| - lines.add(plugin.bundle().component(player, "brush.exported.size", |
254 |
| - Placeholder.parsed("size", String.valueOf(getBrushSize())))); |
| 255 | + lines.add(plugin.bundle().component("brush.exported.size", player, |
| 256 | + Formatter.number("size", getBrushSize()))); |
255 | 257 | if (getBrush() instanceof SprayBrush) {
|
256 |
| - lines.add(plugin.bundle().component(player, "brush.exported.chance", |
257 |
| - Placeholder.parsed("chance", String.valueOf(getChance())))); |
| 258 | + lines.add(plugin.bundle().component("brush.exported.chance", player, |
| 259 | + Formatter.number("chance", getChance()))); |
258 | 260 | } else if (getBrush() instanceof OverlayBrush || getBrush() instanceof UnderlayBrush) {
|
259 |
| - lines.add(plugin.bundle().component(player, "brush.exported.thickness", |
260 |
| - Placeholder.parsed("thickness", String.valueOf(getThickness())))); |
| 261 | + lines.add(plugin.bundle().component("brush.exported.thickness", player, |
| 262 | + Formatter.number("thickness", getThickness()))); |
261 | 263 | } else if (getBrush() instanceof DiskBrush) {
|
262 |
| - lines.add(plugin.bundle().component(player, "brush.exported.axis", |
| 264 | + lines.add(plugin.bundle().component("brush.exported.axis", player, |
263 | 265 | Placeholder.parsed("axis", getAxis().name())));
|
264 | 266 | } else if (getBrush() instanceof AngleBrush) {
|
265 |
| - lines.add(plugin.bundle().component(player, "brush.exported.angle.distance", |
266 |
| - Placeholder.parsed("distance", String.valueOf(getAngleDistance())))); |
267 |
| - lines.add(plugin.bundle().component(player, "brush.exported.angle.height", |
268 |
| - Placeholder.parsed("height", String.valueOf(getAngleHeightDifference())))); |
| 267 | + lines.add(plugin.bundle().component("brush.exported.angle.distance", player, |
| 268 | + Formatter.number("distance", getAngleDistance()))); |
| 269 | + lines.add(plugin.bundle().component("brush.exported.angle.height", player, |
| 270 | + Formatter.number("height", getAngleHeightDifference()))); |
269 | 271 | } else if (getBrush() instanceof SplatterBrush || getBrush() instanceof PaintBrush) {
|
270 |
| - lines.add(plugin.bundle().component(player, "brush.exported.falloff", |
271 |
| - Placeholder.parsed("falloff", String.valueOf(getFalloffStrength())))); |
| 272 | + lines.add(plugin.bundle().component("brush.exported.falloff", player, |
| 273 | + Formatter.number("falloff", getFalloffStrength()))); |
272 | 274 | } else if (getBrush() instanceof GradientBrush) {
|
273 |
| - lines.add(plugin.bundle().component(player, "brush.exported.mixing", |
274 |
| - Placeholder.parsed("mixing", String.valueOf(getMixingStrength())))); |
275 |
| - lines.add(plugin.bundle().component(player, "brush.exported.falloff", |
276 |
| - Placeholder.parsed("falloff", String.valueOf(getFalloffStrength())))); |
| 275 | + lines.add(plugin.bundle().component("brush.exported.mixing", player, |
| 276 | + Formatter.number("mixing", getMixingStrength()))); |
| 277 | + lines.add(plugin.bundle().component("brush.exported.falloff", player, |
| 278 | + Formatter.number("falloff", getFalloffStrength()))); |
277 | 279 | } else if (getBrush() instanceof FractureBrush) {
|
278 |
| - lines.add(plugin.bundle().component(player, "brush.exported.fracture", |
279 |
| - Placeholder.parsed("fracture", String.valueOf(getFractureStrength())))); |
| 280 | + lines.add(plugin.bundle().component("brush.exported.fracture", player, |
| 281 | + Formatter.number("fracture", getFractureStrength()))); |
280 | 282 | }
|
281 | 283 | if (!blocks.isEmpty()) {
|
282 | 284 | var blocks = getBlocks().stream()
|
283 | 285 | .map(Material::translationKey)
|
284 | 286 | .map(Component::translatable)
|
285 | 287 | .toList();
|
286 |
| - lines.add(plugin.bundle().component(player, "brush.exported.blocks", |
| 288 | + lines.add(plugin.bundle().component("brush.exported.blocks", player, |
287 | 289 | Placeholder.component("blocks", Component.join(JoinConfiguration.commas(true), blocks))));
|
288 | 290 | }
|
289 | 291 |
|
290 | 292 | if (isMaskEnabled()) {
|
291 |
| - lines.add(plugin.bundle().component(player, "brush.exported.mask", |
| 293 | + lines.add(plugin.bundle().component("brush.exported.mask", player, |
292 | 294 | Placeholder.component("mask", Component.translatable(getMask().translationKey()))));
|
293 | 295 | }
|
294 | 296 |
|
295 | 297 | if (!getSurfaceMode().equals(SurfaceMode.DISABLED)) {
|
296 |
| - var mode = plugin.bundle().component(player, getSurfaceMode().translationKey()); |
297 |
| - lines.add(plugin.bundle().component(player, "brush.exported.surface-mode", |
298 |
| - Placeholder.component("mode", mode))); |
| 298 | + var mode = plugin.bundle().component(getSurfaceMode().translationKey(), player); |
| 299 | + lines.add(plugin.bundle().component("brush.exported.surface-mode", player, |
| 300 | + Placeholder.component("mode", mode.style(Style.empty())))); |
299 | 301 | }
|
300 | 302 |
|
301 | 303 | itemStack.setData(DataComponentTypes.ENCHANTMENT_GLINT_OVERRIDE, true);
|
302 |
| - itemStack.setData(DataComponentTypes.ITEM_NAME, plugin.bundle().component(player, "brush.exported.name", |
| 304 | + itemStack.setData(DataComponentTypes.ITEM_NAME, plugin.bundle().component("brush.exported.name", player, |
303 | 305 | Placeholder.component("brush", getBrush().getName(player))));
|
304 | 306 | itemStack.setData(DataComponentTypes.LORE, ItemLore.lore(lines));
|
305 | 307 |
|
|
0 commit comments