mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-02 22:16:22 +00:00
Update Fabric module to support 1.19.4 (#241)
This commit is contained in:
1 parent
052c3731f5
commit
6839cd0f66
16 files changed
+126
-518
No files matched your search
@@ -22,7 +22,6 @@ package net.draycia.carbon.paper.listeners;
|
||||
import com.google.inject.Inject;
|
||||
import io.papermc.paper.event.player.AsyncChatEvent;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
import net.draycia.carbon.api.CarbonChat;
|
||||
import net.draycia.carbon.api.channels.ChannelRegistry;
|
||||
import net.draycia.carbon.api.events.CarbonChatEvent;
|
||||
@@ -37,7 +36,6 @@ import net.kyori.adventure.identity.Identity;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.TextReplacementConfig;
|
||||
import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;
|
||||
import net.kyori.event.EventSubscriber;
|
||||
import ninja.egg82.messenger.services.PacketService;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
@@ -50,6 +48,7 @@ import static java.util.Objects.requireNonNullElse;
|
||||
import static net.draycia.carbon.api.util.KeyedRenderer.keyedRenderer;
|
||||
import static net.draycia.carbon.common.util.Strings.URL_REPLACEMENT_CONFIG;
|
||||
import static net.kyori.adventure.key.Key.key;
|
||||
import static net.kyori.adventure.text.Component.empty;
|
||||
import static net.kyori.adventure.text.Component.text;
|
||||
|
||||
@DefaultQualifier(NonNull.class)
|
||||
@@ -110,9 +109,18 @@ public final class PaperChatListener implements Listener {
|
||||
final var chatEvent = new CarbonChatEvent(sender, eventMessage, recipients, renderers, channel, event.signedMessage());
|
||||
final var result = this.carbonChat.eventHandler().emit(chatEvent);
|
||||
|
||||
if (!result.wasSuccessful()) {
|
||||
for (final Map.Entry<EventSubscriber<?>, Throwable> entry : result.exceptions().entrySet()) {
|
||||
this.carbonChat.logger().error(entry.getValue());
|
||||
if (!result.wasSuccessful() || chatEvent.result().cancelled()) {
|
||||
if (!result.exceptions().isEmpty()) {
|
||||
for (final var entry : result.exceptions().entrySet()) {
|
||||
this.carbonChat.logger().error("Exception in event handler: " + entry.getKey().getClass().getName());
|
||||
entry.getValue().printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
final var failure = chatEvent.result().reason();
|
||||
|
||||
if (!failure.equals(empty())) {
|
||||
sender.sendMessage(failure);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user