From 110076f83eb1735941b7c592297b68e0e0992560 Mon Sep 17 00:00:00 2001 From: Andreas Troelsen Date: Sun, 18 Aug 2024 15:07:48 +0200 Subject: [PATCH] Don't truncate text on arena signs. Turns out this isn't necessary at all. I think the server used to throw an exception if there were too many characters on a sign, but it doesn't seem to be the case anymore (tested on 1.21 and 1.13.2). This commit simply removes the truncation logic from the sign rendering procedure, and it fixes issues where text that would otherwise fit on a sign would be cut off, but more specifically one where color codes would sort of "push" characters out of the sign despite not being visible. Fixes #790 --- changelog.md | 1 + .../garbagemule/MobArena/signs/RendersTemplate.java | 10 +--------- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/changelog.md b/changelog.md index 5fb10d5..5858826 100644 --- a/changelog.md +++ b/changelog.md @@ -19,6 +19,7 @@ These changes will (most likely) be included in the next version. - MobArena no longer throws errors when handling block explosions on Minecraft 1.21. - The `shuffle-positions` ability now correctly shuffles the position of the boss as well if `monster-teleport` is set to `false`. - The `obsidian-bomb` ability no longer breaks boss waves. +- Text on Arena Signs is no longer explicitly truncated. This fixes an issue where color codes would count towards the character limit, causing the text that would otherwise fit on the sign to be cut off. ## [0.108] - 2024-01-01 ### Added diff --git a/src/main/java/com/garbagemule/MobArena/signs/RendersTemplate.java b/src/main/java/com/garbagemule/MobArena/signs/RendersTemplate.java index a03fcf7..c5a6fea 100644 --- a/src/main/java/com/garbagemule/MobArena/signs/RendersTemplate.java +++ b/src/main/java/com/garbagemule/MobArena/signs/RendersTemplate.java @@ -26,8 +26,7 @@ class RendersTemplate { String[] result = new String[lines.length]; for (int i = 0; i < lines.length; i++) { - String rendered = render(lines[i], arena); - result[i] = truncate(rendered); + result[i] = render(lines[i], arena); } return result; } @@ -129,11 +128,4 @@ class RendersTemplate { } } - private String truncate(String rendered) { - if (rendered.length() <= 15) { - return rendered; - } - return rendered.substring(0, 15); - } - }