Skip to content

Commit 68eff4f

Browse files
committed
use constants for update messages
1 parent a3944dd commit 68eff4f

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/main/kotlin/dev/themeinerlp/attollo/constants.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,8 @@ const val USE_PERMISSION = "attollo.use"
99
const val NOTIFY_UPDATE_PERMISSION = "attollo.update"
1010
const val BYTEBIN_BASE_URL = "https://paste.grim.ac/data"
1111

12+
const val NOTIFY_PLAYER_UPDATE_MESSAGE = "<yellow><download_url>Your version (<local_version>) is older than our latest published version (<remote_version>). Please update as soon as possible to get continued support. Or click me to get on the download page!"
13+
const val NOTIFY_CONSOLE_UPDATE_MESSAGE = "<yellow>Your version (<local_version>) is older than our latest published version (<remote_version>). Please update as soon as possible to get continued support. Or use this link <download_url>."
14+
1215
val LATEST_RELEASE_VERSION_URI = URI.create("https://hangar.papermc.io/api/v1/projects/Attollo/latestrelease")
1316
val LATEST_RELEASE_VERSION_REQUEST = HttpRequest.newBuilder().GET().uri(LATEST_RELEASE_VERSION_URI).build()

src/main/kotlin/dev/themeinerlp/attollo/service/UpdateService.kt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
package dev.themeinerlp.attollo.service
22

33
import com.github.zafarkhaja.semver.Version
4-
import dev.themeinerlp.attollo.Attollo
5-
import dev.themeinerlp.attollo.LATEST_RELEASE_VERSION_REQUEST
6-
import dev.themeinerlp.attollo.NOTIFY_UPDATE_PERMISSION
4+
import dev.themeinerlp.attollo.*
75
import net.kyori.adventure.text.Component
86
import net.kyori.adventure.text.event.ClickEvent
97
import net.kyori.adventure.text.logger.slf4j.ComponentLogger
@@ -41,7 +39,7 @@ class UpdateService(plugin: Attollo) : Runnable {
4139
if (this.remoteVersion != null && remoteVersion?.isHigherThan(this.localVersion) == true) {
4240
logger.warn(
4341
MiniMessage.miniMessage().deserialize(
44-
"<yellow>Your version (<local_version>) is older than our latest published version (<remote_version>). Please update as soon as possible to get continued support. Or use this link <download_url>.",
42+
NOTIFY_CONSOLE_UPDATE_MESSAGE,
4543
Placeholder.component("local_version", Component.text(localVersion.toString())),
4644
Placeholder.component("remote_version", Component.text(remoteVersion.toString())),
4745
Placeholder.component("download_url", Component.text(DOWNLOAD_URL.format(remoteVersion.toString())))
@@ -59,7 +57,7 @@ class UpdateService(plugin: Attollo) : Runnable {
5957
private fun notifyPlayer(localVersion: Version, remoteVersion: Version?, player: Player) {
6058
player.sendMessage(
6159
MiniMessage.miniMessage().deserialize(
62-
"<yellow><download_url>Your version (<local_version>) is older than our latest published version (<remote_version>). Please update as soon as possible to get continued support. Or click me to get on the download page!",
60+
NOTIFY_PLAYER_UPDATE_MESSAGE,
6361
Placeholder.component("local_version", Component.text(localVersion.toString())),
6462
Placeholder.component("remote_version", Component.text(remoteVersion.toString())),
6563
Placeholder.styling("download_url", ClickEvent.openUrl(DOWNLOAD_URL.format(remoteVersion.toString())))

0 commit comments

Comments
 (0)