Skip to content

Commit 87ecec2

Browse files
authored
Update TIPS.java
fix nmlgcb bug
1 parent 4e0bed3 commit 87ecec2

File tree

1 file changed

+6
-2
lines changed
  • src/main/java/sensen1234/sencraft/tips

1 file changed

+6
-2
lines changed

src/main/java/sensen1234/sencraft/tips/TIPS.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
public class TIPS extends JavaPlugin {
1212

1313
private List<String> tips;
14+
private String tipstext;
15+
private String tipstextcolor;
1416
private Random random;
1517

1618
@Override
@@ -23,6 +25,8 @@ public void onEnable() {
2325
private void loadConfig() {
2426
FileConfiguration config = getConfig();
2527
tips = config.getStringList("tips");
28+
tipstext = config.getString("tipstext", "");
29+
tipstextcolor = config.getString("tipstextcolor", "");
2630
random = new Random();
2731
}
2832

@@ -37,9 +41,9 @@ public void run() {
3741
}
3842

3943
private void sendRandomTip() {
40-
if (!tips.isEmpty()) {
44+
if (tips != null && !tips.isEmpty()) {
4145
String tip = tips.get(random.nextInt(tips.size()));
42-
Bukkit.broadcastMessage("[TIPS] " + tip); // 发送小提示到公屏
46+
Bukkit.broadcastMessage(tipstextcolor + tipstext + tip); // 发送小提示到公屏
4347
}
4448
}
4549
}

0 commit comments

Comments
 (0)