Implement chat format support
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Bea 2022-11-12 06:57:44 +01:00
parent 3b744fe113
commit 36dd8afec1
2 changed files with 6 additions and 1 deletions

View File

@ -14,6 +14,10 @@ public class PlayerChatManager implements Listener
@EventHandler @EventHandler
public void onPlayerChat(AsyncPlayerChatEvent event) public void onPlayerChat(AsyncPlayerChatEvent event)
{ {
String format = Cache.getConfiguration().getString("chat.format");
format = format.replace("{player}", "%s")
.replace("{message}", "%s");
event.setFormat(format);
int coolDown = Cache.getConfiguration().getInt("chat.cool-down", 3); int coolDown = Cache.getConfiguration().getInt("chat.cool-down", 3);
if(coolDown < 1) return; // disable this feature if cooldown is 0 or negative. if(coolDown < 1) return; // disable this feature if cooldown is 0 or negative.

View File

@ -10,4 +10,5 @@ island:
yaw: 0.0 yaw: 0.0
pitch: 0.0 pitch: 0.0
chat: chat:
cool-down: 3 cool-down: 3
format: '§7{player} » {message}'