Skip to content

Commit

Permalink
feat: 1.20.6+ support
Browse files Browse the repository at this point in the history
  • Loading branch information
Boy0000 committed May 12, 2024
1 parent e6bd6c6 commit 995217a
Show file tree
Hide file tree
Showing 17 changed files with 26 additions and 32 deletions.
1 change: 0 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ plugins {
alias(idofrontLibs.plugins.mia.kotlin.jvm)
alias(idofrontLibs.plugins.kotlinx.serialization)
alias(idofrontLibs.plugins.mia.papermc)
alias(idofrontLibs.plugins.mia.testing)
alias(idofrontLibs.plugins.mia.publication)
alias(idofrontLibs.plugins.mia.autoversion)
}
Expand Down
2 changes: 1 addition & 1 deletion chatty-paper/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
plugins {
alias(idofrontLibs.plugins.mia.kotlin.jvm)
alias(idofrontLibs.plugins.mia.papermc)
alias(idofrontLibs.plugins.mia.testing)
alias(idofrontLibs.plugins.mia.publication)
id(idofrontLibs.plugins.mia.copyjar.get().pluginId)
alias(idofrontLibs.plugins.kotlinx.serialization)
Expand All @@ -12,6 +11,7 @@ repositories {
maven("https://repo.mineinabyss.com/snapshots")
maven("https://repo.extendedclip.com/content/repositories/placeholderapi/")
maven("https://nexus.scarsz.me/content/groups/public/") // DiscordSRV
mavenLocal()
}

dependencies {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,7 @@ data class ChattyChannel(
}

// Add spying players
val spies = chatty.spyingPlayers.map {
this.player.takeIf { spying.channels.contains(key) }
}.filterNotNull()
val spies = chatty.spyingPlayers.mapWithEntity { this.player.takeIf { key in this.spying.channels } }.mapNotNull { it.data }
audiences.addAll(spies)

return audiences
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import com.mineinabyss.chatty.components.*
import com.mineinabyss.chatty.helpers.*
import com.mineinabyss.geary.papermc.tracking.entities.toGeary
import com.mineinabyss.geary.papermc.tracking.entities.toGearyOrNull
import com.mineinabyss.geary.serialization.getOrSetPersisting
import com.mineinabyss.geary.serialization.setPersisting
import com.mineinabyss.idofront.commands.arguments.stringArg
import com.mineinabyss.idofront.commands.execution.IdofrontCommandExecutor
import com.mineinabyss.idofront.commands.extensions.actions.ensureSenderIsPlayer
Expand Down Expand Up @@ -80,7 +82,7 @@ class ChattyCommands : IdofrontCommandExecutor(), TabCompleter {
sender.sendFormattedMessage(nickMessage.selfEmpty)
}

arguments.first().startsWith(chatty.config.nicknames.nickNameOtherPrefix) -> {
arguments[0].startsWith(chatty.config.nicknames.nickNameOtherPrefix) -> {
val otherPlayer = arguments.playerToNick()
val otherNick = nick.removePlayerToNickFromString()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package com.mineinabyss.chatty

import com.mineinabyss.chatty.helpers.DiscordEmoteFixer
import com.mineinabyss.chatty.queries.SpyingPlayersQuery
import com.mineinabyss.geary.systems.query.CachedQueryRunner
import com.mineinabyss.geary.systems.query.CachedQuery
import com.mineinabyss.idofront.di.DI

const val chattyProxyChannel = "chatty:proxy"
Expand All @@ -15,5 +15,5 @@ interface ChattyContext {
val emotefixer: DiscordEmoteFixer
val isPlaceholderApiLoaded: Boolean
val isDiscordSRVLoaded: Boolean
val spyingPlayers: CachedQueryRunner<SpyingPlayersQuery>
val spyingPlayers: CachedQuery<SpyingPlayersQuery>
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import com.mineinabyss.chatty.queries.SpyingPlayersQuery
import com.mineinabyss.geary.autoscan.autoscan
import com.mineinabyss.geary.helpers.componentId
import com.mineinabyss.geary.modules.geary
import com.mineinabyss.geary.systems.builders.cachedQuery
import com.mineinabyss.geary.systems.builders.cache
import com.mineinabyss.idofront.config.config
import com.mineinabyss.idofront.di.DI
import com.mineinabyss.idofront.plugin.Plugins
Expand Down Expand Up @@ -59,7 +59,7 @@ class ChattyPlugin : JavaPlugin() {
override val emotefixer: DiscordEmoteFixer by config("emotefixer", dataFolder.toPath(), DiscordEmoteFixer())
override val isPlaceholderApiLoaded: Boolean get() = Plugins.isEnabled("PlaceholderAPI")
override val isDiscordSRVLoaded: Boolean get() = Plugins.isEnabled("DiscordSRV")
override val spyingPlayers = geary.cachedQuery(SpyingPlayersQuery())
override val spyingPlayers = geary.cache(SpyingPlayersQuery())
}

DI.add<ChattyContext>(chattyContext)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.mineinabyss.chatty.components
import com.mineinabyss.chatty.chatty
import com.mineinabyss.chatty.helpers.parseTags
import com.mineinabyss.geary.papermc.tracking.entities.toGeary
import com.mineinabyss.geary.serialization.setPersisting
import com.mineinabyss.idofront.textcomponents.miniMsg
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer
import org.bukkit.entity.Player

fun GenericChattyDecorateEvent(player: Player, msg: Component) =
AsyncChatDecorateEvent(true, player, msg, msg)
AsyncChatDecorateEvent(player, msg)
fun GenericChattyChatEvent(player: Player, msg: Component) =
AsyncChatEvent(true, player, mutableSetOf(), ChatRenderer.defaultRenderer(), msg, msg, SignedMessage.system(msg.serialize(), null))
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import com.mineinabyss.chatty.events.ChattyPlayerChatEvent
import com.mineinabyss.chatty.helpers.*
import com.mineinabyss.geary.modules.geary
import com.mineinabyss.geary.papermc.tracking.entities.toGearyOrNull
import com.mineinabyss.geary.systems.builders.cachedQuery
import com.mineinabyss.geary.systems.builders.cache
import com.mineinabyss.geary.systems.query.GearyQuery
import com.mineinabyss.idofront.textcomponents.serialize
import io.papermc.paper.event.player.AsyncChatCommandDecorateEvent
Expand All @@ -29,7 +29,7 @@ import org.bukkit.event.player.PlayerCommandPreprocessEvent
@Suppress("UnstableApiUsage")
class ChatListener : Listener {
val plainText = PlainTextComponentSerializer.plainText()
val commandSpyQuery = geary.cachedQuery(CommandSpyQuery())
val commandSpyQuery = geary.cache(CommandSpyQuery())

class CommandSpyQuery : GearyQuery() {
val player by get<Player>()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ class ChattyProxyListener : PluginMessageListener {
val channel = chatty.config.channels[channelId]
val onlinePlayers = Bukkit.getOnlinePlayers().filter { it.server == Bukkit.getServer() }

val canSpy = chatty.spyingPlayers.map {
val canSpy = chatty.spyingPlayers.mapWithEntity {
this.player.takeIf { spying.channels.contains(channelId) }
}.filterNotNull()
}.mapNotNull { it.data }

// If the channel is not found, it is discord
if (channel != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import com.mineinabyss.chatty.components.ChannelData
import com.mineinabyss.chatty.components.HideJoinLeave
import com.mineinabyss.chatty.helpers.*
import com.mineinabyss.geary.papermc.tracking.entities.toGeary
import com.mineinabyss.geary.serialization.getOrSetPersisting
import com.mineinabyss.idofront.items.editItemMeta
import com.mineinabyss.idofront.textcomponents.miniMsg
import com.mineinabyss.idofront.textcomponents.serialize
Expand Down
4 changes: 0 additions & 4 deletions chatty-paper/src/main/resources/paper-plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ dependencies:
required: true
load: BEFORE
join-classpath: true
BondrewdLikesHisEmotes:
required: false
load: BEFORE
join-classpath: true
PlaceholderAPI:
required: false
load: BEFORE
Expand Down
12 changes: 3 additions & 9 deletions chatty-velocity/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,28 @@ plugins {
kotlin("jvm")
kotlin("kapt")
kotlin("plugin.serialization")
id("com.github.johnrengelman.shadow")
`maven-publish`
id(idofrontLibs.plugins.mia.copyjar.get().pluginId)
}

copyJar {
destPath.set(project.findProperty("velocity_plugin_path") as String? ?: "./build/publish")
excludePlatformDependencies.set(false)
}

repositories {
mavenCentral()
gradlePluginPortal()
maven("https://repo.papermc.io/repository/maven-public/")
mavenLocal()
}

dependencies {
implementation(kotlin("reflect"))
// implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.4.0")
// api(platform("org.jetbrains.kotlinx:kotlinx-coroutines-bom:$coroutinesVersion"))
implementation(idofrontLibs.kotlinx.coroutines)
implementation(idofrontLibs.kotlinx.serialization.json)
// implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion")
// implementation("org.jetbrains.kotlinx:kotlinx-coroutines-jdk8:$coroutinesVersion")
implementation("net.kyori:adventure-extra-kotlin:4.11.0")

compileOnly(libs.velocity)
kapt(libs.velocity)
}

copyJar {
excludePlatformDependencies.set(false)
}
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
group=com.mineinabyss
version=0.7
idofrontVersion=0.23.0
version=0.8
idofrontVersion=0.24-dev
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[versions]
geary = "0.30.0"
geary = "0.30-dev"
velocity = "3.3.0-SNAPSHOT"
discordsrv = "1.27.0"
placeholderapi = "2.11.5"
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
3 changes: 3 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ pluginManagement {
maven("https://repo.mineinabyss.com/releases")
maven("https://repo.mineinabyss.com/snapshots")
maven("https://repo.papermc.io/repository/maven-public/")
mavenLocal()
google()
}

Expand All @@ -24,8 +25,10 @@ dependencyResolutionManagement {
val idofrontVersion: String by settings

repositories {
mavenCentral()
maven("https://repo.mineinabyss.com/releases")
maven("https://repo.mineinabyss.com/snapshots")
mavenLocal()
}

versionCatalogs {
Expand Down

0 comments on commit 995217a

Please sign in to comment.