Skip to content

Commit a00c586

Browse files
Merge branch 'develop' into feature/drop-bukkit-support
2 parents 760e8d5 + b124ae5 commit a00c586

13 files changed

Lines changed: 173 additions & 21 deletions

File tree

.github/workflows/build-pr.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ jobs:
1212
- name: Checkout Repository
1313
uses: actions/checkout@v4
1414
- name: Validate Gradle Wrapper
15-
uses: gradle/wrapper-validation-action@v3
15+
uses: gradle/actions/wrapper-validation@v3
1616
- name: Setup Java
1717
uses: actions/setup-java@v4
1818
with:
1919
distribution: temurin
20-
java-version: 17
20+
java-version: 21
2121
- name: Build on ${{ matrix.os }}
22-
run: ./gradlew clean build -x test
22+
run: ./gradlew clean build -x test

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Discord: https://discord.onelitefeather.net
1919

2020
## Permissions
2121
- `attollo.use` - Allows the player to use the elevator
22+
- `attollo.update` - Allows the player to receive update notifications
2223

2324
## Configuration
2425
```yaml

build.gradle.kts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import net.minecrell.pluginyml.bukkit.BukkitPluginDescription.Permission.Default
33
import xyz.jpenilla.runpaper.task.RunServer
44

55
plugins {
6-
kotlin("jvm") version "2.0.0"
6+
kotlin("jvm") version "2.1.0"
77
alias(libs.plugins.publishdata)
88
alias(libs.plugins.shadow)
99
alias(libs.plugins.paper.run)
@@ -34,7 +34,7 @@ val supportedMinecraftVersions = listOf(
3434

3535
repositories {
3636
mavenCentral()
37-
maven("https://papermc.io/repo/repository/maven-public/")
37+
maven("https://repo.papermc.io/repository/maven-public/")
3838
}
3939

4040
dependencies {
@@ -65,6 +65,10 @@ paper {
6565
description = "Allows the player to use the plugin"
6666
default = Default.TRUE
6767
}
68+
register("attollo.update") {
69+
description = "Allows the player to see update notifications"
70+
default = Default.OP
71+
}
6872
}
6973
}
7074

gradle/wrapper/gradle-wrapper.jar

311 Bytes
Binary file not shown.

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-all.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.1-all.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

gradlew

Lines changed: 6 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gradlew.bat

Lines changed: 4 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

settings.gradle.kts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,9 @@ dependencyResolutionManagement {
1414
version("publishdata", "1.4.0")
1515
version("modrinth", "2.+")
1616
version("hangar", "0.1.2")
17-
version("paper.yml", "0.6.0")
18-
version("paper.run", "2.3.0")
17+
version("bukkit.yml", "0.6.0")
18+
version("paper.run", "2.3.1")
1919
version("shadow", "8.1.7")
20-
2120
version("paper", "1.21-R0.1-SNAPSHOT")
2221
version("adventure", "4.17.0")
2322
version("mockk", "1.13.11")
Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,43 @@
11
package dev.themeinerlp.attollo
22

33
import dev.themeinerlp.attollo.listener.AttolloListener
4+
import dev.themeinerlp.attollo.listener.UpdateCheckerListener
5+
import dev.themeinerlp.attollo.service.UpdateService
46
import org.bukkit.Material
57
import org.bukkit.plugin.java.JavaPlugin
68

79
open class Attollo : JavaPlugin() {
810

9-
1011
lateinit var elevatorBlock: Material
12+
lateinit var updateService: UpdateService
13+
1114
override fun onLoad() {
1215
saveDefaultConfig()
1316
}
1417

1518
override fun onEnable() {
16-
elevatorBlock = Material.matchMaterial(config.getString("elevatorBlock") ?: "DAYLIGHT_DETECTOR")
17-
?: Material.DAYLIGHT_DETECTOR
19+
val rawValue = config.getString("elevatorBlock") ?: "DAYLIGHT_DETECTOR"
20+
val material = Material.matchMaterial(rawValue)
21+
22+
if (material == null) {
23+
logger.warning("Invalid elevatorBlock material in config.yml: '$rawValue'. Defaulting to DAYLIGHT_DETECTOR.")
24+
}
25+
26+
elevatorBlock = material ?: Material.DAYLIGHT_DETECTOR
27+
logger.info("Using elevatorBlock: $elevatorBlock")
1828
server.pluginManager.registerEvents(AttolloListener(this), this)
29+
updateChecker()
1930
}
31+
32+
override fun onDisable() {
33+
updateService.shutdown()
34+
}
35+
36+
private fun updateChecker() {
37+
updateService = UpdateService(this)
38+
updateService.run()
39+
updateService.notifyConsole(componentLogger)
40+
server.pluginManager.registerEvents(UpdateCheckerListener(this), this)
41+
}
42+
2043
}
Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,16 @@
11
package dev.themeinerlp.attollo
22

3+
import java.net.URI
4+
import java.net.http.HttpRequest
5+
6+
7+
38
const val USE_PERMISSION = "attollo.use"
4-
const val BYTEBIN_BASE_URL = "https://paste.grim.ac/data"
9+
const val NOTIFY_UPDATE_PERMISSION = "attollo.update"
10+
const val BYTEBIN_BASE_URL = "https://paste.grim.ac/data"
11+
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+
15+
val LATEST_RELEASE_VERSION_URI = URI.create("https://hangar.papermc.io/api/v1/projects/Attollo/latestrelease")
16+
val LATEST_RELEASE_VERSION_REQUEST = HttpRequest.newBuilder().GET().uri(LATEST_RELEASE_VERSION_URI).build()

0 commit comments

Comments
 (0)