1
0
mirror of https://e.coding.net/circlecloud/MiaoBoard.git synced 2024-12-22 06:49:02 +00:00

fix: 修复颜色拼接错误的问题

Signed-off-by: 502647092 <admin@yumc.pw>
This commit is contained in:
502647092 2017-01-06 20:24:00 +08:00
parent 802433ac9e
commit 181829f480
2 changed files with 13 additions and 22 deletions

10
pom.xml
View File

@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>pw.yumc</groupId>
<artifactId>MiaoBoard</artifactId>
<version>2.3.1</version>
<version>2.3.2</version>
<description>喵式记分板</description>
<build>
<finalName>${project.artifactId}</finalName>
@ -79,8 +79,6 @@
<url>http://ci.yumc.pw/job/${project.artifactId}/</url>
</ciManagement>
<properties>
<update.description></update.description>
<update.changes></update.changes>
<env.GIT_COMMIT>DEV</env.GIT_COMMIT>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
@ -98,12 +96,6 @@
</repository>
</distributionManagement>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<type>jar</type>
<version>1.10.2-R0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>pw.yumc</groupId>
<artifactId>YumCore</artifactId>

View File

@ -3,7 +3,6 @@ package pw.yumc.MiaoBoard.scoreboard.core;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import org.apache.commons.lang.Validate;
import org.bukkit.ChatColor;
@ -48,20 +47,20 @@ public class SiderbarBoardPage extends BoardPage {
final BoardLine boardLine = getBoardLine(line); //得到我们的""
Validate.notNull(boardLine, "Unable to find BoardLine with index of " + line + "."); //确认是否存在
objective.getScore(boardLine.getColor().toString()).setScore(line); //设置""
String prefix = value;
String suffix = null;
//分割字符串为前16个和后16个
if (value.length() > 16) {
prefix = value.substring(0, 16);
if (ChatColor.getLastColors(prefix) != null && !Objects.equals(ChatColor.getLastColors(prefix), "") && !Objects.equals(ChatColor.getLastColors(prefix), " ")) {
//继承前16个字符的颜色
suffix = ChatColor.getLastColors(prefix) + value.substring(16, value.length());
} else {
suffix = ChatColor.RESET + value.substring(16, value.length());
}
}
String prefix = value.substring(0, 16);
boardLine.getTeam().setPrefix(prefix); //设置前16个字符
if (suffix != null) {
if (value.length() > 16) {
String suffix = value.substring(16, value.length());
//处理前后的颜色
String sufpre = "";
String prepre = ChatColor.getLastColors(prefix);
if (prefix.charAt(15) == '§') {
sufpre = "§";
} else if (!"".equals(prepre)) {
sufpre = prepre;
}
suffix = (sufpre + suffix).substring(0, 16);
boardLine.getTeam().setSuffix(suffix);//"设置后16个字符"
}
maxLine = line + 1;