Finish two todo items
This commit is contained in:
1 parent
ac993c2b60
commit
f089f4692f
10 files changed
+52
-44
No files matched your search
@@ -1,3 +1,6 @@
|
||||
[submodule "libs/Utilities-OG"]
|
||||
path = libs/Utilities-OG
|
||||
url = https://github.com/true-og/Utilities-OG
|
||||
[submodule "libs/Vanish-OG"]
|
||||
path = libs/Vanish-OG
|
||||
url = https://github.com/true-og/Vanish-OG
|
||||
@@ -0,0 +1,7 @@
|
||||
# Changelog
|
||||
|
||||
NotAlexNoyle 05/04/26:
|
||||
|
||||
- Migrate vanish detection from the Essentials API to the Vanish-OG API surface.
|
||||
- Append ` &7> ` separator in chat formatting so the trailing `>` can
|
||||
be removed from LuckPerms suffixes.
|
||||
@@ -2,14 +2,21 @@
|
||||
Chat plugin for [TrueOG](https://github.com/true-og/true-og)
|
||||
|
||||
## Features
|
||||
- Adds prefix, union and suffix to chat messages.
|
||||
- Formats chat messages with MiniMessage if the player sending them has the `chat-og.color` permission.
|
||||
- Translates chat messages using any OpenAI(-compatible) API.
|
||||
- Discord bridge with custom and animated emoji (Minecraft to Discord only) support.
|
||||
- Staff and premium chat.
|
||||
- Adds LuckPerms prefix, Unions-OG tag, and LuckPerms suffix to chat messages.
|
||||
- Formats chat messages with MiniMessage if the player sending them has the `chat-og.color` permission, with legacy `&` and `§` color code support.
|
||||
- Translates chat messages using any OpenAI(-compatible) API. Click any chat or Discord message to translate it on-demand, and run command `/translatesettings <language>` to pick your preferred language (preferences persisted in KeyDB).
|
||||
- Discord bridge with custom emoji (Minecraft → Discord), animated NQN emoji support, clickable attachment links, and Unicode emoji-to-shortcode conversion (Emoji 17.0).
|
||||
- Multi-channel chat: general (`/g` / `/gc`), staff (`/s` / `/sc`), premium (`/p` / `/pc`) and developer (`/d` / `/dc`), each with its own Discord webhook.
|
||||
- Private messaging (`/msg`, `/whisper`, `/pm`) with `/r` and `/reply` shortcuts.
|
||||
- Forwards joins, quits, kicks, advancements, deaths and broadcasts to Discord, with full Vanish-OG awareness so vanished players never leak into Discord.
|
||||
- LuckPerms-driven Discord role color mapping so that player rank based formatting permissions carry over to Discord.
|
||||
- Pings in chat alert the mentioned player. Words both ways from Minecraft <-> Discord.
|
||||
- Censor `@everyone`, `@here` and role mentions on the Discord side.
|
||||
- API for other plugins to send messages through the Discord bridge.
|
||||
- Run command `/chatconfigreload` to fully reload the config and the Discord bridge at runtime.
|
||||
|
||||
## Building
|
||||
```./gradlew build```
|
||||
```./gradlew clean build eclipse --warning-mode all```
|
||||
|
||||
## Emoji Converter Credits
|
||||
- https://github.com/mathiasbynens/emoji-test-regex-pattern
|
||||
|
||||
+2
-2
@@ -27,7 +27,7 @@ val commitHash: String =
|
||||
|
||||
group = "nl.skbotnl.chatog" // Declare bundle identifier.
|
||||
|
||||
val apiVersion = "1.19" // Declare plugin version (will be in .jar).
|
||||
val apiVersion = "1.19" // Declare API version.
|
||||
|
||||
version = "$apiVersion-$commitHash" // Declare plugin version (will be in .jar).
|
||||
|
||||
@@ -60,8 +60,8 @@ dependencies {
|
||||
files("libs/AnnouncerPlus-1.4.1.jar")
|
||||
) // Import AnnouncerPlus API (binary-compatible with AnnouncerPlus-OG API).
|
||||
compileOnlyApi(project(":libs:Utilities-OG")) // Import TrueOG Network Utilities-OG Java API (from source).
|
||||
compileOnlyApi(project(":libs:Vanish-OG")) // Import TrueOG Network Vanish-OG Java API (from source).
|
||||
compileOnly("net.luckperms:api:5.5") // Import LuckPerms API.
|
||||
|
||||
implementation("tools.jackson.core:jackson-databind:3.1.1")
|
||||
implementation("tools.jackson.dataformat:jackson-dataformat-yaml:3.1.1")
|
||||
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
jdk:
|
||||
- 17.0.9
|
||||
before_install:
|
||||
- sdk install java 17.0.9-graalce
|
||||
- sdk use java 17.0.9-graalce
|
||||
install:
|
||||
- ./gradlew build publishToMavenLocal
|
||||
Submodule
+1
Submodule libs/Vanish-OG added at eb4f80f467.
+9
-9
@@ -1,13 +1,13 @@
|
||||
plugins { id("org.gradle.toolchains.foojay-resolver-convention") version ("1.0.0") }
|
||||
|
||||
rootProject.name = "Chat-OG"
|
||||
|
||||
val process: Process = ProcessBuilder("sh", "bootstrap.sh").directory(rootDir).start()
|
||||
|
||||
val exitValue = process.waitFor()
|
||||
|
||||
if (exitValue != 0) {
|
||||
throw GradleException("bootstrap.sh failed with exit code $exitValue")
|
||||
ProcessBuilder("sh", "bootstrap.sh").directory(rootDir).inheritIO().start().let {
|
||||
if (it.waitFor() != 0) throw GradleException("bootstrap.sh failed")
|
||||
}
|
||||
|
||||
include("libs:Utilities-OG")
|
||||
file("libs")
|
||||
.listFiles()
|
||||
?.filter { it.isDirectory && !it.name.startsWith(".") }
|
||||
?.forEach { dir ->
|
||||
include(":libs:${dir.name}")
|
||||
project(":libs:${dir.name}").projectDir = dir
|
||||
}
|
||||
@@ -1,11 +1,12 @@
|
||||
package nl.skbotnl.chatog
|
||||
|
||||
import de.myzelyam.api.vanish.PlayerVanishStateChangeEvent
|
||||
import de.myzelyam.api.vanish.VanishAPI
|
||||
import io.papermc.paper.advancement.AdvancementDisplay.Frame.*
|
||||
import io.papermc.paper.event.player.AsyncChatEvent
|
||||
import kotlin.concurrent.read
|
||||
import kotlinx.coroutines.launch
|
||||
import me.clip.placeholderapi.PlaceholderAPI
|
||||
import net.ess3.api.events.VanishStatusChangeEvent
|
||||
import net.kyori.adventure.text.Component
|
||||
import net.kyori.adventure.text.TextComponent
|
||||
import net.kyori.adventure.text.TranslatableComponent
|
||||
@@ -16,7 +17,6 @@ import net.trueog.utilitiesog.UtilitiesOG
|
||||
import nl.skbotnl.chatog.ChatOG.Companion.config
|
||||
import nl.skbotnl.chatog.ChatOG.Companion.discordBridge
|
||||
import nl.skbotnl.chatog.ChatOG.Companion.discordBridgeLock
|
||||
import nl.skbotnl.chatog.ChatOG.Companion.essentials
|
||||
import nl.skbotnl.chatog.ChatOG.Companion.scope
|
||||
import nl.skbotnl.chatog.util.ChatUtil
|
||||
import nl.skbotnl.chatog.util.ChatUtil.legacyToMm
|
||||
@@ -39,7 +39,7 @@ internal class Events : Listener {
|
||||
if (!config.discord.enabled) {
|
||||
return
|
||||
}
|
||||
if (essentials.getUser(event.player).isVanished && event.joinMessage() !is TextComponent) {
|
||||
if (VanishAPI.isVanished(event.player) && event.joinMessage() !is TextComponent) {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ internal class Events : Listener {
|
||||
if (!config.discord.enabled) {
|
||||
return
|
||||
}
|
||||
if (essentials.getUser(event.player).isVanished) {
|
||||
if (VanishAPI.isVanished(event.player)) {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ internal class Events : Listener {
|
||||
if (!config.discord.enabled) {
|
||||
return
|
||||
}
|
||||
if (essentials.getUser(event.player).isVanished) {
|
||||
if (VanishAPI.isVanished(event.player)) {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -113,7 +113,7 @@ internal class Events : Listener {
|
||||
if (!config.discord.enabled) {
|
||||
return
|
||||
}
|
||||
if (essentials.getUser(event.player).isVanished) {
|
||||
if (VanishAPI.isVanished(event.player)) {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -172,7 +172,7 @@ internal class Events : Listener {
|
||||
if (!config.discord.enabled) {
|
||||
return
|
||||
}
|
||||
if (essentials.getUser(event.player).isVanished) {
|
||||
if (VanishAPI.isVanished(event.player)) {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -191,8 +191,8 @@ internal class Events : Listener {
|
||||
|
||||
var nameString = "${PlayerAffix.getPrefix(event.player.uniqueId)}${event.player.name}"
|
||||
|
||||
if (PlaceholderAPI.setPlaceholders(event.player, "%simpleclans_clan_color_tag%") != "") {
|
||||
nameString = PlaceholderAPI.setPlaceholders(event.player, "&8[%simpleclans_clan_color_tag%&8] $nameString")
|
||||
if (PlaceholderAPI.setPlaceholders(event.player, "%simpleclans_union_color_tag%") != "") {
|
||||
nameString = PlaceholderAPI.setPlaceholders(event.player, "&8[%simpleclans_union_color_tag%&8] $nameString")
|
||||
}
|
||||
val nameComponent = UtilitiesOG.trueogColorize(legacyToMm(nameString))
|
||||
|
||||
@@ -214,22 +214,19 @@ internal class Events : Listener {
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
fun onVanish(event: VanishStatusChangeEvent) {
|
||||
if (event.value) {
|
||||
fun onVanish(event: PlayerVanishStateChangeEvent) {
|
||||
val player = event.player ?: return
|
||||
if (event.isVanishing) {
|
||||
val playerQuitEvent =
|
||||
PlayerQuitEvent(
|
||||
event.affected.base,
|
||||
Component.translatable(
|
||||
"multiplayer.player.left",
|
||||
NamedTextColor.YELLOW,
|
||||
event.affected.base.displayName(),
|
||||
),
|
||||
player,
|
||||
Component.translatable("multiplayer.player.left", NamedTextColor.YELLOW, player.displayName()),
|
||||
PlayerQuitEvent.QuitReason.DISCONNECTED,
|
||||
)
|
||||
JoinQuitListener().onQuit(playerQuitEvent)
|
||||
onQuit(playerQuitEvent)
|
||||
} else {
|
||||
val playerJoinEvent = PlayerJoinEvent(event.affected.base, Component.text(""))
|
||||
val playerJoinEvent = PlayerJoinEvent(player, Component.text(""))
|
||||
JoinQuitListener().onJoin(playerJoinEvent)
|
||||
onJoin(playerJoinEvent)
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ internal abstract class ChatSystem {
|
||||
|
||||
val chatComponent =
|
||||
UtilitiesOG.trueogColorize(
|
||||
ChatUtil.legacyToMm("$playerPartString <reset>${PlayerAffix.getSuffix(player.uniqueId)}")
|
||||
ChatUtil.legacyToMm("$playerPartString <reset>${PlayerAffix.getSuffix(player.uniqueId)} &7> ")
|
||||
)
|
||||
|
||||
var textComponent = Component.join(JoinConfiguration.noSeparators(), chatComponent, messageComponent)
|
||||
|
||||
@@ -21,7 +21,7 @@ internal object PlayerAffix {
|
||||
user = luckPerms.userManager.loadUser(uuid).get()
|
||||
}
|
||||
val prefixNode = user.nodes.singleOrNull { node -> node.key.startsWith("suffix.1.") }
|
||||
if (prefixNode == null) return "> "
|
||||
if (prefixNode == null) return ""
|
||||
return legacyToMm(prefixNode.key.split(".").last()) + " "
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user