Skip to content

Commit

Permalink
Small patch that adds advancements to the chat extension
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholasgrose committed Jun 16, 2021
1 parent ed8126c commit 0db5fe7
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plugins {
}

group = "com.rose"
version = "1.3.2"
version = "1.3.3"

repositories {
mavenCentral()
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/com/rose/gateway/GatewayPlugin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
12 changes: 12 additions & 0 deletions src/main/kotlin/com/rose/gateway/minecraft/chat/ChatListener.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
})
}
}
}
2 changes: 1 addition & 1 deletion src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -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' ]
Expand Down

0 comments on commit 0db5fe7

Please sign in to comment.