From 0db5fe7606e2fff85836a2230a15f024b964b292 Mon Sep 17 00:00:00 2001 From: Nicholas Rose <35816886+nicholasgrose@users.noreply.github.com> Date: Tue, 15 Jun 2021 22:37:09 -0400 Subject: [PATCH] Small patch that adds advancements to the chat extension --- build.gradle.kts | 2 +- src/main/kotlin/com/rose/gateway/GatewayPlugin.kt | 2 +- .../com/rose/gateway/minecraft/chat/ChatListener.kt | 12 ++++++++++++ src/main/resources/plugin.yml | 2 +- 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 824eab11..d78e6a0b 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -5,7 +5,7 @@ plugins { } group = "com.rose" -version = "1.3.2" +version = "1.3.3" repositories { mavenCentral() diff --git a/src/main/kotlin/com/rose/gateway/GatewayPlugin.kt b/src/main/kotlin/com/rose/gateway/GatewayPlugin.kt index bab135f0..60b6dda6 100644 --- a/src/main/kotlin/com/rose/gateway/GatewayPlugin.kt +++ b/src/main/kotlin/com/rose/gateway/GatewayPlugin.kt @@ -10,7 +10,7 @@ import org.bukkit.plugin.java.JavaPlugin @Suppress("unused") class GatewayPlugin : JavaPlugin() { companion object { - const val VERSION = "1.3.2" + const val VERSION = "1.3.3" lateinit var plugin: GatewayPlugin } diff --git a/src/main/kotlin/com/rose/gateway/minecraft/chat/ChatListener.kt b/src/main/kotlin/com/rose/gateway/minecraft/chat/ChatListener.kt index e1ff69e3..87c87cc3 100644 --- a/src/main/kotlin/com/rose/gateway/minecraft/chat/ChatListener.kt +++ b/src/main/kotlin/com/rose/gateway/minecraft/chat/ChatListener.kt @@ -8,6 +8,7 @@ import kotlinx.coroutines.runBlocking import org.bukkit.event.EventHandler import org.bukkit.event.Listener import org.bukkit.event.entity.PlayerDeathEvent +import org.bukkit.event.player.PlayerAdvancementDoneEvent import org.bukkit.event.player.PlayerCommandPreprocessEvent import org.bukkit.event.player.PlayerJoinEvent import org.bukkit.event.player.PlayerQuitEvent @@ -79,4 +80,15 @@ object ChatListener : Listener { DiscordBot.bot.send(GameChatEvent(message)) } } + + @EventHandler + fun onPlayerAdvancement(event: PlayerAdvancementDoneEvent) { + val advancementMessage = event.message() ?: return + + runBlocking { + DiscordBot.bot.send(GameChatEvent { + content = PaperComponents.plainSerializer().serialize(advancementMessage) + }) + } + } } diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index d2fa2193..ddd885a6 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,5 +1,5 @@ name: Gateway -version: 1.3.2 +version: 1.3.3 main: com.rose.gateway.GatewayPlugin api-version: 1.16 authors: [ 'Nicholas Rose' ]