测试了聊天前缀功能
All checks were successful
Java CI-CD with Maven / build (push) Successful in 14m28s

This commit is contained in:
zhangyuheng 2024-08-11 11:57:19 +08:00
parent b71fec6329
commit 6a7e8b066a
2 changed files with 5 additions and 5 deletions

View File

@ -6,7 +6,7 @@
<groupId>cn.lunadeer</groupId>
<artifactId>EssentialsD</artifactId>
<version>2.1.0</version>
<version>2.1.1</version>
<packaging>jar</packaging>
<name>EssentialsD</name>

View File

@ -1,19 +1,19 @@
package cn.lunadeer.essentialsd.events;
import cn.lunadeer.essentialsd.EssentialsD;
import io.papermc.paper.event.player.AsyncChatEvent;
import me.clip.placeholderapi.PlaceholderAPI;
import net.kyori.adventure.text.Component;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.AsyncPlayerChatEvent;
public class ChatPrefixEvent implements Listener {
@EventHandler
public void onChat(AsyncChatEvent event) {
public void onChat(AsyncPlayerChatEvent event) {
event.setCancelled(true);
String formated = PlaceholderAPI.setPlaceholders(event.getPlayer(), EssentialsD.config.getPrefixFormat());
EssentialsD.instance.getServer().sendMessage(Component.text(formated).append(event.message()));
formated += event.getMessage();
EssentialsD.instance.getServer().broadcastMessage(formated);
}
}