Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ jobs:
uses: gradle/actions/setup-gradle@v5

- name: Test with Gradle Wrapper
run: ./gradlew test --build-cache
run: ./gradlew test
8 changes: 0 additions & 8 deletions api/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
kotlin {
explicitApi()
}

publishing {
publications {
create<MavenPublication>("maven") {
from(components["java"])
}
}
}
49 changes: 20 additions & 29 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,72 +1,64 @@
import io.papermc.hangarpublishplugin.model.Platforms
import org.apache.tools.ant.filters.ReplaceTokens

plugins {
id("maven-publish")
alias(libs.plugins.kotlin)
alias(libs.plugins.shadowJar)
alias(libs.plugins.shadow)
alias(libs.plugins.hangar)
alias(libs.plugins.minotaur)
}

group = "com.r4g3baby"
group = "com.r4g3baby.simplescore"
version = "4.1.1-dev"

dependencies {
api(project("bukkit"))
}

subprojects {
group = "${rootProject.group}.${rootProject.name.lowercase()}"
group = rootProject.group
version = rootProject.version

apply(plugin = "org.jetbrains.kotlin.jvm")
apply(plugin = "maven-publish")

java {
withSourcesJar()
publishing {
publications {
create<MavenPublication>("maven") {
artifactId = "${rootProject.name}-${path.replace(":", "-").drop(1)}".lowercase()

from(components["java"])
}
}
}
}

allprojects {
java {
withSourcesJar()
}

kotlin {
jvmToolchain {
languageVersion = JavaLanguageVersion.of(8)
}
}

tasks {
processResources {
filteringCharset = "UTF-8"
filesMatching(listOf("**plugin.yml")) {
filter<ReplaceTokens>(
"tokens" to mapOf(
"name" to rootProject.name,
"version" to rootProject.version,
"description" to "A simple animated scoreboard plugin for your server.",
"package" to "${rootProject.group}.${rootProject.name.lowercase()}",
"website" to "https://ruipereira.dev"
)
)
}
}
}
}

tasks {
jar { enabled = false }

shadowJar {
archiveFileName.set("${project.name}-${project.version}.jar")

manifest {
attributes["paperweight-mappings-namespace"] = "mojang"
}

val libs = "${project.group}.${project.name.lowercase()}.lib"
val libs = "${project.group}.lib"
relocate("org.objenesis", "$libs.objenesis")
relocate("net.swiftzer.semver", "$libs.semver")
relocate("org.bstats", "$libs.bstats")
// relocate("com.zaxxer.hikari", "$libs.hikari")
// relocate("org.slf4j", "$libs.slf4j")

relocate("org.jetbrains", "$libs.jetbrains")
relocate("kotlin", "$libs.kotlin")
Expand Down Expand Up @@ -126,14 +118,13 @@ fun mapVersions(propertyName: String): Provider<List<String>> = provider {
}

fun parseGitHubChangelog(): Provider<String> = provider {
val changelog = System.getenv("GITHUB_CHANGELOG")
?: return@provider "(No changelog provided)"
val changelog = System.getenv("GITHUB_CHANGELOG") ?: return@provider "(No changelog provided)"

val userRegex = Regex("(?<!\\w)@([A-Za-z0-9-]+)")
val pullRegex = Regex("https://github\\.com/[\\w-]+/[\\w-]+/pull/(\\d+)")
val compareRegex = Regex("https://github\\.com/[\\w-]+/[\\w-]+/compare/([\\w\\.]+)")

changelog.replace(userRegex) {
return@provider changelog.replace(userRegex) {
val user = it.groupValues[1]
"[@$user](https://github.com/$user)"
}.replace(pullRegex) {
Expand Down
24 changes: 18 additions & 6 deletions bukkit/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,20 +1,32 @@
import org.apache.tools.ant.filters.ReplaceTokens

dependencies {
api(project(":core"))
implementation(project(":bukkit:protocol"))
implementation(project(":bukkit:worldguard"))

compileOnly(libs.bukkit)
compileOnly(libs.netty)
compileOnly(libs.papi)
compileOnly(libs.adventureMiniMessage)
compileOnly(libs.adventureSerializer)

implementation(libs.objenesis)
implementation(libs.bStatsBukkit)
}

publishing {
publications {
create<MavenPublication>("maven") {
from(components["java"])
tasks {
processResources {
filteringCharset = "UTF-8"
filesMatching("plugin.yml") {
filter<ReplaceTokens>(
"tokens" to mapOf(
"name" to rootProject.name,
"version" to rootProject.version,
"package" to rootProject.group,
"description" to "A simple animated scoreboard plugin for your server.",
"website" to "https://ruipereira.dev"
)
)
}
}
}
}
8 changes: 0 additions & 8 deletions bukkit/protocol/build.gradle.kts

This file was deleted.

8 changes: 0 additions & 8 deletions bukkit/protocol/common/build.gradle.kts

This file was deleted.

This file was deleted.

6 changes: 0 additions & 6 deletions bukkit/protocol/legacy/build.gradle.kts

This file was deleted.

6 changes: 0 additions & 6 deletions bukkit/protocol/modern/build.gradle.kts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import com.r4g3baby.simplescore.bukkit.listener.PlayerListener
import com.r4g3baby.simplescore.bukkit.protocol.legacy.LegacyProtocolHandler
import com.r4g3baby.simplescore.bukkit.protocol.modern.ModernProtocolHandler
import com.r4g3baby.simplescore.bukkit.protocol.modern.TeamsProtocolHandler
import com.r4g3baby.simplescore.bukkit.protocol.util.ServerVersion
import com.r4g3baby.simplescore.bukkit.scoreboard.ScoreboardTask
import com.r4g3baby.simplescore.bukkit.scoreboard.VarReplacer
import com.r4g3baby.simplescore.bukkit.scoreboard.data.Viewer
import com.r4g3baby.simplescore.bukkit.util.ServerVersion
import com.r4g3baby.simplescore.bukkit.worldguard.WorldGuardAPI
import com.r4g3baby.simplescore.core.BaseManager
import org.bukkit.Location
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ class MainCmd(private val plugin: BukkitPlugin) : CommandExecutor, TabExecutor {
else -> emptyList()
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ abstract class SubCmd(plugin: BukkitPlugin, val name: String) {
}
return players.map { it.name }
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,4 @@ class Force(private val plugin: BukkitPlugin) : SubCmd(plugin, "force") {
else -> emptyList()
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ class Help(private val plugin: BukkitPlugin, private val mainCmd: MainCmd) : Sub
}
} else sender.sendMessage(plugin.i18n.t("cmd.help.noCommands"))
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ class Info(private val plugin: BukkitPlugin) : SubCmd(plugin, "info") {
getTargetsFor(sender).filter { it.startsWith(args[0], true) }
} else emptyList()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ class Reload(private val plugin: BukkitPlugin) : SubCmd(plugin, "reload") {
plugin.manager.loadConfiguration()
sender.sendMessage(plugin.i18n.t("cmd.reload.finished"))
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,4 @@ class Toggle(private val plugin: BukkitPlugin) : SubCmd(plugin, "toggle") {
else -> emptyList()
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ class Version(private val plugin: BukkitPlugin) : SubCmd(plugin, "version") {
})
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -130,4 +130,4 @@ class ConditionsConfig(
} else plugin.logger.warning("Invalid type value for condition: $name, type: $type.")
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ class MainConfig(plugin: BukkitPlugin) : BaseMainConfig<Player, YamlConfiguratio
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -227,4 +227,4 @@ class ScoreboardsConfig(
else -> emptyList()
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package com.r4g3baby.simplescore.bukkit.protocol

import com.r4g3baby.simplescore.bukkit.protocol.util.Utils
import com.r4g3baby.simplescore.bukkit.util.NMS
import com.r4g3baby.simplescore.bukkit.util.OBC
import com.r4g3baby.simplescore.core.util.Reflection
import io.netty.channel.Channel
import org.bukkit.entity.Player
import java.util.*
import java.util.Collections.synchronizedMap
import java.util.WeakHashMap

class ChannelInjector {
companion object {
Expand All @@ -18,18 +19,18 @@ class ChannelInjector {

init {
try {
val craftPlayer = Reflection.getClass("${Utils.OBC}.entity.CraftPlayer")
val craftPlayer = Reflection.getClass("${OBC}.entity.CraftPlayer")
val entityPlayer = Reflection.findClass(
"net.minecraft.server.level.ServerPlayer",
"net.minecraft.server.level.EntityPlayer", "${Utils.NMS}.EntityPlayer"
"net.minecraft.server.level.EntityPlayer", "${NMS}.EntityPlayer"
)
val playerConnection = Reflection.findClass(
"net.minecraft.server.network.ServerGamePacketListenerImpl",
"net.minecraft.server.network.PlayerConnection", "${Utils.NMS}.PlayerConnection"
"net.minecraft.server.network.PlayerConnection", "${NMS}.PlayerConnection"
)
val networkManager = Reflection.findClass(
"net.minecraft.network.Connection",
"net.minecraft.network.NetworkManager", "${Utils.NMS}.NetworkManager"
"net.minecraft.network.NetworkManager", "${NMS}.NetworkManager"
)

getPlayerHandle = Reflection.getMethodByName(craftPlayer, "getHandle")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,4 @@ abstract class ProtocolHandler {
}
return text to ""
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.r4g3baby.simplescore.bukkit.protocol

import com.r4g3baby.simplescore.bukkit.protocol.util.Utils
import com.r4g3baby.simplescore.bukkit.util.NMS
import com.r4g3baby.simplescore.core.util.Reflection

abstract class WrappedPacket(val handle: Any) {
Expand All @@ -10,7 +10,7 @@ abstract class WrappedPacket(val handle: Any) {
init {
try {
clazz = Reflection.findClass(
"net.minecraft.network.protocol.Packet", "${Utils.NMS}.Packet"
"net.minecraft.network.protocol.Packet", "${NMS}.Packet"
)
} catch (throwable: Throwable) {
throw ExceptionInInitializerError(throwable)
Expand All @@ -21,4 +21,4 @@ abstract class WrappedPacket(val handle: Any) {
init {
require(clazz.isAssignableFrom(handle::class.java))
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,4 @@ open class LegacyProtocolHandler : ProtocolHandler() {
}
}
}
}
}
Loading