diff --git a/adapters/BasicAdapter/src/main/kotlin/me/gabber235/typewriter/entries/cinematic/ActionBarDialogueCinematicEntry.kt b/adapters/BasicAdapter/src/main/kotlin/me/gabber235/typewriter/entries/cinematic/ActionBarDialogueCinematicEntry.kt index ada80126f7..8135ac4f08 100644 --- a/adapters/BasicAdapter/src/main/kotlin/me/gabber235/typewriter/entries/cinematic/ActionBarDialogueCinematicEntry.kt +++ b/adapters/BasicAdapter/src/main/kotlin/me/gabber235/typewriter/entries/cinematic/ActionBarDialogueCinematicEntry.kt @@ -10,6 +10,7 @@ import me.gabber235.typewriter.entry.Query import me.gabber235.typewriter.entry.entries.CinematicAction import me.gabber235.typewriter.entry.entries.CinematicEntry import me.gabber235.typewriter.entry.entries.SpeakerEntry +import me.gabber235.typewriter.extensions.placeholderapi.parsePlaceholders import me.gabber235.typewriter.interaction.acceptActionBarMessage import me.gabber235.typewriter.snippets.snippet import me.gabber235.typewriter.utils.* @@ -106,7 +107,7 @@ private fun displayActionBar(player: Player, speakerName: String, text: String, val padding = " ".repeat(paddingSize) val component = actionBarFormat.asMiniWithResolvers( - Placeholder.parsed("speaker", speakerName), + Placeholder.parsed("speaker", speakerName.parsePlaceholders(player)), Placeholder.component("message", message), Placeholder.unparsed("padding", padding), ) diff --git a/adapters/BasicAdapter/src/main/kotlin/me/gabber235/typewriter/entries/cinematic/DisplayDialogueCinematicAction.kt b/adapters/BasicAdapter/src/main/kotlin/me/gabber235/typewriter/entries/cinematic/DisplayDialogueCinematicAction.kt index 70a04bab59..f77dd397a0 100644 --- a/adapters/BasicAdapter/src/main/kotlin/me/gabber235/typewriter/entries/cinematic/DisplayDialogueCinematicAction.kt +++ b/adapters/BasicAdapter/src/main/kotlin/me/gabber235/typewriter/entries/cinematic/DisplayDialogueCinematicAction.kt @@ -96,7 +96,7 @@ class DisplayDialogueCinematicAction( val text = segment.text.parsePlaceholders(player) - display(player, speaker?.displayName ?: "", text, displayPercentage) + display(player, speaker?.displayName?.parsePlaceholders(player) ?: "", text, displayPercentage) } override suspend fun teardown() { diff --git a/adapters/BasicAdapter/src/main/kotlin/me/gabber235/typewriter/entries/cinematic/SpokenDialogueCinematicEntry.kt b/adapters/BasicAdapter/src/main/kotlin/me/gabber235/typewriter/entries/cinematic/SpokenDialogueCinematicEntry.kt index 7c7f44089e..1a9ea8c78b 100644 --- a/adapters/BasicAdapter/src/main/kotlin/me/gabber235/typewriter/entries/cinematic/SpokenDialogueCinematicEntry.kt +++ b/adapters/BasicAdapter/src/main/kotlin/me/gabber235/typewriter/entries/cinematic/SpokenDialogueCinematicEntry.kt @@ -122,7 +122,7 @@ private fun displaySpokenDialogue(player: Player, speakerName: String, text: Str ) val component = spokenFormat.asMiniWithResolvers( - Placeholder.parsed("speaker", speakerName), + Placeholder.parsed("speaker", speakerName.parsePlaceholders(player)), Placeholder.component("message", message), Placeholder.parsed("padding", spokenPadding), ) diff --git a/adapters/BasicAdapter/src/main/kotlin/me/gabber235/typewriter/entries/cinematic/SubtitleDialgueCinematicEntry.kt b/adapters/BasicAdapter/src/main/kotlin/me/gabber235/typewriter/entries/cinematic/SubtitleDialgueCinematicEntry.kt index f740840885..a857325c3b 100644 --- a/adapters/BasicAdapter/src/main/kotlin/me/gabber235/typewriter/entries/cinematic/SubtitleDialgueCinematicEntry.kt +++ b/adapters/BasicAdapter/src/main/kotlin/me/gabber235/typewriter/entries/cinematic/SubtitleDialgueCinematicEntry.kt @@ -10,6 +10,7 @@ import me.gabber235.typewriter.entry.Query import me.gabber235.typewriter.entry.entries.CinematicAction import me.gabber235.typewriter.entry.entries.CinematicEntry import me.gabber235.typewriter.entry.entries.SpeakerEntry +import me.gabber235.typewriter.extensions.placeholderapi.parsePlaceholders import me.gabber235.typewriter.interaction.acceptActionBarMessage import me.gabber235.typewriter.snippets.snippet import me.gabber235.typewriter.utils.Icons @@ -115,7 +116,7 @@ private fun displaySubTitle(player: Player, speakerName: String, text: String, d ) val actionBarComponent = subtitleSpeakerFormat.asMiniWithResolvers( - Placeholder.parsed("speaker", speakerName), + Placeholder.parsed("speaker", speakerName.parsePlaceholders(player)), ) player.showTitle(Title.title(Component.empty(), component, times)) diff --git a/adapters/BasicAdapter/src/main/kotlin/me/gabber235/typewriter/entries/dialogue/messengers/message/UniversalMessageDialogueDialogueMessenger.kt b/adapters/BasicAdapter/src/main/kotlin/me/gabber235/typewriter/entries/dialogue/messengers/message/UniversalMessageDialogueDialogueMessenger.kt index b771a5f39a..45b499b0d1 100644 --- a/adapters/BasicAdapter/src/main/kotlin/me/gabber235/typewriter/entries/dialogue/messengers/message/UniversalMessageDialogueDialogueMessenger.kt +++ b/adapters/BasicAdapter/src/main/kotlin/me/gabber235/typewriter/entries/dialogue/messengers/message/UniversalMessageDialogueDialogueMessenger.kt @@ -3,40 +3,41 @@ package me.gabber235.typewriter.entries.dialogue.messengers.message import me.gabber235.typewriter.adapters.Messenger import me.gabber235.typewriter.adapters.MessengerFilter import me.gabber235.typewriter.entries.dialogue.MessageDialogueEntry -import me.gabber235.typewriter.entry.dialogue.* +import me.gabber235.typewriter.entry.dialogue.DialogueMessenger +import me.gabber235.typewriter.entry.dialogue.MessengerState import me.gabber235.typewriter.entry.entries.DialogueEntry import me.gabber235.typewriter.extensions.placeholderapi.parsePlaceholders import me.gabber235.typewriter.snippets.snippet -import me.gabber235.typewriter.utils.* +import me.gabber235.typewriter.utils.sendMiniWithResolvers import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder import org.bukkit.entity.Player val messageFormat: String by snippet( - "dialogue.message.format", - "\n [ ]\n \n" + "dialogue.message.format", + "\n [ ]\n \n" ) @Messenger(MessageDialogueEntry::class) class UniversalMessageDialogueDialogueMessenger(player: Player, entry: MessageDialogueEntry) : - DialogueMessenger(player, entry) { + DialogueMessenger(player, entry) { - companion object : MessengerFilter { - override fun filter(player: Player, entry: DialogueEntry): Boolean = true - } + companion object : MessengerFilter { + override fun filter(player: Player, entry: DialogueEntry): Boolean = true + } - override fun tick(cycle: Int) { - super.tick(cycle) - if (cycle == 0) { - player.sendMessageDialogue(entry.text, entry.speakerDisplayName) - state = MessengerState.FINISHED - } - } + override fun tick(cycle: Int) { + super.tick(cycle) + if (cycle == 0) { + player.sendMessageDialogue(entry.text, entry.speakerDisplayName) + state = MessengerState.FINISHED + } + } } fun Player.sendMessageDialogue(text: String, speakerDisplayName: String) { - sendMiniWithResolvers( - messageFormat, - Placeholder.parsed("speaker", speakerDisplayName), - Placeholder.parsed("message", text.parsePlaceholders(player).replace("\n", "\n ")) - ) + sendMiniWithResolvers( + messageFormat, + Placeholder.parsed("speaker", speakerDisplayName.parsePlaceholders(player)), + Placeholder.parsed("message", text.parsePlaceholders(player).replace("\n", "\n ")) + ) } \ No newline at end of file diff --git a/adapters/BasicAdapter/src/main/kotlin/me/gabber235/typewriter/entries/dialogue/messengers/option/JavaOptionDialogueDialogueMessenger.kt b/adapters/BasicAdapter/src/main/kotlin/me/gabber235/typewriter/entries/dialogue/messengers/option/JavaOptionDialogueDialogueMessenger.kt index 7f3b26ce9d..d5215a465d 100644 --- a/adapters/BasicAdapter/src/main/kotlin/me/gabber235/typewriter/entries/dialogue/messengers/option/JavaOptionDialogueDialogueMessenger.kt +++ b/adapters/BasicAdapter/src/main/kotlin/me/gabber235/typewriter/entries/dialogue/messengers/option/JavaOptionDialogueDialogueMessenger.kt @@ -105,7 +105,7 @@ class JavaOptionDialogueDialogueMessenger(player: Player, entry: OptionDialogueE } val message = optionFormat.asMiniWithResolvers( - Placeholder.parsed("speaker", speakerDisplayName), + Placeholder.parsed("speaker", speakerDisplayName.parsePlaceholders(player)), Placeholder.parsed("text", entry.text.parsePlaceholders(player)), Placeholder.component("options", formatOptions()), ) diff --git a/adapters/BasicAdapter/src/main/kotlin/me/gabber235/typewriter/entries/dialogue/messengers/random/JavaRandomSpokenDialogueDialogueMessenger.kt b/adapters/BasicAdapter/src/main/kotlin/me/gabber235/typewriter/entries/dialogue/messengers/random/JavaRandomSpokenDialogueDialogueMessenger.kt index bb01c00858..71f8807308 100644 --- a/adapters/BasicAdapter/src/main/kotlin/me/gabber235/typewriter/entries/dialogue/messengers/random/JavaRandomSpokenDialogueDialogueMessenger.kt +++ b/adapters/BasicAdapter/src/main/kotlin/me/gabber235/typewriter/entries/dialogue/messengers/random/JavaRandomSpokenDialogueDialogueMessenger.kt @@ -7,6 +7,7 @@ import me.gabber235.typewriter.entries.dialogue.messengers.spoken.sendSpokenDial import me.gabber235.typewriter.entry.dialogue.DialogueMessenger import me.gabber235.typewriter.entry.dialogue.MessengerState import me.gabber235.typewriter.entry.entries.DialogueEntry +import me.gabber235.typewriter.extensions.placeholderapi.parsePlaceholders import org.bukkit.entity.Player import org.bukkit.event.player.PlayerSwapHandItemsEvent @@ -23,7 +24,7 @@ class JavaRandomSpokenDialogueDialogueMessenger(player: Player, entry: RandomSpo override fun init() { super.init() - speakerDisplayName = entry.speakerDisplayName + speakerDisplayName = entry.speakerDisplayName.parsePlaceholders(player) text = entry.messages.randomOrNull() ?: "" listen { event -> diff --git a/adapters/BasicAdapter/src/main/kotlin/me/gabber235/typewriter/entries/dialogue/messengers/random/RandomMessageDialogueDialogueMessenger.kt b/adapters/BasicAdapter/src/main/kotlin/me/gabber235/typewriter/entries/dialogue/messengers/random/RandomMessageDialogueDialogueMessenger.kt index 4a1f4c69c9..46693756fc 100644 --- a/adapters/BasicAdapter/src/main/kotlin/me/gabber235/typewriter/entries/dialogue/messengers/random/RandomMessageDialogueDialogueMessenger.kt +++ b/adapters/BasicAdapter/src/main/kotlin/me/gabber235/typewriter/entries/dialogue/messengers/random/RandomMessageDialogueDialogueMessenger.kt @@ -4,24 +4,26 @@ import me.gabber235.typewriter.adapters.Messenger import me.gabber235.typewriter.adapters.MessengerFilter import me.gabber235.typewriter.entries.dialogue.RandomMessageDialogueEntry import me.gabber235.typewriter.entries.dialogue.messengers.message.sendMessageDialogue -import me.gabber235.typewriter.entry.dialogue.* +import me.gabber235.typewriter.entry.dialogue.DialogueMessenger +import me.gabber235.typewriter.entry.dialogue.MessengerState import me.gabber235.typewriter.entry.entries.DialogueEntry +import me.gabber235.typewriter.extensions.placeholderapi.parsePlaceholders import org.bukkit.entity.Player @Messenger(RandomMessageDialogueEntry::class) class RandomMessageDialogueDialogueMessenger(player: Player, entry: RandomMessageDialogueEntry) : - DialogueMessenger(player, entry) { + DialogueMessenger(player, entry) { - companion object : MessengerFilter { - override fun filter(player: Player, entry: DialogueEntry): Boolean = true - } + companion object : MessengerFilter { + override fun filter(player: Player, entry: DialogueEntry): Boolean = true + } - override fun tick(cycle: Int) { - super.tick(cycle) - if (cycle == 0) { - val message = entry.messages.randomOrNull() ?: return - player.sendMessageDialogue(message, entry.speakerDisplayName) - state = MessengerState.FINISHED - } - } + override fun tick(cycle: Int) { + super.tick(cycle) + if (cycle == 0) { + val message = entry.messages.randomOrNull() ?: return + player.sendMessageDialogue(message, entry.speakerDisplayName.parsePlaceholders(player)) + state = MessengerState.FINISHED + } + } } \ No newline at end of file diff --git a/adapters/BasicAdapter/src/main/kotlin/me/gabber235/typewriter/entries/dialogue/messengers/spoken/JavaSpokenDialogueDialogueMessenger.kt b/adapters/BasicAdapter/src/main/kotlin/me/gabber235/typewriter/entries/dialogue/messengers/spoken/JavaSpokenDialogueDialogueMessenger.kt index 35f2133632..47d1d2f73c 100644 --- a/adapters/BasicAdapter/src/main/kotlin/me/gabber235/typewriter/entries/dialogue/messengers/spoken/JavaSpokenDialogueDialogueMessenger.kt +++ b/adapters/BasicAdapter/src/main/kotlin/me/gabber235/typewriter/entries/dialogue/messengers/spoken/JavaSpokenDialogueDialogueMessenger.kt @@ -53,7 +53,7 @@ class JavaSpokenDialogueDialogueMessenger(player: Player, entry: SpokenDialogueE private var speakerDisplayName = "" override fun init() { super.init() - speakerDisplayName = entry.speakerDisplayName + speakerDisplayName = entry.speakerDisplayName.parsePlaceholders(player) listen { event -> if (event.player.uniqueId != player.uniqueId) return@listen diff --git a/documentation/docs/docs/02-installation-guide.md b/documentation/docs/docs/02-installation-guide.md index 17c3a86e69..2784d796d1 100644 --- a/documentation/docs/docs/02-installation-guide.md +++ b/documentation/docs/docs/02-installation-guide.md @@ -55,6 +55,10 @@ The web panel needs two ports to be open. These can be changed, but it does need default ports are `8080` and `9092`. If you are not able to open these ports, the easiest way is to use typewriter locally and copying the files in `server/plugins/Typewriter/pages` to your production server. +:::caution +You will get an error if the ports in the config are being used already. Make sure these ports are available by using `netstat -aon | find /i "[port]"`. (Windows only) +::: + To enable the web panel, follow these steps: 1. Open the `server/plugins/Typewriter/config.yml` file. diff --git a/documentation/package-lock.json b/documentation/package-lock.json index 0b074ddf0e..88778eb71a 100644 --- a/documentation/package-lock.json +++ b/documentation/package-lock.json @@ -11,12 +11,12 @@ "@docusaurus/core": "^2.4.1", "@docusaurus/preset-classic": "^2.4.1", "@mdx-js/react": "^1.6.22", - "@rive-app/react-canvas": "^3.0.51", + "@rive-app/react-canvas": "^3.0.57", "clsx": "^1.2.1", "prism-react-renderer": "^1.3.5", "react": "^17.0.2", "react-dom": "^17.0.2", - "react-player": "^2.12.0", + "react-player": "^2.13.0", "rive-loader": "file:plugins/rive-loader" }, "devDependencies": { @@ -2917,16 +2917,16 @@ "integrity": "sha512-a5Sab1C4/icpTZVzZc5Ghpz88yQtGOyNqYXcZgOssB2uuAr+wF/MvN6bgtW32q7HHrvBki+BsZ0OuNv6EV3K9g==" }, "node_modules/@rive-app/canvas": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@rive-app/canvas/-/canvas-1.2.1.tgz", - "integrity": "sha512-udDH8al7ra9F7zBc3kzseEVa+9znucqfRtLPAPfXNNq/xfeGdvXCwWj7Vu5lFe0fJ76slKYtxUZIxp5LkiPVYw==" + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/@rive-app/canvas/-/canvas-1.2.4.tgz", + "integrity": "sha512-TfkTM0D+JMKTmkg3WhdoFaarLohMyrLeSLwwPLa9GiHNU9odFPptS0j5iprN/WygrTWsb5WoyXgCXVZpZIKAQg==" }, "node_modules/@rive-app/react-canvas": { - "version": "3.0.54", - "resolved": "https://registry.npmjs.org/@rive-app/react-canvas/-/react-canvas-3.0.54.tgz", - "integrity": "sha512-jhgUeSKph3mF0nOyJs84L8u7eStRKX2tgxVgLZBB4+YLQfm4Tx9ZruYiiihtTeVU/dR0u1qav9P66rvr9keFyQ==", + "version": "3.0.57", + "resolved": "https://registry.npmjs.org/@rive-app/react-canvas/-/react-canvas-3.0.57.tgz", + "integrity": "sha512-igjVzjYueOlKi2Tn4lyresbhHinz8mKg5Gt9z29bcN2O2SAErCYb6PNUdUJ1gMIQinKV1VHMvDdsvJbYkh9kwQ==", "dependencies": { - "@rive-app/canvas": "1.2.1" + "@rive-app/canvas": "1.2.4" }, "peerDependencies": { "react": "^16.8.0 || ^17.0.0 || ^18.0.0" @@ -8069,9 +8069,15 @@ } }, "node_modules/nanoid": { - "version": "3.3.4", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.4.tgz", - "integrity": "sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw==", + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.6.tgz", + "integrity": "sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], "bin": { "nanoid": "bin/nanoid.cjs" }, @@ -8625,9 +8631,9 @@ } }, "node_modules/postcss": { - "version": "8.4.21", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.21.tgz", - "integrity": "sha512-tP7u/Sn/dVxK2NnruI4H9BG+x+Wxz6oeZ1cJ8P6G/PZY0IKk4k/63TDsQf2kQq3+qoJeLm2kIBUNlZe3zgb4Zg==", + "version": "8.4.31", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.31.tgz", + "integrity": "sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ==", "funding": [ { "type": "opencollective", @@ -8636,10 +8642,14 @@ { "type": "tidelift", "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" } ], "dependencies": { - "nanoid": "^3.3.4", + "nanoid": "^3.3.6", "picocolors": "^1.0.0", "source-map-js": "^1.0.2" }, @@ -9640,9 +9650,9 @@ } }, "node_modules/react-player": { - "version": "2.12.0", - "resolved": "https://registry.npmjs.org/react-player/-/react-player-2.12.0.tgz", - "integrity": "sha512-rymLRz/2GJJD+Wc01S7S+i9pGMFYnNmQibR2gVE3KmHJCBNN8BhPAlOPTGZtn1uKpJ6p4RPLlzPQ1OLreXd8gw==", + "version": "2.13.0", + "resolved": "https://registry.npmjs.org/react-player/-/react-player-2.13.0.tgz", + "integrity": "sha512-gkY7ZdbVFztlKFFhCPcnDrFQm+L399b8fhWsKatZ+b2wpKJwfUHBXQFMRxqYQGT0ic1/wQ7D7EZEWy7ZBqk2pw==", "dependencies": { "deepmerge": "^4.0.0", "load-script": "^1.0.0", diff --git a/documentation/package.json b/documentation/package.json index fd8f40b375..bbea9c6a29 100644 --- a/documentation/package.json +++ b/documentation/package.json @@ -18,12 +18,12 @@ "@docusaurus/core": "^2.4.1", "@docusaurus/preset-classic": "^2.4.1", "@mdx-js/react": "^1.6.22", - "@rive-app/react-canvas": "^3.0.51", + "@rive-app/react-canvas": "^3.0.57", "clsx": "^1.2.1", "prism-react-renderer": "^1.3.5", "react": "^17.0.2", "react-dom": "^17.0.2", - "react-player": "^2.12.0", + "react-player": "^2.13.0", "rive-loader": "file:plugins/rive-loader" }, "devDependencies": { diff --git a/plugin/build.gradle.kts b/plugin/build.gradle.kts index c10b0e5412..a6d947b727 100644 --- a/plugin/build.gradle.kts +++ b/plugin/build.gradle.kts @@ -27,7 +27,6 @@ val centralDependencies = listOf( "org.jetbrains.kotlin:kotlin-stdlib:1.8.20", "org.jetbrains.kotlin:kotlin-reflect:1.8.20", "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.1", - "com.corundumstudio.socketio:netty-socketio:1.7.19", // Keep this on a lower version as the newer version breaks the ping ) dependencies { @@ -42,6 +41,7 @@ dependencies { implementation("io.ktor:ktor-server-core-jvm:2.3.4") implementation("io.ktor:ktor-server-netty-jvm:2.3.4") implementation("io.insert-koin:koin-core:3.4.0") + implementation("com.corundumstudio.socketio:netty-socketio:1.7.19") // Keep this on a lower version as the newer version breaks the ping compileOnly("com.github.shynixn.mccoroutine:mccoroutine-bukkit-api:2.11.0") compileOnly("com.github.shynixn.mccoroutine:mccoroutine-bukkit-core:2.11.0")