mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-02 22:16:22 +00:00
Rename chat event
This commit is contained in:
1 parent
554775ba13
commit
2d14d42f64
3 files changed
+11
-9
No files matched your search
@@ -1,6 +1,7 @@
|
||||
package net.draycia.simplechat.channels;
|
||||
|
||||
import net.draycia.simplechat.SimpleChat;
|
||||
import net.draycia.simplechat.events.ChatFormatEvent;
|
||||
import net.draycia.simplechat.storage.ChatUser;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.format.TextColor;
|
||||
@@ -118,7 +119,7 @@ public abstract class ChatChannel {
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses the specified message, calls a {@link net.draycia.simplechat.events.ChannelChatEvent}, and sends the message to everyone who can view this channel.
|
||||
* Parses the specified message, calls a {@link ChatFormatEvent}, and sends the message to everyone who can view this channel.
|
||||
* @param user The player who is saying the message.
|
||||
* @param message The message to be sent.
|
||||
*/
|
||||
|
||||
@@ -3,7 +3,7 @@ package net.draycia.simplechat.channels.impls;
|
||||
import me.clip.placeholderapi.PlaceholderAPI;
|
||||
import net.draycia.simplechat.SimpleChat;
|
||||
import net.draycia.simplechat.channels.ChatChannel;
|
||||
import net.draycia.simplechat.events.ChannelChatEvent;
|
||||
import net.draycia.simplechat.events.ChatFormatEvent;
|
||||
import net.draycia.simplechat.storage.ChatUser;
|
||||
import net.draycia.simplechat.util.DiscordWebhook;
|
||||
import net.kyori.adventure.audience.Audience;
|
||||
@@ -178,16 +178,16 @@ public class SimpleChatChannel extends ChatChannel {
|
||||
}
|
||||
|
||||
// Call custom chat event
|
||||
ChannelChatEvent event = new ChannelChatEvent(user, this, messageFormat, message);
|
||||
ChatFormatEvent formatEvent = new ChatFormatEvent(user, this, messageFormat, message);
|
||||
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
Bukkit.getPluginManager().callEvent(formatEvent);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
if (formatEvent.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Parse placeholders
|
||||
messageFormat = PlaceholderAPI.setPlaceholders(user.asOfflinePlayer(), event.getFormat());
|
||||
messageFormat = PlaceholderAPI.setPlaceholders(user.asOfflinePlayer(), formatEvent.getFormat());
|
||||
|
||||
// Convert legacy color codes to Mini color codes
|
||||
Component component = LegacyComponentSerializer.legacy('&').deserialize(messageFormat);
|
||||
@@ -197,7 +197,7 @@ public class SimpleChatChannel extends ChatChannel {
|
||||
Component formattedMessage = MiniMessage.instance().parse(messageFormat, "color", "<" + color.toString() + ">",
|
||||
"phase", Long.toString(System.currentTimeMillis() % 25), "server",
|
||||
simpleChat.getConfig().getString("server-name", "Server"),
|
||||
"message", event.getMessage());
|
||||
"message", formatEvent.getMessage());
|
||||
|
||||
// Handle item linking placeholders
|
||||
if (formattedMessage instanceof TextComponent && user.isOnline()) {
|
||||
|
||||
Reference in new issue
Block a user