Skip to content

Commit e72e6df

Browse files
committed
1.2.7 优化发送喇叭颜色解析
1 parent 174456f commit e72e6df

File tree

3 files changed

+4
-9
lines changed

3 files changed

+4
-9
lines changed

pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
1414
<spigot-api.vesion>1.21.4-R0.1-SNAPSHOT</spigot-api.vesion>
1515
<lombok.version>1.18.36</lombok.version>
16-
<HandyLib.version>3.18.1</HandyLib.version>
16+
<HandyLib.version>3.18.2</HandyLib.version>
1717
<placeholderapi.version>2.11.6</placeholderapi.version>
1818
<annotations.version>24.1.0</annotations.version>
1919
</properties>

src/main/java/cn/handyplus/chat/core/HornUtil.java

+3-7
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import cn.handyplus.lib.constants.BaseConstants;
66
import cn.handyplus.lib.constants.VersionCheckEnum;
77
import cn.handyplus.lib.core.StrUtil;
8-
import cn.handyplus.lib.util.BaseUtil;
98
import cn.handyplus.lib.util.BcUtil;
109
import cn.handyplus.lib.util.BossBarUtil;
1110
import cn.handyplus.lib.util.HandyConfigUtil;
@@ -46,7 +45,7 @@ public static void sendMsg(Player player, BcUtil.BcMessageParam bcMessageParam)
4645
// 解析内部变量
4746
rgb = rgb.replace("${player}", bcMessageParam.getPlayerName());
4847
// 加载rgb颜色
49-
String msgRgb = BaseUtil.replaceChatColor(rgb + msg);
48+
String msgRgb = rgb + msg;
5049
if (message) {
5150
List<String> messageFormatList = ConfigUtil.LB_CONFIG.getStringList("lb." + type + ".message.format");
5251
for (String messageFormat : messageFormatList) {
@@ -56,10 +55,8 @@ public static void sendMsg(Player player, BcUtil.BcMessageParam bcMessageParam)
5655
}
5756
// 1.9+ 才可使用
5857
if (actionbar && BaseConstants.VERSION_ID > VersionCheckEnum.V_1_8.getVersionId()) {
59-
String actionbarRgb = ConfigUtil.LB_CONFIG.getString("lb." + type + ".actionbar.rgb");
60-
String actionbarRgbMsg = BaseUtil.replaceChatColor(actionbarRgb + msg);
6158
String actionbarFormat = ConfigUtil.LB_CONFIG.getString("lb." + type + ".actionbar.format", "${message}");
62-
actionbarFormat = actionbarFormat.replace("${message}", actionbarRgbMsg);
59+
actionbarFormat = actionbarFormat.replace("${message}", msgRgb);
6360
MessageUtil.sendAllActionbar(PlaceholderApiUtil.set(player, actionbarFormat));
6461
}
6562
// 1.9+ 才可使用
@@ -72,8 +69,7 @@ public static void sendMsg(Player player, BcUtil.BcMessageParam bcMessageParam)
7269
if (boss && BaseConstants.VERSION_ID > VersionCheckEnum.V_1_12.getVersionId()) {
7370
String bossFormat = ConfigUtil.LB_CONFIG.getString("lb." + type + ".boss.format", "${message}");
7471
String bossFormatStr = bossFormat.replace("${message}", msgRgb);
75-
bossFormatStr = PlaceholderApiUtil.set(player, bossFormatStr);
76-
KeyedBossBar bossBar = BossBarUtil.createBossBar(ConfigUtil.LB_CONFIG, "lb." + type + ".boss", bossFormatStr);
72+
KeyedBossBar bossBar = BossBarUtil.createBossBar(ConfigUtil.LB_CONFIG, "lb." + type + ".boss", PlaceholderApiUtil.set(player, bossFormatStr));
7773
BossBarUtil.addAllPlayer(bossBar);
7874
int time = ConfigUtil.LB_CONFIG.getInt("lb." + type + ".boss.time", 3);
7975
BossBarUtil.setProgress(bossBar.getKey(), time);

src/main/resources/lb.yml

-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ lb:
2121
# 物品栏上方消息 1.9+ 才可使用
2222
actionbar:
2323
enable: true
24-
rgb: "&a"
2524
format: "${message}"
2625
# boss血条消息 1.13+ 才可使用
2726
boss:

0 commit comments

Comments
 (0)