diff --git a/honey-kt-extension/src/dev/shiza/honey/audience.kt b/honey-kt-extension/src/dev/shiza/honey/audience.kt new file mode 100644 index 0000000..dc2fa1c --- /dev/null +++ b/honey-kt-extension/src/dev/shiza/honey/audience.kt @@ -0,0 +1,39 @@ +import dev.shiza.honey.dispatcher.AdventureMessageDispatcher +import dev.shiza.honey.message.Message +import net.kyori.adventure.audience.Audience +import net.kyori.adventure.text.Component + +typealias MessageFormatter = MessageFormatter +typealias MessageDispatcher = MessageDispatcher + +fun AdventureMessageDispatcher.createChat(messageFormatter: MessageFormatter): MessageDispatcher = + MessageBaseDispatcher( + messageFormatter, + Message.blank(), + Audience.empty(), + Audience::sendMessage + ) + +fun AdventureMessageDispatcher.createActionBar(messageFormatter: MessageFormatter): MessageDispatcher = + MessageBaseDispatcher( + messageFormatter, + Message.blank(), + Audience.empty(), + Audience::sendActionBar + ) + +fun Audience.createChat(messageFormatter: MessageFormatter): MessageDispatcher = + MessageBaseDispatcher( + messageFormatter, + Message.blank(), + this, + Audience::sendMessage + ) + +fun Audience.createActionBar(messageFormatter: MessageFormatter): MessageDispatcher = + MessageBaseDispatcher( + messageFormatter, + Message.blank(), + this, + Audience::sendActionBar + )