mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-09 09:47:40 +01:00
Fix sign line capping check (#2522)
This commit is contained in:
parent
e5f584cf6b
commit
e7dadac1ae
@ -41,7 +41,7 @@ index 6030766099..b030269f0a 100644
|
|||||||
+ if (MAX_SIGN_LINE_LENGTH > 0 && astring[i].length() > MAX_SIGN_LINE_LENGTH) {
|
+ if (MAX_SIGN_LINE_LENGTH > 0 && astring[i].length() > MAX_SIGN_LINE_LENGTH) {
|
||||||
+ // This handles multibyte characters as 1
|
+ // This handles multibyte characters as 1
|
||||||
+ int offset = astring[i].codePoints().limit(MAX_SIGN_LINE_LENGTH).map(Character::charCount).sum();
|
+ int offset = astring[i].codePoints().limit(MAX_SIGN_LINE_LENGTH).map(Character::charCount).sum();
|
||||||
+ if (offset > astring.length) {
|
+ if (offset < astring[i].length()) {
|
||||||
+ astring[i] = astring[i].substring(0, offset);
|
+ astring[i] = astring[i].substring(0, offset);
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
|
Loading…
Reference in New Issue
Block a user