Skip to content

Commit

Permalink
Add update checker
Browse files Browse the repository at this point in the history
  • Loading branch information
Syrent committed Dec 31, 2022
1 parent ff955a1 commit 26b7798
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 4 deletions.
12 changes: 10 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ repositories {
maven {
url = 'https://repo.essentialsx.net/releases/'
}

// Update checker
maven {
name = "jeff-media-public"
url = 'https://hub.jeff-media.com/nexus/repository/jeff-media-public/'
}
}

dependencies {
Expand All @@ -74,8 +80,8 @@ dependencies {
compileOnly 'xyz.jpenilla:squaremap-api:1.1.9'
compileOnly 'net.essentialsx:EssentialsX:2.19.7'

compileOnly files("libs/SayanChat-2.8.3.jar")
compileOnly files('libs/ProCosmetics-13.7.jar')
compileOnly files("libs/SayanChat-2.8.1-all.jar")
compileOnly files('libs/ProCosmetics.jar')
compileOnly files('libs/ServerListPlus-3.5.0-SNAPSHOT-Velocity.jar')

implementation 'io.papermc:paperlib:1.0.7'
Expand All @@ -91,6 +97,7 @@ dependencies {
implementation 'net.kyori:adventure-api:4.12.0'
implementation 'net.kyori:adventure-platform-bukkit:4.2.0'
implementation 'net.kyori:adventure-text-minimessage:4.12.0'
implementation 'com.jeff_media:SpigotUpdateChecker:3.0.0'

annotationProcessor 'com.velocitypowered:velocity-api:3.1.1'
}
Expand All @@ -114,6 +121,7 @@ shadowJar {
relocate('me.mohamad82.ruom', 'ir.syrent.velocityvanish.ruom')
relocate('com.cryptomorin.xseries', 'ir.syrent.velocityvanish.xseries')
relocate('kotlin', 'ir.syrent.velocityvanish.kotlin')
relocate('com.jeff_media.updatechecker', 'ir.syrent.velocityvanish.updatechecker')

relocate('com.google', 'ir.syrent.velocityvanish.google')
// relocate('net.kyori.adventure', 'ir.syrent.velocityvanish.kyori.adventure')
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
version=3.10.2
version=3.11.0
plugin-name=VelocityVanish
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package ir.syrent.velocityvanish.spigot

import com.google.gson.JsonObject
import com.jeff_media.updatechecker.UpdateCheckSource
import com.jeff_media.updatechecker.UpdateChecker
import io.papermc.lib.PaperLib
import ir.syrent.velocityvanish.spigot.bridge.BukkitBridge
import ir.syrent.velocityvanish.spigot.bridge.BukkitBridgeManager
Expand Down Expand Up @@ -40,6 +42,7 @@ class VelocityVanishSpigot : RUoMPlugin() {
resetData(true)
sendFiglet()
sendWarningMessages()
checkUpdate()
initializeCommands()
initializeListeners()

Expand Down Expand Up @@ -77,6 +80,24 @@ class VelocityVanishSpigot : RUoMPlugin() {
DependencyManager
}

private fun checkUpdate() {
Thread {
try {
UpdateChecker(this, UpdateCheckSource.SPIGOT, 105992.toString())
.setDownloadLink("https://www.spigotmc.org/resources/velocityvanish-1-8-1-19-3-no-database-required.105992/")
.checkEveryXHours(24.0)
.setChangelogLink(105992.toString())
.setNotifyOpsOnJoin(true)
.setNotifyByPermissionOnJoin("velocityvanish.updatechecker")
.setTimeout(30 * 1000)
.setSupportLink("https://discord.gg/xZyYGU4EG4")
.checkNow()
} catch (_: Exception) {
Ruom.warn("Could not check for updates, check your connection.")
}
}.start()
}

private fun resetData(startup: Boolean) {
try {
for (player in Ruom.getOnlinePlayers()) {
Expand Down

0 comments on commit 26b7798

Please sign in to comment.