diff --git a/build.gradle.kts b/build.gradle.kts index 8baac69..49db760 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,7 +8,7 @@ plugins { } group = "net.azisaba.spicyazisaban" -version = "1.0.0-${getBranch()}-${getGitHash()}${if (hasUncommittedChanges()) "-debug" else ""}" +version = "2.0.0-${getBranch()}-${getGitHash()}${if (hasUncommittedChanges()) "-debug" else ""}" java { toolchain.languageVersion.set(JavaLanguageVersion.of(17)) diff --git a/bungee/src/main/kotlin/net/azisaba/spicyAzisaBan/bungee/SpicyAzisaBanBungee.kt b/bungee/src/main/kotlin/net/azisaba/spicyAzisaBan/bungee/SpicyAzisaBanBungee.kt index 1cb7aa5..1773c90 100644 --- a/bungee/src/main/kotlin/net/azisaba/spicyAzisaBan/bungee/SpicyAzisaBanBungee.kt +++ b/bungee/src/main/kotlin/net/azisaba/spicyAzisaBan/bungee/SpicyAzisaBanBungee.kt @@ -10,6 +10,7 @@ import net.azisaba.spicyAzisaBan.common.ServerInfo import net.azisaba.spicyAzisaBan.common.chat.Component import net.azisaba.spicyAzisaBan.common.command.Command import net.azisaba.spicyAzisaBan.common.scheduler.ScheduledTask +import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer import net.md_5.bungee.api.ProxyServer import net.md_5.bungee.api.chat.TextComponent import java.io.File @@ -64,4 +65,14 @@ class SpicyAzisaBanBungee: SpicyAzisaBan() { override fun getConsoleActor(): Actor = BungeeActor(server.console) override fun getDataFolder(): Path = File("./plugins/SpicyAzisaBan").toPath() + + override fun convertComponent(component: net.kyori.adventure.text.Component): Component { + return LegacyComponentSerializer.builder() + .character('§') + .useUnusualXRepeatedCharacterHexFormat() + .build() + .serialize(component) + .let { TextComponent.fromLegacyText(it) } + .let { TextComponent(*it).toCommon() } + } } diff --git a/cli/src/main/kotlin/net/azisaba/spicyAzisaBan/cli/SpicyAzisaBanCLI.kt b/cli/src/main/kotlin/net/azisaba/spicyAzisaBan/cli/SpicyAzisaBanCLI.kt index a11d37d..8c67979 100644 --- a/cli/src/main/kotlin/net/azisaba/spicyAzisaBan/cli/SpicyAzisaBanCLI.kt +++ b/cli/src/main/kotlin/net/azisaba/spicyAzisaBan/cli/SpicyAzisaBanCLI.kt @@ -10,6 +10,7 @@ import net.azisaba.spicyAzisaBan.common.ServerInfo import net.azisaba.spicyAzisaBan.common.chat.Component import net.azisaba.spicyAzisaBan.common.command.Command import net.azisaba.spicyAzisaBan.common.scheduler.ScheduledTask +import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer import java.io.File import java.io.OutputStream import java.nio.file.Path @@ -66,4 +67,12 @@ class SpicyAzisaBanCLI: SpicyAzisaBan() { override fun executeCommand(actor: Actor, command: String) = throw AssertionError("Cannot execute command on CLI") override fun getConsoleActor(): Actor = CLIActor override fun getDataFolder(): Path = File(".").toPath() -} \ No newline at end of file + + override fun convertComponent(component: net.kyori.adventure.text.Component): Component { + return LegacyComponentSerializer.builder() + .character('§') + .build() + .serialize(component) + .let { SimpleComponent.fromLegacyText(it) } + } +} diff --git a/common/build.gradle.kts b/common/build.gradle.kts index f21ff80..48f1b24 100644 --- a/common/build.gradle.kts +++ b/common/build.gradle.kts @@ -18,5 +18,7 @@ dependencies { } api("org.ow2.asm:asm:9.7.1") api("org.ow2.asm:asm-commons:9.7.1") + api("net.kyori:adventure-text-minimessage:4.17.0") + api("net.kyori:adventure-text-serializer-legacy:4.17.0") compileOnlyApi("org.mariadb.jdbc:mariadb-java-client:3.5.0") } diff --git a/common/src/main/kotlin/net/azisaba/spicyAzisaBan/SABMessages.kt b/common/src/main/kotlin/net/azisaba/spicyAzisaBan/SABMessages.kt index 7463565..cfb9f1b 100644 --- a/common/src/main/kotlin/net/azisaba/spicyAzisaBan/SABMessages.kt +++ b/common/src/main/kotlin/net/azisaba/spicyAzisaBan/SABMessages.kt @@ -1,7 +1,7 @@ package net.azisaba.spicyAzisaBan -import net.azisaba.spicyAzisaBan.common.ChatColor import net.azisaba.spicyAzisaBan.util.Util +import net.azisaba.spicyAzisaBan.util.Util.toLegacySectionText import net.azisaba.spicyAzisaBan.util.Util.translate import util.yaml.YamlConfiguration import util.yaml.YamlObject @@ -35,14 +35,14 @@ object SABMessages { fun YamlObject.getMessage(key: String, def: String = ""): String { val raw = this.rawData[key] ?: def if (raw is String) return raw - return this.getArray(key)?.mapNotNull { o -> o?.toString() }?.joinToString("${ChatColor.RESET}\n") ?: def + return this.getArray(key)?.mapNotNull { o -> o?.toString() }?.joinToString("\n") ?: def } /** * Replaces the variables (%KEY_IN_UPPERCASE%) in string with value. */ fun String.replaceVariables(variables: Map = mapOf()): String { - var s = replace("%PREFIX%", SpicyAzisaBan.PREFIX) + var s = replace("%PREFIX%", General.prefix) .replace("%CMD_PREFIX%", SABConfig.prefix) variables.forEach { (key, value) -> s = s.replace("%${key.uppercase()}%", value) } return s @@ -79,6 +79,7 @@ object SABMessages { "millis" to Util.zero(3, c[Calendar.MILLISECOND]), ) .translate() + .toLegacySectionText() } object General { diff --git a/common/src/main/kotlin/net/azisaba/spicyAzisaBan/SpicyAzisaBan.kt b/common/src/main/kotlin/net/azisaba/spicyAzisaBan/SpicyAzisaBan.kt index 3bce816..8cc4e57 100644 --- a/common/src/main/kotlin/net/azisaba/spicyAzisaBan/SpicyAzisaBan.kt +++ b/common/src/main/kotlin/net/azisaba/spicyAzisaBan/SpicyAzisaBan.kt @@ -51,6 +51,7 @@ import net.azisaba.spicyAzisaBan.sql.migrations.DatabaseMigration import net.azisaba.spicyAzisaBan.struct.EventType import net.azisaba.spicyAzisaBan.util.TimerTasks import net.azisaba.spicyAzisaBan.util.Util +import net.azisaba.spicyAzisaBan.util.Util.toLegacySectionText import net.azisaba.spicyAzisaBan.util.Util.translate import util.promise.rewrite.Promise import xyz.acrylicstyle.sql.options.FindOptions @@ -105,7 +106,7 @@ abstract class SpicyAzisaBan { if (wasInitialized) error("Cannot construct SpicyAzisaBan more than once") wasInitialized = true instance = this - PREFIX = SABMessages.General.prefix.translate() + PREFIX = SABMessages.General.prefix.translate().toLegacySectionText() } private fun initDatabase() { @@ -220,6 +221,7 @@ abstract class SpicyAzisaBan { abstract fun executeCommand(actor: Actor, command: String) abstract fun getConsoleActor(): Actor abstract fun getDataFolder(): Path + abstract fun convertComponent(component: net.kyori.adventure.text.Component): Component class Settings { diff --git a/common/src/main/kotlin/net/azisaba/spicyAzisaBan/commands/BanListCommand.kt b/common/src/main/kotlin/net/azisaba/spicyAzisaBan/commands/BanListCommand.kt index 1a844da..ce02148 100644 --- a/common/src/main/kotlin/net/azisaba/spicyAzisaBan/commands/BanListCommand.kt +++ b/common/src/main/kotlin/net/azisaba/spicyAzisaBan/commands/BanListCommand.kt @@ -13,6 +13,7 @@ import net.azisaba.spicyAzisaBan.common.command.Command import net.azisaba.spicyAzisaBan.punishment.Punishment import net.azisaba.spicyAzisaBan.punishment.PunishmentType import net.azisaba.spicyAzisaBan.util.Util.async +import net.azisaba.spicyAzisaBan.util.Util.convert import net.azisaba.spicyAzisaBan.util.Util.filterArgKeys import net.azisaba.spicyAzisaBan.util.Util.filtr import net.azisaba.spicyAzisaBan.util.Util.send @@ -103,13 +104,13 @@ object BanListCommand: Command() { val backText = Component.text("${if (newPage > 1) newPage - 1 else "-"} << ", ChatColor.GRAY) if (newPage > 1) { backText.setColor(ChatColor.YELLOW) - backText.setHoverEvent(HoverEvent.Action.SHOW_TEXT, Component.fromLegacyText(SABMessages.General.previousPage.translate())) + backText.setHoverEvent(HoverEvent.Action.SHOW_TEXT, arrayOf(SABMessages.General.previousPage.translate().convert())) backText.setClickEvent(ClickEvent.Action.RUN_COMMAND, "/${SABConfig.prefix}banlist page=${newPage - 1} ${if (active) "--active" else ""} ${if (all) "--all" else ""} ${if (server != null) "server=\"$server\"" else ""} ${if (punishmentType != null) "type=${punishmentType.name}" else ""}") } val nextText = Component.text(" >> ${if (newPage < maxPage) newPage + 1 else "-"}", ChatColor.GRAY) if (newPage < maxPage) { nextText.setColor(ChatColor.YELLOW) - nextText.setHoverEvent(HoverEvent.Action.SHOW_TEXT, Component.fromLegacyText(SABMessages.General.nextPage.translate())) + nextText.setHoverEvent(HoverEvent.Action.SHOW_TEXT, arrayOf(SABMessages.General.nextPage.translate().convert())) nextText.setClickEvent(ClickEvent.Action.RUN_COMMAND, "/${SABConfig.prefix}banlist page=${newPage + 1} ${if (active) "--active" else ""} ${if (all) "--all" else ""} ${if (server != null) "server=\"$server\"" else ""} ${if (punishmentType != null) "type=${punishmentType.name}" else ""}") } text.addChildren(backText) diff --git a/common/src/main/kotlin/net/azisaba/spicyAzisaBan/commands/CheckCommand.kt b/common/src/main/kotlin/net/azisaba/spicyAzisaBan/commands/CheckCommand.kt index 0851bad..4624dbb 100644 --- a/common/src/main/kotlin/net/azisaba/spicyAzisaBan/commands/CheckCommand.kt +++ b/common/src/main/kotlin/net/azisaba/spicyAzisaBan/commands/CheckCommand.kt @@ -5,7 +5,6 @@ import net.azisaba.spicyAzisaBan.SABMessages import net.azisaba.spicyAzisaBan.SABMessages.replaceVariables import net.azisaba.spicyAzisaBan.SpicyAzisaBan import net.azisaba.spicyAzisaBan.common.Actor -import net.azisaba.spicyAzisaBan.common.ChatColor import net.azisaba.spicyAzisaBan.common.command.Command import net.azisaba.spicyAzisaBan.punishment.Punishment import net.azisaba.spicyAzisaBan.punishment.PunishmentType @@ -15,9 +14,9 @@ import net.azisaba.spicyAzisaBan.util.Util.async import net.azisaba.spicyAzisaBan.util.Util.filterArgKeys import net.azisaba.spicyAzisaBan.util.Util.filtr import net.azisaba.spicyAzisaBan.util.Util.isValidIPAddress -import net.azisaba.spicyAzisaBan.util.Util.plus import net.azisaba.spicyAzisaBan.util.Util.send import net.azisaba.spicyAzisaBan.util.Util.sendErrorMessage +import net.azisaba.spicyAzisaBan.util.Util.toMiniMessage import net.azisaba.spicyAzisaBan.util.Util.translate import net.azisaba.spicyAzisaBan.util.contexts.Contexts import net.azisaba.spicyAzisaBan.util.contexts.IPAddressContext @@ -51,7 +50,7 @@ object CheckCommand: Command() { if (pid != null) { Punishment.fetchPunishmentById(pid).thenDo { p -> if (p == null) { - return@thenDo actor.send(SABMessages.Commands.General.punishmentNotFound.replaceVariables().translate().format(pid)) + return@thenDo actor.send(SABMessages.Commands.General.punishmentNotFound.replaceVariables().format(pid).translate()) } actor.send(p.getHistoryMessage().complete()) } @@ -141,14 +140,14 @@ object CheckCommand: Command() { .replaceVariables( "ip" to ip, "hostname" to InetAddress.getByName(ip).hostName, - "mute_count" to (if (muteCount == 0) ChatColor.GREEN else ChatColor.RED) + muteCount.toString(), - "ban_count" to (if (banCount == 0) ChatColor.GREEN else ChatColor.RED) + banCount.toString(), - "warning_count" to (if (warningCount == 0) ChatColor.GREEN else ChatColor.RED) + warningCount.toString(), - "caution_count" to (if (cautionCount == 0) ChatColor.GREEN else ChatColor.RED) + cautionCount.toString(), + "mute_count" to (if (muteCount == 0) "" else "") + muteCount.toString(), + "ban_count" to (if (banCount == 0) "" else "") + banCount.toString(), + "warning_count" to (if (warningCount == 0) "" else "") + warningCount.toString(), + "caution_count" to (if (cautionCount == 0) "" else "") + cautionCount.toString(), "kick_count" to kickCount.toString(), "note_count" to noteCount.toString(), - "ban_info" to banInfo, - "mute_info" to muteInfo, + "ban_info" to banInfo.toMiniMessage(), + "mute_info" to muteInfo.toMiniMessage(), ) .translate() ) @@ -211,14 +210,14 @@ object CheckCommand: Command() { "uuid" to pd.uniqueId.toString(), "ip" to pd.ip.toString(), "hostname" to pd.ip?.let { InetAddress.getByName(it).hostName }.toString(), - "mute_count" to (if (muteCount == 0) ChatColor.GREEN else ChatColor.RED) + muteCount.toString(), - "ban_count" to (if (banCount == 0) ChatColor.GREEN else ChatColor.RED) + banCount.toString(), - "warning_count" to (if (warningCount == 0) ChatColor.GREEN else ChatColor.RED) + warningCount.toString(), - "caution_count" to (if (cautionCount == 0) ChatColor.GREEN else ChatColor.RED) + cautionCount.toString(), + "mute_count" to (if (muteCount == 0) "" else "") + muteCount.toString(), + "ban_count" to (if (banCount == 0) "" else "") + banCount.toString(), + "warning_count" to (if (warningCount == 0) "" else "") + warningCount.toString(), + "caution_count" to (if (cautionCount == 0) "" else "") + cautionCount.toString(), "kick_count" to kickCount.toString(), "note_count" to noteCount.toString(), - "ban_info" to banInfo, - "mute_info" to muteInfo, + "ban_info" to banInfo.toMiniMessage(), + "mute_info" to muteInfo.toMiniMessage(), ) .translate() ) diff --git a/common/src/main/kotlin/net/azisaba/spicyAzisaBan/commands/HistoryCommand.kt b/common/src/main/kotlin/net/azisaba/spicyAzisaBan/commands/HistoryCommand.kt index 2603a14..f1f9583 100644 --- a/common/src/main/kotlin/net/azisaba/spicyAzisaBan/commands/HistoryCommand.kt +++ b/common/src/main/kotlin/net/azisaba/spicyAzisaBan/commands/HistoryCommand.kt @@ -14,6 +14,7 @@ import net.azisaba.spicyAzisaBan.punishment.Punishment import net.azisaba.spicyAzisaBan.sql.SQLConnection import net.azisaba.spicyAzisaBan.struct.PlayerData import net.azisaba.spicyAzisaBan.util.Util.async +import net.azisaba.spicyAzisaBan.util.Util.convert import net.azisaba.spicyAzisaBan.util.Util.filterArgKeys import net.azisaba.spicyAzisaBan.util.Util.filtr import net.azisaba.spicyAzisaBan.util.Util.isValidIPAddress @@ -177,7 +178,7 @@ object HistoryCommand: Command() { val backText = Component.text("${if (page > 1) page - 1 else "-"} << ") if (page > 1) { backText.setColor(ChatColor.YELLOW) - backText.setHoverEvent(HoverEvent.Action.SHOW_TEXT, Component.fromLegacyText(SABMessages.General.previousPage.translate())) + backText.setHoverEvent(HoverEvent.Action.SHOW_TEXT, arrayOf(SABMessages.General.previousPage.translate().convert())) backText.setClickEvent(ClickEvent.Action.RUN_COMMAND, "/${SABConfig.prefix}history target=$target page=${page - 1} ${if (active) "--active" else ""} ${if (all) "--all" else ""} ${if (ipOpt) "-i" else ""} ${if (only) "-o" else ""}") } else { backText.setColor(ChatColor.GRAY) @@ -185,7 +186,7 @@ object HistoryCommand: Command() { val nextText = Component.text(" >> ${if (page < maxPage) page + 1 else "-"}") if (page < maxPage) { nextText.setColor(ChatColor.YELLOW) - nextText.setHoverEvent(HoverEvent.Action.SHOW_TEXT, Component.fromLegacyText(SABMessages.General.nextPage.translate())) + nextText.setHoverEvent(HoverEvent.Action.SHOW_TEXT, arrayOf(SABMessages.General.nextPage.translate().convert())) nextText.setClickEvent(ClickEvent.Action.RUN_COMMAND, "/${SABConfig.prefix}history target=$target page=${page + 1} ${if (active) "--active" else ""} ${if (all) "--all" else ""} ${if (ipOpt) "-i" else ""} ${if (only) "-o" else ""}") } else { nextText.setColor(ChatColor.GRAY) diff --git a/common/src/main/kotlin/net/azisaba/spicyAzisaBan/commands/SABCommand.kt b/common/src/main/kotlin/net/azisaba/spicyAzisaBan/commands/SABCommand.kt index 1b12a5b..f9301f4 100644 --- a/common/src/main/kotlin/net/azisaba/spicyAzisaBan/commands/SABCommand.kt +++ b/common/src/main/kotlin/net/azisaba/spicyAzisaBan/commands/SABCommand.kt @@ -54,7 +54,7 @@ object SABCommand: Command() { private val groupRemoveConfirmation = mutableMapOf() private fun Actor.sendHelp() { - send("$PREFIX${ChatColor.GREEN}SpicyAzisaBan commands") + send("$PREFIXSpicyAzisaBan commands".translate()) if (hasPermission("sab.command.spicyazisaban.group")) send("${ChatColor.RED}> ${ChatColor.AQUA}/sab group ") if (hasPermission("sab.command.spicyazisaban.info")) send("${ChatColor.RED}> ${ChatColor.AQUA}/sab info") if (hasPermission("sab.command.spicyazisaban.creategroup")) send("${ChatColor.RED}> ${ChatColor.AQUA}/sab creategroup ") @@ -166,7 +166,7 @@ object SABCommand: Command() { SpicyAzisaBan.instance.connection.punishmentHistory .delete(FindOptions.Builder().addWhere("id", id).build()) .then { list -> - if (list.isEmpty()) return@then actor.send(SABMessages.Commands.General.punishmentNotFound.replaceVariables().translate().format(id)) + if (list.isEmpty()) return@then actor.send(SABMessages.Commands.General.punishmentNotFound.replaceVariables().format(id).translate()) val v = Punishment.fromTableData(list[0]).getVariables().complete() actor.send(SABMessages.Commands.Sab.removedFromPunishmentHistory.replaceVariables(v).translate()) } @@ -181,7 +181,7 @@ object SABCommand: Command() { SpicyAzisaBan.instance.connection.punishments .delete(FindOptions.Builder().addWhere("id", id).build()) .then { list -> - if (list.isEmpty()) return@then actor.send(SABMessages.Commands.General.punishmentNotFound.replaceVariables().translate().format(id)) + if (list.isEmpty()) return@then actor.send(SABMessages.Commands.General.punishmentNotFound.replaceVariables().format(id).translate()) val v = Punishment.fromTableData(list[0]).getVariables().complete() actor.send(SABMessages.Commands.Sab.removedFromPunishment.replaceVariables(v).translate()) } diff --git a/common/src/main/kotlin/net/azisaba/spicyAzisaBan/commands/SeenCommand.kt b/common/src/main/kotlin/net/azisaba/spicyAzisaBan/commands/SeenCommand.kt index cdd01fe..ec03bc3 100644 --- a/common/src/main/kotlin/net/azisaba/spicyAzisaBan/commands/SeenCommand.kt +++ b/common/src/main/kotlin/net/azisaba/spicyAzisaBan/commands/SeenCommand.kt @@ -5,7 +5,6 @@ import net.azisaba.spicyAzisaBan.SABMessages import net.azisaba.spicyAzisaBan.SABMessages.replaceVariables import net.azisaba.spicyAzisaBan.SpicyAzisaBan import net.azisaba.spicyAzisaBan.common.Actor -import net.azisaba.spicyAzisaBan.common.ChatColor import net.azisaba.spicyAzisaBan.common.command.Command import net.azisaba.spicyAzisaBan.struct.PlayerData import net.azisaba.spicyAzisaBan.util.Util @@ -17,6 +16,7 @@ import net.azisaba.spicyAzisaBan.util.Util.isValidIPAddress import net.azisaba.spicyAzisaBan.util.Util.send import net.azisaba.spicyAzisaBan.util.Util.sendErrorMessage import net.azisaba.spicyAzisaBan.util.Util.sendOrSuppressErrorMessage +import net.azisaba.spicyAzisaBan.util.Util.toMiniMessage import net.azisaba.spicyAzisaBan.util.Util.toUUIDOrNull import net.azisaba.spicyAzisaBan.util.Util.translate import util.kt.promise.rewrite.catch @@ -82,10 +82,10 @@ object SeenCommand: Command() { val ipd = pd.ip ?.let { PlayerData.getAllByIP(it).catch { e -> actor.sendErrorMessage(e) }.complete() } ?.filter { pd2 -> pd2.uniqueId != pd.uniqueId } - val iPlayers = ipd?.joinToString("${ChatColor.WHITE}, ${ChatColor.GOLD}") { + val iPlayers = ipd?.joinToString(", ") { var prefix = "" - if (SpicyAzisaBan.instance.getPlayer(it.uniqueId)?.isOnline() == true) prefix += "${ChatColor.GREEN}" - var suffix = "${ChatColor.GOLD}" + if (SpicyAzisaBan.instance.getPlayer(it.uniqueId)?.isOnline() == true) prefix += "" + var suffix = "" if (it.ip != pd.ip) suffix += "*" "$prefix${it.name}$suffix" }.toString() @@ -95,7 +95,7 @@ object SeenCommand: Command() { "player" to pd.name, "uuid" to pd.uuid.toString(), "since" to since, - "status" to status, + "status" to status.toMiniMessage(), "ip" to pd.ip.toString(), "hostname" to pd.ip?.let { InetAddress.getByName(pd.ip).hostName }.toString(), "name_history" to pd.getUsernameHistory().complete().distinct().joinToString(", "), diff --git a/common/src/main/kotlin/net/azisaba/spicyAzisaBan/commands/WarningCommand.kt b/common/src/main/kotlin/net/azisaba/spicyAzisaBan/commands/WarningCommand.kt index 3a007d8..743e0bd 100644 --- a/common/src/main/kotlin/net/azisaba/spicyAzisaBan/commands/WarningCommand.kt +++ b/common/src/main/kotlin/net/azisaba/spicyAzisaBan/commands/WarningCommand.kt @@ -17,6 +17,7 @@ import net.azisaba.spicyAzisaBan.util.Util.getServerName import net.azisaba.spicyAzisaBan.util.Util.getServerOrGroupName import net.azisaba.spicyAzisaBan.util.Util.send import net.azisaba.spicyAzisaBan.util.Util.sendErrorMessage +import net.azisaba.spicyAzisaBan.util.Util.toLegacySectionText import net.azisaba.spicyAzisaBan.util.Util.translate import net.azisaba.spicyAzisaBan.util.contexts.Contexts import net.azisaba.spicyAzisaBan.util.contexts.PlayerContext @@ -88,7 +89,8 @@ object WarningCommand: Command() { "original_reason" to reason.text, "time" to ReloadableSABConfig.BanOnWarning.time, ) - .translate()) + .translate() + .toLegacySectionText()) val timeContext = parsed.get(Contexts.TIME, actor).complete().apply { if (!isSuccess) { SpicyAzisaBan.LOGGER.severe("Failed to parse time: ${ReloadableSABConfig.BanOnWarning.time}") diff --git a/common/src/main/kotlin/net/azisaba/spicyAzisaBan/common/Actor.kt b/common/src/main/kotlin/net/azisaba/spicyAzisaBan/common/Actor.kt index a5415eb..35e73a2 100644 --- a/common/src/main/kotlin/net/azisaba/spicyAzisaBan/common/Actor.kt +++ b/common/src/main/kotlin/net/azisaba/spicyAzisaBan/common/Actor.kt @@ -1,5 +1,6 @@ package net.azisaba.spicyAzisaBan.common +import net.azisaba.spicyAzisaBan.SpicyAzisaBan import net.azisaba.spicyAzisaBan.common.chat.Component import java.util.UUID @@ -10,6 +11,9 @@ interface Actor { fun sendMessage(vararg components: Component) fun hasPermission(permission: String): Boolean + fun sendMessage(component: net.kyori.adventure.text.Component) = + sendMessage(SpicyAzisaBan.instance.convertComponent(component)) + object Dummy : Actor { override val name = "dummy player" override val uniqueId = UUID(0, 0) diff --git a/common/src/main/kotlin/net/azisaba/spicyAzisaBan/common/PlayerActor.kt b/common/src/main/kotlin/net/azisaba/spicyAzisaBan/common/PlayerActor.kt index b61c74a..a97eda5 100644 --- a/common/src/main/kotlin/net/azisaba/spicyAzisaBan/common/PlayerActor.kt +++ b/common/src/main/kotlin/net/azisaba/spicyAzisaBan/common/PlayerActor.kt @@ -2,6 +2,7 @@ package net.azisaba.spicyAzisaBan.common import net.azisaba.spicyAzisaBan.common.chat.Component import net.azisaba.spicyAzisaBan.common.title.Title +import net.azisaba.spicyAzisaBan.util.Util.convert interface PlayerActor: Actor, PlayerConnection { /** @@ -19,6 +20,8 @@ interface PlayerActor: Actor, PlayerConnection { */ fun disconnect(vararg reason: Component) + fun disconnect(reason: net.kyori.adventure.text.Component) = disconnect(reason.convert()) + /** * Connect the player to specific server. If BungeeCord, the method might return before the player connects to the * target server. diff --git a/common/src/main/kotlin/net/azisaba/spicyAzisaBan/punishment/Punishment.kt b/common/src/main/kotlin/net/azisaba/spicyAzisaBan/punishment/Punishment.kt index b0da045..bee5218 100644 --- a/common/src/main/kotlin/net/azisaba/spicyAzisaBan/punishment/Punishment.kt +++ b/common/src/main/kotlin/net/azisaba/spicyAzisaBan/punishment/Punishment.kt @@ -8,7 +8,6 @@ import net.azisaba.spicyAzisaBan.SpicyAzisaBan import net.azisaba.spicyAzisaBan.common.Actor import net.azisaba.spicyAzisaBan.common.ChatColor import net.azisaba.spicyAzisaBan.common.PlayerActor -import net.azisaba.spicyAzisaBan.common.chat.Component import net.azisaba.spicyAzisaBan.common.title.Title import net.azisaba.spicyAzisaBan.punishment.Punishment.Flags.Companion.toDatabase import net.azisaba.spicyAzisaBan.sql.SQLConnection @@ -18,13 +17,13 @@ import net.azisaba.spicyAzisaBan.util.Util import net.azisaba.spicyAzisaBan.util.Util.async import net.azisaba.spicyAzisaBan.util.Util.broadcastMessageAfterRandomTime import net.azisaba.spicyAzisaBan.util.Util.connectToLobbyOrKick +import net.azisaba.spicyAzisaBan.util.Util.convert import net.azisaba.spicyAzisaBan.util.Util.getIPAddress import net.azisaba.spicyAzisaBan.util.Util.getProfile import net.azisaba.spicyAzisaBan.util.Util.getServerName import net.azisaba.spicyAzisaBan.util.Util.hasNotifyPermissionOf import net.azisaba.spicyAzisaBan.util.Util.isNotExpired import net.azisaba.spicyAzisaBan.util.Util.isPunishableIP -import net.azisaba.spicyAzisaBan.util.Util.kick import net.azisaba.spicyAzisaBan.util.Util.send import net.azisaba.spicyAzisaBan.util.Util.toMinecraft import net.azisaba.spicyAzisaBan.util.Util.translate @@ -253,8 +252,8 @@ data class Punishment( SABMessages.Commands.Warning.subtitle } val title = Title( - Component.fromLegacyText(rawTitle.replaceVariables().translate()), - Component.fromLegacyText(rawSubTitle.replaceVariables().translate()), + arrayOf(rawTitle.replaceVariables().translate().convert()), + arrayOf(rawSubTitle.replaceVariables().translate().convert()), 0, (SABConfig.Warning.titleStayTime / 50L).toInt(), 0, @@ -325,32 +324,32 @@ data class Punishment( ) } - fun getBannedMessage(): Promise = + fun getBannedMessage(): Promise = getVariables() .then { variables -> var layout = when (type) { - PunishmentType.BAN -> SABMessages.Commands.Ban.layout.replaceVariables(variables).translate() - PunishmentType.TEMP_BAN -> SABMessages.Commands.TempBan.layout.replaceVariables(variables).translate() - PunishmentType.IP_BAN -> SABMessages.Commands.IPBan.layout.replaceVariables(variables).translate() - PunishmentType.TEMP_IP_BAN -> SABMessages.Commands.TempIPBan.layout.replaceVariables(variables).translate() - PunishmentType.MUTE -> SABMessages.Commands.Mute.layout2.replaceVariables(variables).translate() - PunishmentType.TEMP_MUTE -> SABMessages.Commands.TempMute.layout2.replaceVariables(variables).translate() - PunishmentType.IP_MUTE -> SABMessages.Commands.IPMute.layout2.replaceVariables(variables).translate() - PunishmentType.TEMP_IP_MUTE -> SABMessages.Commands.TempIPMute.layout2.replaceVariables(variables).translate() - PunishmentType.WARNING -> SABMessages.Commands.Warning.layout.replaceVariables(variables).translate() - PunishmentType.CAUTION -> SABMessages.Commands.Caution.layout.replaceVariables(variables).translate() - PunishmentType.KICK -> SABMessages.Commands.Kick.layout.replaceVariables(variables).translate() + PunishmentType.BAN -> SABMessages.Commands.Ban.layout.replaceVariables(variables) + PunishmentType.TEMP_BAN -> SABMessages.Commands.TempBan.layout.replaceVariables(variables) + PunishmentType.IP_BAN -> SABMessages.Commands.IPBan.layout.replaceVariables(variables) + PunishmentType.TEMP_IP_BAN -> SABMessages.Commands.TempIPBan.layout.replaceVariables(variables) + PunishmentType.MUTE -> SABMessages.Commands.Mute.layout2.replaceVariables(variables) + PunishmentType.TEMP_MUTE -> SABMessages.Commands.TempMute.layout2.replaceVariables(variables) + PunishmentType.IP_MUTE -> SABMessages.Commands.IPMute.layout2.replaceVariables(variables) + PunishmentType.TEMP_IP_MUTE -> SABMessages.Commands.TempIPMute.layout2.replaceVariables(variables) + PunishmentType.WARNING -> SABMessages.Commands.Warning.layout.replaceVariables(variables) + PunishmentType.CAUTION -> SABMessages.Commands.Caution.layout.replaceVariables(variables) + PunishmentType.KICK -> SABMessages.Commands.Kick.layout.replaceVariables(variables) else -> throw AssertionError("Cannot get layout for $type") } val proofs = this.getPublicProofs().complete() if (proofs.isNotEmpty()) { layout += "\n\n" - layout += SABMessages.Commands.General.viewableProofs.replaceVariables(variables).translate() + "\n" + layout += SABMessages.Commands.General.viewableProofs.replaceVariables(variables) + "\n" layout += proofs.joinToString("\n") { proof -> - SABMessages.Commands.General.proofEntry.replaceVariables(proof.variables).translate() + SABMessages.Commands.General.proofEntry.replaceVariables(proof.variables) } } - return@then layout + return@then layout.translate() } .catch { SpicyAzisaBan.LOGGER.warning("Could not fetch player name of $operator") @@ -411,7 +410,7 @@ data class Punishment( if (!type.isIPBased()) { val player = SpicyAzisaBan.instance.getPlayer(getTargetUUID()) ?: return@async it.resolve() if (type == PunishmentType.BAN || type == PunishmentType.TEMP_BAN) { - player.connectToLobbyOrKick(server, Component.fromLegacyText(getBannedMessage().complete())).complete() + player.connectToLobbyOrKick(server, arrayOf(getBannedMessage().complete().convert())).complete() SpicyAzisaBan.instance.getServers()[notifyTargetServer]?.broadcastMessageAfterRandomTime() } else if (type == PunishmentType.WARNING || type == PunishmentType.CAUTION) { sendTitle() @@ -421,7 +420,7 @@ data class Punishment( player.send(SABMessages.Commands.TempMute.layout1.replaceVariables(getVariables().complete()).translate()) } else if (type == PunishmentType.KICK) { if (server == "global") { - player.kick(getBannedMessage().complete()) + player.disconnect(getBannedMessage().complete()) } else { val list = SpicyAzisaBan.instance.connection.getServersByGroup(server).complete() if (list.isEmpty()) { @@ -435,7 +434,7 @@ data class Punishment( .filter { it.name.startsWith("lobby") } .randomOrNull() if (lobby == null) { - player.kick(getBannedMessage().complete()) + player.disconnect(getBannedMessage().complete()) return@async it.resolve() } player.connect(lobby) @@ -445,10 +444,10 @@ data class Punishment( } else { val players = SpicyAzisaBan.instance.getPlayers().filter { it.getIPAddress() == target } if (type == PunishmentType.IP_BAN || type == PunishmentType.TEMP_IP_BAN) { - val message = Component.fromLegacyText(getBannedMessage().complete()) + val message = getBannedMessage().complete().convert() players.apply { forEach { player -> - player.connectToLobbyOrKick(server, message) + player.connectToLobbyOrKick(server, arrayOf(message)) } if (isNotEmpty()) { SpicyAzisaBan.instance.getServers()[notifyTargetServer]?.broadcastMessageAfterRandomTime() @@ -546,7 +545,7 @@ data class Punishment( if (p.type.isBan()) { if (canJoinServer(pd.uuid, null, server).complete() != null) { // kick the player - p.getBannedMessage().thenDo { SpicyAzisaBan.instance.getPlayer(pd.uuid)?.kick(it) } + p.getBannedMessage().thenDo { SpicyAzisaBan.instance.getPlayer(pd.uuid)?.disconnect(it) } } } else { // send the message @@ -569,17 +568,17 @@ data class Punishment( list.sendWebhook() } - fun getHistoryMessage(): Promise = async { context -> + fun getHistoryMessage(): Promise = async { context -> val unpunish: UnPunish? = SpicyAzisaBan.instance.connection.unpunish .findOne(FindOptions.Builder().addWhere("punish_id", this.id).setLimit(1).build()) .then { it?.let { UnPunish.fromTableData(this, it) } } .complete() - val strikethroughIfUnpunished = if (unpunish == null) "" else "${ChatColor.STRIKETHROUGH}" - val unpunishReason = if (unpunish == null) "" else SABMessages.Commands.History.unpunishReason.replaceVariables("reason" to unpunish.reason).translate() - val unpunishId = if (unpunish == null) "" else SABMessages.Commands.History.unpunishId.replaceVariables("id" to unpunish.id.toString()).translate() + val strikethroughIfUnpunished = if (unpunish == null) "" else "" + val unpunishReason = if (unpunish == null) "" else SABMessages.Commands.History.unpunishReason.replaceVariables("reason" to unpunish.reason) + val unpunishId = if (unpunish == null) "" else SABMessages.Commands.History.unpunishId.replaceVariables("id" to unpunish.id.toString()) val unpunishOperator = if (unpunish == null) "" else { val opName = unpunish.operator.getProfile().catch {}.complete()?.name ?: "Unknown" - SABMessages.Commands.History.unpunishOperator.replaceVariables("operator" to opName).translate() + SABMessages.Commands.History.unpunishOperator.replaceVariables("operator" to opName) } context.resolve( SABMessages.Commands.History.layout.replaceVariables() diff --git a/common/src/main/kotlin/net/azisaba/spicyAzisaBan/punishment/PunishmentChecker.kt b/common/src/main/kotlin/net/azisaba/spicyAzisaBan/punishment/PunishmentChecker.kt index ac40cc7..2456f16 100644 --- a/common/src/main/kotlin/net/azisaba/spicyAzisaBan/punishment/PunishmentChecker.kt +++ b/common/src/main/kotlin/net/azisaba/spicyAzisaBan/punishment/PunishmentChecker.kt @@ -12,9 +12,9 @@ import net.azisaba.spicyAzisaBan.common.ServerInfo import net.azisaba.spicyAzisaBan.common.chat.Component import net.azisaba.spicyAzisaBan.struct.PlayerData import net.azisaba.spicyAzisaBan.util.Util +import net.azisaba.spicyAzisaBan.util.Util.convert import net.azisaba.spicyAzisaBan.util.Util.getIPAddress import net.azisaba.spicyAzisaBan.util.Util.getServerName -import net.azisaba.spicyAzisaBan.util.Util.kick import net.azisaba.spicyAzisaBan.util.Util.reconstructIPAddress import net.azisaba.spicyAzisaBan.util.Util.send import net.azisaba.spicyAzisaBan.util.Util.sendDelayed @@ -34,10 +34,12 @@ object PunishmentChecker { } val exists = PlayerData.isExists(connection.uniqueId).complete() if (!exists) { - deny(Component.fromLegacyText(SABMessages.Commands.Lockdown.lockdown.replaceVariables().translate())) + deny(arrayOf(SABMessages.Commands.Lockdown.lockdown.replaceVariables().translate().convert())) val message = SABMessages.Commands.Lockdown.lockdownJoinAttempt - .replaceVariables("player" to (connection.name ?: connection.uniqueId).toString(), "IP_ADDRESS" to connection.getRemoteAddress().getIPAddress().toString()).translate() - .translate() + .replaceVariables( + "player" to (connection.name ?: connection.uniqueId).toString(), + "IP_ADDRESS" to connection.getRemoteAddress().getIPAddress().toString() + ).translate() SpicyAzisaBan.instance.getPlayers().filter { it.hasPermission("sab.lockdown") }.forEach { it.send(message) } SpicyAzisaBan.instance.getConsoleActor().send(message) } @@ -51,17 +53,17 @@ object PunishmentChecker { if (!res) { SpicyAzisaBan.LOGGER.warning("Could not check lockdown state for ${connection.uniqueId} (Timed out, > 800 ms)") if (SABConfig.database.failsafe) { - deny(Component.fromLegacyText(SABMessages.General.error.replaceVariables().translate())) + deny(arrayOf(SABMessages.General.error.replaceVariables().translate().convert())) } } }.catch { SpicyAzisaBan.LOGGER.warning("Could not check lockdown state for ${connection.uniqueId}") it.printStackTrace() if (SABConfig.database.failsafe) { - deny(Component.fromLegacyText(SABMessages.General.errorDetailed.replaceVariables( + deny(arrayOf(SABMessages.General.errorDetailed.replaceVariables( "EXCEPTION_CLASS_NAME" to it.javaClass.name, "EXCEPTION_MESSAGE" to (it.message ?: "null"), - ).translate())) + ).translate().convert())) } }.complete() } @@ -79,7 +81,7 @@ object PunishmentChecker { "global" ).complete() if (p != null) { - deny(Component.fromLegacyText(p.getBannedMessage().complete())) + deny(arrayOf(p.getBannedMessage().complete().convert())) } val time = System.currentTimeMillis() - start if (time > 1000) { @@ -91,17 +93,17 @@ object PunishmentChecker { if (!res) { SpicyAzisaBan.LOGGER.warning("Could not check punishments for ${connection.uniqueId} (Timed out, > 1500 ms)") if (SABConfig.database.failsafe) { - deny(Component.fromLegacyText(SABMessages.General.error.replaceVariables().translate())) + deny(arrayOf(SABMessages.General.error.replaceVariables().translate().convert())) } } }.catch { SpicyAzisaBan.LOGGER.warning("Could not check punishments for ${connection.uniqueId}") it.printStackTrace() if (SABConfig.database.failsafe) { - deny(Component.fromLegacyText(SABMessages.General.errorDetailed.replaceVariables( + deny(arrayOf(SABMessages.General.errorDetailed.replaceVariables( "EXCEPTION_CLASS_NAME" to it.javaClass.name, "EXCEPTION_MESSAGE" to (it.message ?: "null"), - ).translate())) + ).translate().convert())) } }.complete() } @@ -139,7 +141,7 @@ object PunishmentChecker { SpicyAzisaBan.debug("Kicking ${player.name} from ${player.getServer()?.name} asynchronously (reason: banned from ${p.server}; cached)") cancel() if (currentServer == null || player.getServer() == null) { - player.kick(p.getBannedMessage().complete()) + player.disconnect(p.getBannedMessage().complete()) } else { player.sendDelayed(100, p.getBannedMessage().complete()) } @@ -159,7 +161,7 @@ object PunishmentChecker { SpicyAzisaBan.debug(p.toString(), 2) cancel() if (currentServer == null || player.getServer() == null) { - player.kick(p.getBannedMessage().complete()) + player.disconnect(p.getBannedMessage().complete()) } else if (player.getServer() != currentServer) { player.plsConnect(currentServer, target) player.sendDelayed(2000, p.getBannedMessage().complete()) @@ -178,7 +180,7 @@ object PunishmentChecker { SpicyAzisaBan.LOGGER.warning("Could not check punishments for ${player.uniqueId} (Timed out, > 1500 ms)") if (SABConfig.database.failsafe) { cancel() - player.kick(SABMessages.General.error.replaceVariables().translate()) + player.disconnect(SABMessages.General.error.replaceVariables().translate()) } } }.catch { @@ -186,7 +188,7 @@ object PunishmentChecker { it.printStackTrace() if (SABConfig.database.failsafe) { cancel() - player.kick(SABMessages.General.errorDetailed.replaceVariables( + player.disconnect(SABMessages.General.errorDetailed.replaceVariables( "EXCEPTION_CLASS_NAME" to it.javaClass.name, "EXCEPTION_MESSAGE" to (it.message ?: "null"), ).translate()) @@ -194,7 +196,7 @@ object PunishmentChecker { }.then {} } - fun checkMute(actor: Actor, message: String, cancel: (reason: String) -> Unit) { + fun checkMute(actor: Actor, message: String, cancel: (reason: net.kyori.adventure.text.Component) -> Unit) { if (actor !is PlayerActor) return val isCommand = message.startsWith("/") if (isCommand && diff --git a/common/src/main/kotlin/net/azisaba/spicyAzisaBan/util/Util.kt b/common/src/main/kotlin/net/azisaba/spicyAzisaBan/util/Util.kt index a40a918..249fa8d 100644 --- a/common/src/main/kotlin/net/azisaba/spicyAzisaBan/util/Util.kt +++ b/common/src/main/kotlin/net/azisaba/spicyAzisaBan/util/Util.kt @@ -15,6 +15,8 @@ import net.azisaba.spicyAzisaBan.punishment.PunishmentType import net.azisaba.spicyAzisaBan.sql.SQLConnection import net.azisaba.spicyAzisaBan.struct.PlayerData import net.azisaba.spicyAzisaBan.util.contexts.ServerContext +import net.kyori.adventure.text.minimessage.MiniMessage +import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer import util.StringReader import util.UUIDUtil import util.concurrent.ref.DataCache @@ -45,13 +47,15 @@ object Util { } } - fun PlayerActor.disconnect(message: String) { - message.split("\\n|\\\\n".toRegex()).forEach { msg -> - disconnect(*Component.fromLegacyText(msg.replace(" ", " ${ChatColor.RESET} ${ChatColor.RESET}"))) - } + fun Actor.send(message: Component) { + sendMessage(message) + } + + fun Actor.send(component: net.kyori.adventure.text.Component) { + sendMessage(component) } - fun Actor.sendDelayed(timeInMillis: Long, message: String) { + fun Actor.sendDelayed(timeInMillis: Long, message: net.kyori.adventure.text.Component) { SpicyAzisaBan.instance.schedule(timeInMillis, TimeUnit.MILLISECONDS) { send(message) } } @@ -192,12 +196,21 @@ object Util { /** * Returns colored string of the boolean. */ - fun Boolean.toMinecraft() = if (this) "${ChatColor.GREEN}true" else "${ChatColor.RED}false" - - /** - * Translates '&' into section char. - */ - fun String.translate(): String = ChatColor.translateAlternateColorCodes('&', this) + fun Boolean.toMinecraft() = if (this) "true" else "false" + + fun String.translate(): net.kyori.adventure.text.Component { + val legacySectionString = ChatColor.translateAlternateColorCodes('&', this) + .replace(" ", " ") + try { + // try to parse as mini message + return MiniMessage.miniMessage().deserialize(legacySectionString) + } catch (_: Exception) { + // fallback to legacy component + val component = LegacyComponentSerializer.legacySection().deserialize(legacySectionString) + val miniMessageString = MiniMessage.miniMessage().serialize(component) + return MiniMessage.miniMessage().deserialize(miniMessageString) + } + } fun List.filterArgKeys(args: Array): List { val list = args.map { it.replace("(=.*)".toRegex(), "") } @@ -289,13 +302,6 @@ object Util { } } - /** - * Kicks the player with specified reason. The string will be automatically converted into TextComponent. - */ - fun PlayerActor.kick(reason: String) { - this.disconnect(*Component.fromLegacyText(reason.replace(" ", " ${ChatColor.RESET} ${ChatColor.RESET}"))) - } - /** * Reconstructs(Formats) IP address. * For example, this method converts `0001.001.01.1` into `1.1.1.1`. @@ -416,25 +422,9 @@ object Util { def } - /** - * Extension method to allow `ChatColor.XXXX + string`. - */ - operator fun ChatColor.plus(s: String) = "$this$s" - - fun String.getCurrentColor(char: Char = '§'): ChatColor { - val reader = StringReader(this.reversed()) - while (!reader.isEOF) { - val first = reader.readFirst().first() - if (reader.peek() == char) { - ChatColor.getByChar(first)?.let { return it } - } - } - return ChatColor.WHITE - } - fun String.toUUIDOrNull() = try { UUID.fromString(this)!! - } catch (e: IllegalArgumentException) { + } catch (_: IllegalArgumentException) { null } @@ -517,7 +507,13 @@ object Util { fun DataCache<*>.isNotExpired() = System.currentTimeMillis() <= this.ttl fun InvalidArgumentException.toComponent(): Component { - val errorComponent = Component.text(SABMessages.General.invalidSyntax.replaceVariables().format(message).translate(), ChatColor.RED) + val errorComponent = + SABMessages.General.invalidSyntax + .replaceVariables() + .format(message) + .translate() + .convert() + .apply { setColor(ChatColor.RED) } val context = this.context ?: return errorComponent val prev = context.peekWithAmount(-min(context.index(), 15)) var next = context.peekWithAmount( @@ -554,4 +550,11 @@ object Util { } fun List.limit(max: Int): List = this.subList(0, min(max, this.size)) + + fun net.kyori.adventure.text.Component.convert() = SpicyAzisaBan.instance.convertComponent(this) + + fun net.kyori.adventure.text.Component.toLegacySectionText() = + LegacyComponentSerializer.legacySection().serialize(this) + + fun net.kyori.adventure.text.Component.toMiniMessage() = MiniMessage.miniMessage().serialize(this) } diff --git a/common/src/main/resources/spicyazisaban/messages.yml b/common/src/main/resources/spicyazisaban/messages.yml index 516fe19..b0055a3 100644 --- a/common/src/main/resources/spicyazisaban/messages.yml +++ b/common/src/main/resources/spicyazisaban/messages.yml @@ -6,20 +6,20 @@ # %CMD_PREFIX% - prefix in config.yml (might be empty) general: - prefix: "&c&lSpicyAzisaBan &8&l» &r" - missingPermissions: "%PREFIX%&c権限がありません!" - error: "&c処理中に不明なエラーが発生しました。" - invalid-syntax: "&c構文エラー: %s" + prefix: "SpicyAzisaBan » " + missingPermissions: "%PREFIX%権限がありません!" + error: "処理中に不明なエラーが発生しました。" + invalid-syntax: "構文エラー: %s" - # available variables: defalt + %EXCEPTION_CLASS_NAME%, %EXCEPTION_MESSAGE% - errorDetailed: "&c処理中に不明なエラーが発生しました。 (%EXCEPTION_CLASS_NAME%)" + # available variables: default + %EXCEPTION_CLASS_NAME%, %EXCEPTION_MESSAGE% + errorDetailed: "処理中に不明なエラーが発生しました。 (%EXCEPTION_CLASS_NAME%)" # these are "words" and you can't use variables here none: "なし" global: "全サーバー" permanent: "無期限" - online: "&aオンライン" - offline: "&4オフライン" + online: "オンライン" + offline: "オフライン" previousPage: "前のページ" nextPage: "次のページ" time: @@ -32,41 +32,41 @@ general: commands: general: - invalidGroup: "%PREFIX%&c無効なグループ名です。" - invalidServer: "%PREFIX%&c無効なサーバー名です。" - invalidPlayer: "%PREFIX%&cプレイヤーが見つかりません。" - invalidTime: "%PREFIX%&c時間(&etime=&c)の形式が正しくありません。" - invalidIPAddress: "%PREFIX%&cIPアドレスの形式が正しくないか、処罰不可なIPアドレスです。" - invalidPunishmentType: "%PREFIX%&c無効な処罰タイプです。" - invalidNumber: "%PREFIX%&c無効な数値です。" - timeNotSpecified: "%PREFIX%&c時間が指定されていません。" + invalidGroup: "%PREFIX%無効なグループ名です。" + invalidServer: "%PREFIX%無効なサーバー名です。" + invalidPlayer: "%PREFIX%プレイヤーが見つかりません。" + invalidTime: "%PREFIX%時間(time=)の形式が正しくありません。" + invalidIPAddress: "%PREFIX%IPアドレスの形式が正しくないか、処罰不可なIPアドレスです。" + invalidPunishmentType: "%PREFIX%無効な処罰タイプです。" + invalidNumber: "%PREFIX%無効な数値です。" + timeNotSpecified: "%PREFIX%時間が指定されていません。" # Available variables: default, %PLAYERS% - banned player names, %PLAYERS_COUNT% - samePunishmentAppliedToSameIPAddress: "&7%PLAYERS_COUNT%人の同じIPアドレスのプレイヤーにも同じ処罰が適用されました: %PLAYERS%" - alreadyPunished: "%PREFIX%&cこのアカウントはすでに(同じサーバー、同じ種類で)処罰されています!" - removedFromServer: "&cとあるプレイヤーがこの世界から抹消された。" - offlinePlayer: "%PREFIX%&cこのプレイヤーはオフラインです。" - notPunished: "%PREFIX%&cこのアカウントは処罰されていません!" - noReasonSpecified: "%PREFIX%&c理由が指定されていません!" - noProofSpecified: "%PREFIX%&c証拠が指定されていません!" - punishmentNotFound: "%PREFIX%&c処罰#%dが見つかりません!" - proofNotFound: "%PREFIX%&c証拠#%dが見つかりません!" - viewable-proofs: "&c閲覧可能な証拠:" + samePunishmentAppliedToSameIPAddress: "%PLAYERS_COUNT%人の同じIPアドレスのプレイヤーにも同じ処罰が適用されました: %PLAYERS%" + alreadyPunished: "%PREFIX%このアカウントはすでに(同じサーバー、同じ種類で)処罰されています!" + removedFromServer: "とあるプレイヤーがこの世界から抹消された。" + offlinePlayer: "%PREFIX%このプレイヤーはオフラインです。" + notPunished: "%PREFIX%このアカウントは処罰されていません!" + noReasonSpecified: "%PREFIX%理由が指定されていません!" + noProofSpecified: "%PREFIX%証拠が指定されていません!" + punishmentNotFound: "%PREFIX%処罰#%dが見つかりません!" + proofNotFound: "%PREFIX%証拠#%dが見つかりません!" + viewable-proofs: "閲覧可能な証拠:" # Available variables: %ID% - id of proof, %TEXT% - the text of proof, %PUBLIC% - always true (with color of green) - proof-entry: " &c- &f%TEXT%" + proof-entry: " - %TEXT%" sab: - setDebugLevel: "%PREFIX%&aデバッグログレベルを&e%d&aに設定しました。" - reloadedConfiguration: "%PREFIX%&a設定を再読み込みしました。" - clearedCache: "%PREFIX%&aキャッシュを消去しました。" + setDebugLevel: "%PREFIX%デバッグログレベルを%dに設定しました。" + reloadedConfiguration: "%PREFIX%設定を再読み込みしました。" + clearedCache: "%PREFIX%キャッシュを消去しました。" deleteGroupUnpunishReason: "グループ'%GROUP%'の削除" # Available variables: default, %GROUP% (group name being removed) - removedFromPunishmentHistory: "%PREFIX%&a処罰&8<&7punishmentHistory&8>&a#%ID%を削除しました。" # Available variables: default, punishment - removedFromPunishment: "%PREFIX%&a処罰&8<&7punishments&8>&a#%ID%を削除しました。" # Available variables: default, punishment - apiTableNotFound: "%PREFIX%&cSpicyAzisaBan-APIのテーブルが存在しません。" - accountNoLinkCode: "%PREFIX%&cコードが一致しません。" - accountLinking: "%PREFIX%&aアカウントをリンク中..." + removedFromPunishmentHistory: "%PREFIX%処罰\\<punishmentHistory>#%ID%を削除しました。" # Available variables: default, punishment + removedFromPunishment: "%PREFIX%処罰\\<punishments>#%ID%を削除しました。" # Available variables: default, punishment + apiTableNotFound: "%PREFIX%SpicyAzisaBan-APIのテーブルが存在しません。" + accountNoLinkCode: "%PREFIX%コードが一致しません。" + accountLinking: "%PREFIX%アカウントをリンク中..." # Available variables: default, %USERNAME% (username of linked web account) - accountLinkComplete: "%PREFIX%&aアカウント[%USERNAME%]のリンクが完了しました。" - accountUnlinked: "%PREFIX%&aアカウントの連携をすべて解除しました。" + accountLinkComplete: "%PREFIX%アカウント[%USERNAME%]のリンクが完了しました。" + accountUnlinked: "%PREFIX%アカウントの連携をすべて解除しました。" # Available variables (all boolean values are colored automatically): default + # %SERVER_VERSION% - BungeeCord version # %DB_CONNECTED% - true if connection between database is active, false otherwise @@ -78,18 +78,18 @@ commands: # %IS_DEBUGBUILD% - is running debug build? # %SERVER_ID% - serverId in config.yml info: - - "%PREFIX%- &bインスタンス:" - - "%PREFIX% &6バージョン: &a%VERSION%" - - "%PREFIX% &6Debugビルド: %IS_DEBUGBUILD%" - - "%PREFIX% &6Devビルド: %IS_DEVBUILD%" - - "%PREFIX% &6ロックダウン: %IS_LOCKDOWN%" - - "%PREFIX%- &bサーバーバージョン" + - "%PREFIX%- インスタンス:" + - "%PREFIX% バージョン: %VERSION%" + - "%PREFIX% Debugビルド: %IS_DEBUGBUILD%" + - "%PREFIX% Devビルド: %IS_DEVBUILD%" + - "%PREFIX% ロックダウン: %IS_LOCKDOWN%" + - "%PREFIX%- サーバーバージョン" - "%PREFIX% %SERVER_NAME% %SERVER_VERSION%" - - "%PREFIX%- &bデータベース" - - "%PREFIX% &6接続済み: %DB_CONNECTED%" - - "%PREFIX% &6バージョン: %DB_VERSION%" - - "%PREFIX% &6Failsafe: %DB_FAILSAFE%" - - "%PREFIX%- &bUptime: &a%UPTIME%" + - "%PREFIX%- データベース" + - "%PREFIX% 接続済み: %DB_CONNECTED%" + - "%PREFIX% バージョン: %DB_VERSION%" + - "%PREFIX% Failsafe: %DB_FAILSAFE%" + - "%PREFIX%- Uptime: %UPTIME%" # Available variables (punishment): # %DATE% @@ -103,338 +103,338 @@ commands: # %SERVER% - Target server or group that the punishment applies to ("global" if applies to an entire network) # %DURATION% - Times left until the punishment expires # %TIME% - Duration of punishment - # %IS_EXPIRED% - &cfalse if expired, &atrue otherwise + # %IS_EXPIRED% - false if expired, true otherwise ban: - usage: "%PREFIX%&a使用法: /%CMD_PREFIX%ban [server=...]" - globalUsage: "%PREFIX%&a使用法: /%CMD_PREFIX%gban [server=...]" - done: "%PREFIX%&c&o%PLAYER%&r&7は、正常にBanされました!" + usage: "%PREFIX%使用法: /%CMD_PREFIX%ban [server=...]" + globalUsage: "%PREFIX%使用法: /%CMD_PREFIX%gban [server=...]" + done: "%PREFIX%%PLAYER%は、正常にBanされました!" notify: - - "&c&o%PLAYER%&r&7は、&e&o%SERVER%&r&7で&e&o%OPERATOR%&r&7からBanされました。" - - "&7理由 &8> &7&o%REASON%" - - "&7ID &8> &7&o#%ID%" + - "%PLAYER%は、%SERVER%%OPERATOR%からBanされました。" + - "理由 > %REASON%" + - "ID > #%ID%" layout: - - "%PREFIX%&7永久BANされました!" + - "%PREFIX%永久BANされました!" - "" - "" - - "&c対象サーバー &8&l» &7&o%SERVER%" - - "&c理由 &8&l» &7&o%REASON%" + - "対象サーバー » %SERVER%" + - "理由 » %REASON%" - "" - - "&7お問い合わせ:" - - "&eDiscord &8» &c&ncoming soon" + - "お問い合わせ:" + - "Discord » coming soon" tempban: - usage: "%PREFIX%&a使用法: /%CMD_PREFIX%tempban [server=...]" - globalUsage: "%PREFIX%&a使用法: /%CMD_PREFIX%gtempban [server=...]" - done: "%PREFIX%&c&o%PLAYER%&r&7は、正常にTempBanされました!" + usage: "%PREFIX%使用法: /%CMD_PREFIX%tempban [server=...]" + globalUsage: "%PREFIX%使用法: /%CMD_PREFIX%gtempban [server=...]" + done: "%PREFIX%%PLAYER%は、正常にTempBanされました!" notify: - - "&c&o%PLAYER%&r&7は、&e&o%SERVER%&r&7で&e&o%OPERATOR%&r&7からTempBanされました。" - - "&7理由 &8> &7&o%REASON%" - - "&7ID &8> &7&o#%ID%" - - "&7期間 &8> &7&o%TIME%" + - "%PLAYER%は、%SERVER%%OPERATOR%からTempBanされました。" + - "理由 > %REASON%" + - "ID > #%ID%" + - "期間 > %TIME%" layout: - - "%PREFIX%&7一時的にBANされました!" + - "%PREFIX%一時的にBANされました!" - "" - "" - - "&c対象サーバー &8&l» &7&o%SERVER%" - - "&c理由 &8&l» &7&o%REASON%" - - "&c期間 &8&l» &7&o%DURATION%" + - "対象サーバー » %SERVER%" + - "理由 » %REASON%" + - "期間 » %DURATION%" - "" - - "&7お問い合わせ:" - - "&eDiscord &8» &c&ncoming soon" + - "お問い合わせ:" + - "Discord » coming soon" ipban: - usage: "%PREFIX%&a使用法: /%CMD_PREFIX%ipban [server=...]" - globalUsage: "%PREFIX%&a使用法: /%CMD_PREFIX%gipban [server=...]" - done: "%PREFIX%&c&o%PLAYER%&r&7は、正常にIPBanされました!" + usage: "%PREFIX%使用法: /%CMD_PREFIX%ipban [server=...]" + globalUsage: "%PREFIX%使用法: /%CMD_PREFIX%gipban [server=...]" + done: "%PREFIX%%PLAYER%は、正常にIPBanされました!" notify: - - "&c&o%PLAYER%&r&7は、&e&o%SERVER%&7で&e&o%OPERATOR%&r&7からIPBanされました。" - - "&7理由 &8> &7&o%REASON%" - - "&7ID &8> &7&o#%ID%" + - "%PLAYER%は、%SERVER%%OPERATOR%からIPBanされました。" + - "理由 > %REASON%" + - "ID > #%ID%" layout: - - "%PREFIX%&7永久IP BANされました!" + - "%PREFIX%永久IP BANされました!" - "" - "" - - "&c対象サーバー &8&l» &7&o%SERVER%" - - "&c理由 &8&l» &7&o%REASON%" + - "対象サーバー » %SERVER%" + - "理由 » %REASON%" - "" - - "&7お問い合わせ:" - - "&eDiscord &8» &c&ncoming soon" + - "お問い合わせ:" + - "Discord » coming soon" tempipban: - usage: "%PREFIX%&a使用法: /%CMD_PREFIX%tempipban [server=...]" - globalUsage: "%PREFIX%&a使用法: /%CMD_PREFIX%gtempipban [server=...]" - done: "%PREFIX%&c&o%PLAYER%&r&7は、正常にTempIPBanされました!" + usage: "%PREFIX%使用法: /%CMD_PREFIX%tempipban [server=...]" + globalUsage: "%PREFIX%使用法: /%CMD_PREFIX%gtempipban [server=...]" + done: "%PREFIX%%PLAYER%は、正常にTempIPBanされました!" notify: - - "&c&o%PLAYER%&r&7は、&e&o%SERVER%&7で&e&o%OPERATOR%&r&7からTempIPBanされました。" - - "&7理由 &8> &7&o%REASON%" - - "&7ID &8> &7&o#%ID%" - - "&7期間 &8> &7&o%TIME%" + - "%PLAYER%は、%SERVER%%OPERATOR%からTempIPBanされました。" + - "理由 > %REASON%" + - "ID > #%ID%" + - "期間 > %TIME%" layout: - - "%PREFIX%&7一時的にIP BANされました!" + - "%PREFIX%一時的にIP BANされました!" - "" - "" - - "&c対象サーバー &8&l» &7&o%SERVER%" - - "&c理由 &8&l» &7&o%REASON%" - - "&c期間 &8&l» &7&o%DURATION%" + - "対象サーバー » %SERVER%" + - "理由 » %REASON%" + - "期間 » %DURATION%" - "" - - "&7お問い合わせ:" - - "&eDiscord &8» &c&ncoming soon" + - "お問い合わせ:" + - "Discord » coming soon" mute: - usage: "%PREFIX%&a使用法: /%CMD_PREFIX%mute [server=...]" - globalUsage: "%PREFIX%&a使用法: /%CMD_PREFIX%gmute [server=...]" - done: "%PREFIX%&c&o%PLAYER%&r&7は、正常にMuteされました!" + usage: "%PREFIX%使用法: /%CMD_PREFIX%mute [server=...]" + globalUsage: "%PREFIX%使用法: /%CMD_PREFIX%gmute [server=...]" + done: "%PREFIX%%PLAYER%は、正常にMuteされました!" notify: - - "&c&o%PLAYER%&r&7は、&e&o%SERVER%&7で&e&o%OPERATOR%&r&7からMuteされました。" - - "&7理由 &8> &7&o%REASON%" - - "&7ID &8> &7&o#%ID%" + - "%PLAYER%は、%SERVER%%OPERATOR%からMuteされました。" + - "理由 > %REASON%" + - "ID > #%ID%" layout1: # layout that shows to a player when a player got muted - - "%PREFIX%&cあなたは永久ミュートされました!" - - "&7対象サーバー &8> &7&o%SERVER%" - - "&7理由 &8> &7&o%REASON%" + - "%PREFIX%あなたは永久ミュートされました!" + - "対象サーバー > %SERVER%" + - "理由 > %REASON%" layout2: # layout that shows to a player when a player tries to speak after they got muted - - "%PREFIX%&cあなたは永久ミュートされています!" - - "&7対象サーバー &8> &7&o%SERVER%" - - "&7理由 &8> &7&o%REASON%" + - "%PREFIX%あなたは永久ミュートされています!" + - "対象サーバー > %SERVER%" + - "理由 > %REASON%" tempmute: - usage: "%PREFIX%&a使用法: /%CMD_PREFIX%tempmute [server=...]" - globalUsage: "%PREFIX%&a使用法: /%CMD_PREFIX%gtempmute [server=...]" - done: "%PREFIX%&c&o%PLAYER%&r&7は、正常にTempMuteされました!" + usage: "%PREFIX%使用法: /%CMD_PREFIX%tempmute [server=...]" + globalUsage: "%PREFIX%使用法: /%CMD_PREFIX%gtempmute [server=...]" + done: "%PREFIX%%PLAYER%は、正常にTempMuteされました!" notify: - - "&c&o%PLAYER%&r&7は、&e&o%SERVER%&7で&e&o%OPERATOR%&r&7からTempMuteされました。" - - "&7理由 &8> &7&o%REASON%" - - "&7ID &8> &7&o#%ID%" - - "&7期間 &8> &7&o%TIME%" + - "%PLAYER%は、%SERVER%%OPERATOR%からTempMuteされました。" + - "理由 > %REASON%" + - "ID > #%ID%" + - "期間 > %TIME%" layout1: # layout that shows to a player when a player got muted - - "%PREFIX%&cあなたは一時的にミュートされました!" - - "&7対象サーバー &8> &7&o%SERVER%" - - "&7理由 &8> &7&o%REASON%" - - "&7期間 &8> &7&o%DURATION%" + - "%PREFIX%あなたは一時的にミュートされました!" + - "対象サーバー > %SERVER%" + - "理由 > %REASON%" + - "期間 > %DURATION%" layout2: # layout that shows to a player when a player tries to speak after they got muted - - "%PREFIX%&cあなたは一時的にミュートされています!" - - "&7対象サーバー &8> &7&o%SERVER%" - - "&7理由 &8> &7&o%REASON%" - - "&7期間 &8> &7&o%DURATION%" + - "%PREFIX%あなたは一時的にミュートされています!" + - "対象サーバー > %SERVER%" + - "理由 > %REASON%" + - "期間 > %DURATION%" ipmute: - usage: "%PREFIX%&a使用法: /%CMD_PREFIX%ipmute [server=...]" - globalUsage: "%PREFIX%&a使用法: /%CMD_PREFIX%gipmute [server=...]" - done: "%PREFIX%&c&o%PLAYER%&r&7は、正常にIPMuteされました!" + usage: "%PREFIX%使用法: /%CMD_PREFIX%ipmute [server=...]" + globalUsage: "%PREFIX%使用法: /%CMD_PREFIX%gipmute [server=...]" + done: "%PREFIX%%PLAYER%は、正常にIPMuteされました!" notify: - - "&c&o%PLAYER%&r&7は、&e&o%SERVER%&7で&e&o%OPERATOR%&r&7からIPMuteされました。" - - "&7理由 &8> &7&o%REASON%" - - "&7ID &8> &7&o#%ID%" + - "%PLAYER%は、%SERVER%%OPERATOR%からIPMuteされました。" + - "理由 > %REASON%" + - "ID > #%ID%" layout1: # layout that shows to a player when a player got muted - - "%PREFIX%&cあなたは永久IPミュートされました!" - - "&7対象サーバー &8> &7&o%SERVER%" - - "&7理由 &8> &7&o%REASON%" + - "%PREFIX%あなたは永久IPミュートされました!" + - "対象サーバー > %SERVER%" + - "理由 > %REASON%" layout2: # layout that shows to a player when a player tries to speak after they got muted - - "%PREFIX%&cあなたは永久IPミュートされています!" - - "&7対象サーバー &8> &7&o%SERVER%" - - "&7理由 &8> &7&o%REASON%" + - "%PREFIX%あなたは永久IPミュートされています!" + - "対象サーバー > %SERVER%" + - "理由 > %REASON%" tempipmute: - usage: "%PREFIX%&a使用法: /%CMD_PREFIX%tempipmute [server=...]" - globalUsage: "%PREFIX%&a使用法: /%CMD_PREFIX%gtempipmute [server=...]" - done: "%PREFIX%&c&o%PLAYER%&r&7は、正常にTempIPMuteされました!" + usage: "%PREFIX%使用法: /%CMD_PREFIX%tempipmute [server=...]" + globalUsage: "%PREFIX%使用法: /%CMD_PREFIX%gtempipmute [server=...]" + done: "%PREFIX%%PLAYER%は、正常にTempIPMuteされました!" notify: - - "&c&o%PLAYER%&r&7は、&e&o%SERVER%&7で&e&o%OPERATOR%&r&7からTempIPMuteされました。" - - "&7理由 &8> &7&o%REASON%" - - "&7ID &8> &7&o#%ID%" - - "&7期間 &8> &7&o%TIME%" + - "%PLAYER%は、%SERVER%%OPERATOR%からTempIPMuteされました。" + - "理由 > %REASON%" + - "ID > #%ID%" + - "期間 > %TIME%" layout1: # layout that shows to a player when a player got muted - - "%PREFIX%&cあなたは一時的にIPミュートされました!" - - "&7対象サーバー &8> &7&o%SERVER%" - - "&7理由 &8> &7&o%REASON%" - - "&7期間 &8> &7&o%DURATION%" + - "%PREFIX%あなたは一時的にIPミュートされました!" + - "対象サーバー > %SERVER%" + - "理由 > %REASON%" + - "期間 > %DURATION%" layout2: # layout that shows to a player when a player tries to speak after they got muted - - "%PREFIX%&cあなたは一時的にIPミュートされています!" - - "&7対象サーバー &8> &7&o%SERVER%" - - "&7理由 &8> &7&o%REASON%" - - "&7期間 &8> &7&o%DURATION%" + - "%PREFIX%あなたは一時的にIPミュートされています!" + - "対象サーバー > %SERVER%" + - "理由 > %REASON%" + - "期間 > %DURATION%" warning: - usage: "%PREFIX%&a使用法: /%CMD_PREFIX%warning [server=...]" - globalUsage: "%PREFIX%&a使用法: /%CMD_PREFIX%gwarning [server=...]" - done: "%PREFIX%&c&o%PLAYER%&r&7は、正常にWarnされました!" + usage: "%PREFIX%使用法: /%CMD_PREFIX%warning [server=...]" + globalUsage: "%PREFIX%使用法: /%CMD_PREFIX%gwarning [server=...]" + done: "%PREFIX%%PLAYER%は、正常にWarnされました!" notify: - - "&c&o%PLAYER%&r&7は、&e&o%SERVER%&7で&e&o%OPERATOR%&r&7からWarnされました。" - - "&7理由 &8> &7&o%REASON%" - - "&7ID &8> &7&o#%ID%" - - "&7期間 &8> &7&o%TIME%" + - "%PLAYER%は、%SERVER%%OPERATOR%からWarnされました。" + - "理由 > %REASON%" + - "ID > #%ID%" + - "期間 > %TIME%" layout: - - "%PREFIX%&c警告を受けました" - - "&c対象サーバー &8> &7&o%SERVER%" - - "&c理由 &8> &7&o%REASON%" - title: "&cあなたは警告を受けました!" - subtitle: "&6/%CMD_PREFIX%warns&eで表示を解除することができます" + - "%PREFIX%警告を受けました" + - "対象サーバー > %SERVER%" + - "理由 > %REASON%" + title: "あなたは警告を受けました!" + subtitle: "/%CMD_PREFIX%warnsで表示を解除することができます" caution: - usage: "%PREFIX%&a使用法: /%CMD_PREFIX%caution [server=...]" - globalUsage: "%PREFIX%&a使用法: /%CMD_PREFIX%gcaution [server=...]" - done: "%PREFIX%&c&o%PLAYER%&r&7は、正常にCautionされました!" + usage: "%PREFIX%使用法: /%CMD_PREFIX%caution [server=...]" + globalUsage: "%PREFIX%使用法: /%CMD_PREFIX%gcaution [server=...]" + done: "%PREFIX%%PLAYER%は、正常にCautionされました!" notify: - - "&c&o%PLAYER%&r&7は、&e&o%SERVER%&7で&e&o%OPERATOR%&r&7からCautionされました。" - - "&7理由 &8> &7&o%REASON%" - - "&7ID &8> &7&o#%ID%" - - "&7期間 &8> &7&o%TIME%" + - "%PLAYER%は、%SERVER%%OPERATOR%からCautionされました。" + - "理由 > %REASON%" + - "ID > #%ID%" + - "期間 > %TIME%" layout: - - "%PREFIX%&c注意を受けました" - - "&c対象サーバー &8> &7&o%SERVER%" - - "&c理由 &8> &7&o%REASON%" - title: "&cあなたは注意を受けました!" - subtitle: "&6/%CMD_PREFIX%warns&eで表示を解除することができます" + - "%PREFIX%注意を受けました" + - "対象サーバー > %SERVER%" + - "理由 > %REASON%" + title: "あなたは注意を受けました!" + subtitle: "/%CMD_PREFIX%warnsで表示を解除することができます" kick: - usage: "%PREFIX%&a使用法: /%CMD_PREFIX%kick [server=...]" - globalUsage: "%PREFIX%&a使用法: /%CMD_PREFIX%gkick [server=...]" - done: "%PREFIX%&c&o%PLAYER%&r&7は、正常にKickされました!" + usage: "%PREFIX%使用法: /%CMD_PREFIX%kick [server=...]" + globalUsage: "%PREFIX%使用法: /%CMD_PREFIX%gkick [server=...]" + done: "%PREFIX%%PLAYER%は、正常にKickされました!" notify: - - "&c&o%PLAYER%&r&7は、&e&o%SERVER%&7で&e&o%OPERATOR%&r&7からKickされました。" - - "&7理由 &8> &7&o%REASON%" - - "&7ID &8> &7&o#%ID%" + - "%PLAYER%は、%SERVER%%OPERATOR%からKickされました。" + - "理由 > %REASON%" + - "ID > #%ID%" layout: - - "%PREFIX%&cサーバーからキックされました" - - "&c理由 &8> &7%REASON%" + - "%PREFIX%サーバーからキックされました" + - "理由 > %REASON%" note: - usage: "%PREFIX%&a使用法: /%CMD_PREFIX%note [server=...]" - globalUsage: "%PREFIX%&a使用法: /%CMD_PREFIX%gnote [server=...]" - done: "%PREFIX%&c&o%PLAYER%&r&7は、正常にNoteされました!" + usage: "%PREFIX%使用法: /%CMD_PREFIX%note [server=...]" + globalUsage: "%PREFIX%使用法: /%CMD_PREFIX%gnote [server=...]" + done: "%PREFIX%%PLAYER%は、正常にNoteされました!" notify: - - "&c&o%PLAYER%&r&7は、&e&o%SERVER%&7で&e&o%OPERATOR%&r&7からNoteされました。" - - "&7理由 &8> &7&o%REASON%" - - "&7ID &8> &7&o#%ID%" + - "%PLAYER%は、%SERVER%%OPERATOR%からNoteされました。" + - "理由 > %REASON%" + - "ID > #%ID%" unpunish: - usage: "%PREFIX%&a使用法: /%CMD_PREFIX%unpunish " - unbanUsage: "%PREFIX%&a使用法: /%CMD_PREFIX%unban [server=...]" - unmuteUsage: "%PREFIX%&a使用法: /%CMD_PREFIX%unmute [server=...]" - done: "%PREFIX%&c&o%PLAYER%&r&7は、正常にUnpunishされました!" + usage: "%PREFIX%使用法: /%CMD_PREFIX%unpunish " + unbanUsage: "%PREFIX%使用法: /%CMD_PREFIX%unban [server=...]" + unmuteUsage: "%PREFIX%使用法: /%CMD_PREFIX%unmute [server=...]" + done: "%PREFIX%%PLAYER%は、正常にUnpunishされました!" # %TYPE%, %PREASON%, %PID% can be used here notify: - - "&c&o%PLAYER%&r&7は、&e&o%SERVER%&7で&e&o%OPERATOR%&r&7からUnpunishされました。" - - "&7処罰タイプ &8> &7&o%TYPE%" - - "&7処罰理由 &8> &7&o%PREASON%" - - "&7処罰ID &8> &7&o#%PID%" - - "&7解除理由 &8> &7&o%REASON%" - - "&7ID &8> &7&o#%ID%" + - "%PLAYER%は、%SERVER%%OPERATOR%からUnpunishされました。" + - "処罰タイプ > %TYPE%" + - "処罰理由 > %PREASON%" + - "処罰ID > #%PID%" + - "解除理由 > %REASON%" + - "ID > #%ID%" changereason: - usage: "%PREFIX%&a使用法: /%CMD_PREFIX%changereason " - done: "%PREFIX%&7処罰&a#%ID%&7は正常に更新されました。" + usage: "%PREFIX%使用法: /%CMD_PREFIX%changereason " + done: "%PREFIX%処罰#%ID%は正常に更新されました。" addproof: - usage: "%PREFIX%&a使用法: /%CMD_PREFIX%addproof [public]" + usage: "%PREFIX%使用法: /%CMD_PREFIX%addproof [public]" # %PID% can be used here (punishment id), %ID% for proof id, %TEXT% for proof text, and %PUBLIC% for colored true/false value - done: "%PREFIX%&7処罰&a#%PID%&7に証拠を追加しました。&8(&7ID: &e%ID%&f, &7Public: %PUBLIC%&8)" + done: "%PREFIX%処罰#%PID%に証拠を追加しました。(ID: %ID%, Public: %PUBLIC%)" updateproof: - usage: "%PREFIX%&a使用法: /%CMD_PREFIX%updateproof [text=\"...\"] [public]" + usage: "%PREFIX%使用法: /%CMD_PREFIX%updateproof [text=\"...\"] [public]" # %PID% can be used here (punishment id), %ID% for proof id, %TEXT% for proof text, and %PUBLIC% for colored true/false value - done: "%PREFIX%&7処罰&a#%PID%&7の証拠&a#%ID%&7は正常に更新されました。" + done: "%PREFIX%処罰#%PID%の証拠#%ID%は正常に更新されました。" delproof: - usage: "%PREFIX%&a使用法: /%CMD_PREFIX%delproof " + usage: "%PREFIX%使用法: /%CMD_PREFIX%delproof " # %PID% can be used here (punishment id), and %ID% is proof id # and %TEXT% for original proof text - done: "%PREFIX%&7処罰&a#%PID%&7から証拠を削除しました。&8(&7ID: &e%ID%&8)" + done: "%PREFIX%処罰#%PID%から証拠を削除しました。(ID: %ID%)" seen: - usage: "%PREFIX%&a使用法: /%CMD_PREFIX%seen " - searching: "%PREFIX%&eプレイヤーを検索中..." + usage: "%PREFIX%使用法: /%CMD_PREFIX%seen " + searching: "%PREFIX%プレイヤーを検索中..." # Available variables: %PLAYER%, %SINCE%, %STATUS%, %NAME_HISTORY%, %IP%, %HOSTNAME%, %IP_HISTORY%, # %SAME_IP_PLAYERS%, %SAME_IP_PLAYERS_COUNT%, %FIRST_LOGIN%, %FIRST_LOGIN_ATTEMPT%, %LAST_LOGIN%, %LAST_LOGIN_ATTEMPT% layout: - - "%PREFIX%&c&o%PLAYER%&eは&c%SINCE%前&eから%STATUS%&eです。" - - "&7UUID &8> &e&o%UUID%" - - "&7最初のログイン &8> &e&o%FIRST_LOGIN%" - - "&7最初のログイン試行 &8> &e&o%FIRST_LOGIN_ATTEMPT%" - - "&7最近のログイン &8> &e&o%LAST_LOGIN%" - - "&7最近のログイン試行 &8> &e&o%LAST_LOGIN_ATTEMPT%" - - "&7過去の名前 &8> &e&o%NAME_HISTORY%" - - "&7最近のIPアドレス &8> &e&o%IP% &7(&e%HOSTNAME%&7)" - - "&7過去のすべてのIPアドレス &8> &e&o%IP_HISTORY%" - - "&7同じIPで接続しているプレイヤー &8> &6%SAME_IP_PLAYERS%" + - "%PREFIX%%PLAYER%%SINCE%前から%STATUS%です。" + - "UUID > %UUID%" + - "最初のログイン > %FIRST_LOGIN%" + - "最初のログイン試行 > %FIRST_LOGIN_ATTEMPT%" + - "最近のログイン > %LAST_LOGIN%" + - "最近のログイン試行 > %LAST_LOGIN_ATTEMPT%" + - "過去の名前 > %NAME_HISTORY%" + - "最近のIPアドレス > %IP% (%HOSTNAME%)" + - "過去のすべてのIPアドレス > %IP_HISTORY%" + - "同じIPで接続しているプレイヤー > %SAME_IP_PLAYERS%" # Available variables: %PLAYERS_COUNT%, %PLAYERS%, %HOSTNAME%, %IP_ADDRESS% # * = they have different ip now # green player name = currently online layoutIP: - - "%PREFIX%&c&o%IP_ADDRESS% &8(&e&o%HOSTNAME%&8)&eは過去に%PLAYERS_COUNT%個のアカウントで接続しています:" - - "&6%PLAYERS%" + - "%PREFIX%%IP_ADDRESS% (%HOSTNAME%)は過去に%PLAYERS_COUNT%個のアカウントで接続しています:" + - "%PLAYERS%" warns: # Available variables: default - notWarnedYet: "%PREFIX%&c&oまだ警告を受けていません。" - header: "%PREFIX%&c有効な警告一覧:" + notWarnedYet: "%PREFIX%まだ警告を受けていません。" + header: "%PREFIX%有効な警告一覧:" # Available variables: punishment, default layout: - - "&8[&e%DATE%&8]" - - "&cタイプ &8> &7&o%TYPE%" - - "&c対象サーバー &8> &7&o%SERVER%" - - "&c理由 &8> &7&o%REASON%" + - "[%DATE%]" + - "タイプ > %TYPE%" + - "対象サーバー > %SERVER%" + - "理由 > %REASON%" history: - usage: "%PREFIX%&a使用法: /%CMD_PREFIX%history [page=...] [--all] [--active]" + usage: "%PREFIX%使用法: /%CMD_PREFIX%history [page=...] [--all] [--active]" # Available variables: %TARGET% - header: "%PREFIX%&c&o%TARGET%&7の履歴:" + header: "%PREFIX%%TARGET%の履歴:" # Available variables: variables of punishment + %DATE%, %STRIKETHROUGH_IF_UNPUNISHED%, %UNPUNISH_REASON%, # %UNPUNISH_ID%, %UNPUNISH_OPERATOR%, %FLAGS% layout: - - "&8[&e%DATE%&8] &8(&e/%CMD_PREFIX%proofs %ID%&7で証拠を表示&8)" - - "&c名前/IP &8> &7&o%PLAYER%" - - "&cタイプ &8> &7&o%TYPE%" - - "&c期間 &8> &7&o%STRIKETHROUGH_IF_UNPUNISHED%%TIME% &7(&e期限切れ: %IS_EXPIRED%&7)" - - "&c理由 &8> &7&o%REASON% %UNPUNISH_REASON%" - - "&cID &8> &7&o#%ID% %UNPUNISH_ID%" - - "&cサーバー &8> &7&o%SERVER%" - - "&c執行者 &8> &7&o%OPERATOR% %UNPUNISH_OPERATOR%" - - "&cフラグ &8> &7&o%FLAGS%" + - "[%DATE%] (/%CMD_PREFIX%proofs %ID%で証拠を表示)" + - "名前/IP > %PLAYER%" + - "タイプ > %TYPE%" + - "期間 > %STRIKETHROUGH_IF_UNPUNISHED%%TIME% (期限切れ: %IS_EXPIRED%)" + - "理由 > %REASON% %UNPUNISH_REASON%" + - "ID > #%ID% %UNPUNISH_ID%" + - "サーバー > %SERVER%" + - "執行者 > %OPERATOR% %UNPUNISH_OPERATOR%" + - "フラグ > %FLAGS%" # Available variables: %CURRENT_PAGE%, %MAX_PAGE%, %COUNT% - footer: "&7ページ &e&o%CURRENT_PAGE%&7/&e&o%MAX_PAGE% &8| &7処罰件数: &e&o%COUNT%" + footer: "ページ %CURRENT_PAGE%/%MAX_PAGE% | 処罰件数: %COUNT%" # Available variables: %REASON% - unpunishReason: "&8(&7解除理由: &e%REASON%&8)" + unpunishReason: "(解除理由: %REASON%)" # Available variables: %ID% - unpunishId: "&8(&7解除ID: &e%ID%&8)" + unpunishId: "(解除ID: %ID%)" # Available variables: %OPERATOR% - unpunishOperator: "&8(&7解除者: &e%OPERATOR%&8)" + unpunishOperator: "(解除者: %OPERATOR%)" # Available variables: default - invalidArguments: "%PREFIX%&e--all&cと&e--active&cを同時に使用することはできません。" + invalidArguments: "%PREFIX%--all--activeを同時に使用することはできません。" check: - usage: "%PREFIX%&a使用法: /%CMD_PREFIX%check [--ip] [--only]" - searching: "%PREFIX%&eプレイヤーを検索中..." + usage: "%PREFIX%使用法: /%CMD_PREFIX%check [--ip] [--only]" + searching: "%PREFIX%プレイヤーを検索中..." # Available variables: %NAME%, %UUID%, %IP%, %HOSTNAME%, %MUTE_COUNT%, %BAN_COUNT%, %WARNING_COUNT%, # %CAUTION_COUNT%, %NOTE_COUNT%, %KICK_COUNT%, %BAN_INFO%, %MUTE_INFO% layout: - - "&cプレイヤー &8> &e%NAME% &8(&e%UUID%&8)" - - "&cIPアドレス &8> &e%IP% &8(&e%HOSTNAME%&8)" - - "&cMute &8> &7%MUTE_INFO%" - - "&cBan &8> &7%BAN_INFO%" - - "&c警告数 &8> &7%WARNING_COUNT%" - - "&c注意数 &8> &7%CAUTION_COUNT%" - - "&cノート &8> &7%NOTE_COUNT%" - - "&cキック &8> &7%KICK_COUNT%" + - "プレイヤー > %NAME% (%UUID%)" + - "IPアドレス > %IP% (%HOSTNAME%)" + - "Mute > %MUTE_INFO%" + - "Ban > %BAN_INFO%" + - "警告数 > %WARNING_COUNT%" + - "注意数 > %CAUTION_COUNT%" + - "ノート > %NOTE_COUNT%" + - "キック > %KICK_COUNT%" # Available variables: %IP%, %HOSTNAME%, %MUTE_COUNT%, %BAN_COUNT%, %WARNING_COUNT%, %CAUTION_COUNT%, %NOTE_COUNT%, # %KICK_COUNT%, %BAN_INFO%, %MUTE_INFO% layoutIP: - - "&cIPアドレス &8> &e%IP% &8(&e%HOSTNAME%&8)" - - "&cMute &8> &7%MUTE_INFO%" - - "&cBan &8> &7%BAN_INFO%" - - "&c警告数 &8> &7%WARNING_COUNT%" - - "&c注意数 &8> &7%CAUTION_COUNT%" - - "&cノート &8> &7%NOTE_COUNT%" + - "IPアドレス > %IP% (%HOSTNAME%)" + - "Mute > %MUTE_INFO%" + - "Ban > %BAN_INFO%" + - "警告数 > %WARNING_COUNT%" + - "注意数 > %CAUTION_COUNT%" + - "ノート > %NOTE_COUNT%" # Available variables for banInfo and muteInfo: default, punishment - banInfo: "&c%DURATION% &8(&7ID: &e#%ID%&7, &7理由: &e&o%REASON%&8)" - muteInfo: "&c%DURATION% &8(&7ID: &e#%ID%&7, &7理由: &e&o%REASON%&8)" - cannotUseTargetAndID: "%PREFIX%&c&etarget=&cと&eid=&cを併用することはできません。" + banInfo: "%DURATION% (ID: #%ID%, 理由: %REASON%)" + muteInfo: "%DURATION% (ID: #%ID%, 理由: %REASON%)" + cannotUseTargetAndID: "%PREFIX%target=id=を併用することはできません。" proofs: - usage: "%PREFIX%&a使用法: /%CMD_PREFIX%proofs " + usage: "%PREFIX%使用法: /%CMD_PREFIX%proofs " # Available variables: punishment + %PID% (punishment id) - header: "%PREFIX%&e処罰&a#%PID%&eの証拠一覧:" + header: "%PREFIX%処罰#%PID%の証拠一覧:" # Available variables: %PID% (punishment id), %ID% (proof id), %TEXT% (proof text), %PUBLIC% (colored true/false value) layout: - - "&c&o証拠ID #%ID% &7(公開: %PUBLIC%&7) &8> &e&o%TEXT%" + - "証拠ID #%ID% (公開: %PUBLIC%) > %TEXT%" banlist: - usage: "%PREFIX%&a使用法: /%CMD_PREFIX%banlist [page=...] [type=...] [server=...] [--all] [--active]" + usage: "%PREFIX%使用法: /%CMD_PREFIX%banlist [page=...] [type=...] [server=...] [--all] [--active]" # Available variables: default - header: "%PREFIX%&7処罰履歴:" + header: "%PREFIX%処罰履歴:" # Available variables: %CURRENT_PAGE%, %MAX_PAGE%, %COUNT% - footer: "&7ページ &e&o%CURRENT_PAGE%&7/&e&o%MAX_PAGE% &8| &7処罰件数: &e&o%COUNT%" + footer: "ページ %CURRENT_PAGE%/%MAX_PAGE% | 処罰件数: %COUNT%" # Available variables: default - invalidArguments: "%PREFIX%&e--all&cと&e--active&cを同時に使用することはできません。" + invalidArguments: "%PREFIX%--all--activeを同時に使用することはできません。" lockdown: - usage: "%PREFIX%&a使用法: /%CMD_PREFIX%lockdown " + usage: "%PREFIX%使用法: /%CMD_PREFIX%lockdown " lockdown: - - "%PREFIX%&c現在新規参加者を受け付けていません。" - - "&cしばらく時間が経った後に再参加してください。" + - "%PREFIX%現在新規参加者を受け付けていません。" + - "しばらく時間が経った後に再参加してください。" # Available variables: default, %PLAYER%, %IP_ADDRESS% - lockdownJoinAttempt: "&e[Lockdown] &7新規プレイヤー'&e&o%PLAYER%&r&7'が参加しようとしました。IPアドレス: %IP_ADDRESS%" + lockdownJoinAttempt: "[Lockdown] 新規プレイヤー'%PLAYER%'が参加しようとしました。IPアドレス: %IP_ADDRESS%" # Available variables for (enabled|disabled)Lockdown: default, %ACTOR% (actor who toggled the lockdown) - enabledLockdown: "%PREFIX%&e&o%ACTOR%&r&7がサーバーロックダウンを&e有効&7にしました。" - disabledLockdown: "%PREFIX%&e&o%ACTOR%&r&7がサーバーロックダウンを&e無効&7にしました。" + enabledLockdown: "%PREFIX%%ACTOR%がサーバーロックダウンを有効にしました。" + disabledLockdown: "%PREFIX%%ACTOR%がサーバーロックダウンを無効にしました。" namehistory: - usage: "%PREFIX%&a使用法: /%CMD_PREFIX%namehistory " + usage: "%PREFIX%使用法: /%CMD_PREFIX%namehistory " diff --git a/velocity/src/main/kotlin/net/azisaba/spicyAzisaBan/velocity/SpicyAzisaBanVelocity.kt b/velocity/src/main/kotlin/net/azisaba/spicyAzisaBan/velocity/SpicyAzisaBanVelocity.kt index 123f98e..7670b0a 100644 --- a/velocity/src/main/kotlin/net/azisaba/spicyAzisaBan/velocity/SpicyAzisaBanVelocity.kt +++ b/velocity/src/main/kotlin/net/azisaba/spicyAzisaBan/velocity/SpicyAzisaBanVelocity.kt @@ -76,4 +76,6 @@ class SpicyAzisaBanVelocity(private val server: ProxyServer): SpicyAzisaBan() { override fun getConsoleActor(): Actor = VelocityActor(server.consoleCommandSource) override fun getDataFolder(): Path = File("./plugins/SpicyAzisaBan").toPath() + + override fun convertComponent(component: KComponent): Component = VelocityComponent(component) } diff --git a/velocity/src/main/kotlin/net/azisaba/spicyAzisaBan/velocity/VelocityActor.kt b/velocity/src/main/kotlin/net/azisaba/spicyAzisaBan/velocity/VelocityActor.kt index 9b09136..b36356a 100644 --- a/velocity/src/main/kotlin/net/azisaba/spicyAzisaBan/velocity/VelocityActor.kt +++ b/velocity/src/main/kotlin/net/azisaba/spicyAzisaBan/velocity/VelocityActor.kt @@ -6,7 +6,6 @@ import com.velocitypowered.api.proxy.Player import net.azisaba.spicyAzisaBan.common.Actor import net.azisaba.spicyAzisaBan.common.chat.Component import net.azisaba.spicyAzisaBan.velocity.util.VelocityUtil.toVelocity -import net.kyori.adventure.text.TextComponent import java.util.UUID open class VelocityActor(val source: CommandSource): Actor { @@ -33,7 +32,7 @@ open class VelocityActor(val source: CommandSource): Actor { } override fun sendMessage(vararg components: Component) { - source.sendMessage(TextComponent.ofChildren(*components.toVelocity())) + source.sendMessage(net.kyori.adventure.text.Component.textOfChildren(*components.toVelocity())) } override fun hasPermission(permission: String): Boolean = source.hasPermission(permission) diff --git a/velocity/src/main/kotlin/net/azisaba/spicyAzisaBan/velocity/listener/EventListeners.kt b/velocity/src/main/kotlin/net/azisaba/spicyAzisaBan/velocity/listener/EventListeners.kt index 1441f16..d205bca 100644 --- a/velocity/src/main/kotlin/net/azisaba/spicyAzisaBan/velocity/listener/EventListeners.kt +++ b/velocity/src/main/kotlin/net/azisaba/spicyAzisaBan/velocity/listener/EventListeners.kt @@ -12,7 +12,6 @@ import com.velocitypowered.api.proxy.Player import net.azisaba.spicyAzisaBan.common.ServerInfo import net.azisaba.spicyAzisaBan.punishment.PunishmentChecker import net.azisaba.spicyAzisaBan.struct.PlayerData -import net.azisaba.spicyAzisaBan.util.Util.disconnect import net.azisaba.spicyAzisaBan.util.Util.send import net.azisaba.spicyAzisaBan.velocity.VelocityPlayerActor import net.azisaba.spicyAzisaBan.velocity.util.VelocityUtil.toVelocity