Skip to content

Commit 174456f

Browse files
committed
1.2.7 解析变量
1 parent 3a2b86a commit 174456f

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

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

+8-8
Original file line numberDiff line numberDiff line change
@@ -43,36 +43,36 @@ public static void sendMsg(Player player, BcUtil.BcMessageParam bcMessageParam)
4343
boolean actionbar = ConfigUtil.LB_CONFIG.getBoolean("lb." + type + ".actionbar.enable");
4444
boolean boss = ConfigUtil.LB_CONFIG.getBoolean("lb." + type + ".boss.enable");
4545
boolean title = ConfigUtil.LB_CONFIG.getBoolean("lb." + type + ".title.enable", true);
46-
47-
// 解析变量
46+
// 解析内部变量
4847
rgb = rgb.replace("${player}", bcMessageParam.getPlayerName());
49-
rgb = PlaceholderApiUtil.set(player, rgb);
5048
// 加载rgb颜色
5149
String msgRgb = BaseUtil.replaceChatColor(rgb + msg);
5250
if (message) {
5351
List<String> messageFormatList = ConfigUtil.LB_CONFIG.getStringList("lb." + type + ".message.format");
5452
for (String messageFormat : messageFormatList) {
55-
MessageUtil.sendAllMessage(messageFormat.replace("${message}", msgRgb));
53+
messageFormat = messageFormat.replace("${message}", msgRgb);
54+
MessageUtil.sendAllMessage(PlaceholderApiUtil.set(player, messageFormat));
5655
}
5756
}
5857
// 1.9+ 才可使用
5958
if (actionbar && BaseConstants.VERSION_ID > VersionCheckEnum.V_1_8.getVersionId()) {
6059
String actionbarRgb = ConfigUtil.LB_CONFIG.getString("lb." + type + ".actionbar.rgb");
6160
String actionbarRgbMsg = BaseUtil.replaceChatColor(actionbarRgb + msg);
62-
actionbarRgbMsg = PlaceholderApiUtil.set(player, actionbarRgbMsg);
6361
String actionbarFormat = ConfigUtil.LB_CONFIG.getString("lb." + type + ".actionbar.format", "${message}");
64-
MessageUtil.sendAllActionbar(actionbarFormat.replace("${message}", actionbarRgbMsg));
62+
actionbarFormat = actionbarFormat.replace("${message}", actionbarRgbMsg);
63+
MessageUtil.sendAllActionbar(PlaceholderApiUtil.set(player, actionbarFormat));
6564
}
6665
// 1.9+ 才可使用
6766
if (title && BaseConstants.VERSION_ID > VersionCheckEnum.V_1_8.getVersionId()) {
68-
name = PlaceholderApiUtil.set(player, name);
6967
String titleFormat = ConfigUtil.LB_CONFIG.getString("lb." + type + ".title.format", "${message}");
70-
MessageUtil.sendAllTitle(name, titleFormat.replace("${message}", msgRgb));
68+
titleFormat = titleFormat.replace("${message}", msgRgb);
69+
MessageUtil.sendAllTitle(PlaceholderApiUtil.set(player, name), PlaceholderApiUtil.set(player, titleFormat));
7170
}
7271
// 1.13+ 才可使用
7372
if (boss && BaseConstants.VERSION_ID > VersionCheckEnum.V_1_12.getVersionId()) {
7473
String bossFormat = ConfigUtil.LB_CONFIG.getString("lb." + type + ".boss.format", "${message}");
7574
String bossFormatStr = bossFormat.replace("${message}", msgRgb);
75+
bossFormatStr = PlaceholderApiUtil.set(player, bossFormatStr);
7676
KeyedBossBar bossBar = BossBarUtil.createBossBar(ConfigUtil.LB_CONFIG, "lb." + type + ".boss", bossFormatStr);
7777
BossBarUtil.addAllPlayer(bossBar);
7878
int time = ConfigUtil.LB_CONFIG.getInt("lb." + type + ".boss.time", 3);

0 commit comments

Comments
 (0)