Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update for Minecraft 1.20.6 #122

Merged
merged 8 commits into from
May 14, 2024
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
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ jobs:
modrinth-publish: true
hangar-publish: true
loom: true
jdk-version: 21
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
Minecraft server mod/plugin to show TPS, MSPT, and other information in the tab menu, boss bar, and action bar.

Current supported platforms:
- [Paper](https://papermc.io)/Spigot API (Minecraft versions 1.8.8-1.20.4+)
- [Paper](https://papermc.io)/Spigot API (Minecraft versions 1.8.8-1.20.6+)
- [Sponge](https://spongepowered.org) 8+
- Fabric (Minecraft 1.20.4, requires [Fabric API](https://modrinth.com/mod/fabric-api))
- Fabric (Minecraft 1.20.6, requires [Fabric API](https://modrinth.com/mod/fabric-api))

## Features

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,13 @@ private void argumentParsing(final @NonNull ExceptionContext<Commander, Argument
}

private void invalidSender(final @NonNull ExceptionContext<Commander, InvalidCommandSenderException> ctx) {
if (ctx.exception().requiredSenderTypes().size() > 1) {
// We don't have any command chains that would cause this to happen
throw new IllegalStateException();
}
final Component message = Messages.COMMAND_EXCEPTION_INVALID_SENDER_TYPE.styled(
RED,
text(GenericTypeReflector.erase(ctx.exception().requiredSender()).getSimpleName())
text(GenericTypeReflector.erase(ctx.exception().requiredSenderTypes().iterator().next()).getSimpleName())
);
decorateAndSend(ctx.context().sender(), message);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,29 +58,26 @@ public void register() {
final Command.Builder<Commander> toggle = this.commands.rootBuilder().literal("toggle");

this.commands.register(toggle.literal("tab")
.permission(PredicatePermission.of(user -> this.togglePermission(user, DisplayConfig::tabSettings)))
.senderType(User.TYPE)
.permission(PredicatePermission.of(user -> this.togglePermission(user, DisplayConfig::tabSettings)))
.commandDescription(richDescription(Messages.COMMAND_TOGGLE_TAB_DESCRIPTION.plain()))
.handler(this::toggleTab));

this.commands.register(toggle.literal("actionbar")
.permission(PredicatePermission.of(user -> this.togglePermission(user, DisplayConfig::actionBarSettings)))
.senderType(User.TYPE)
.permission(PredicatePermission.of(user -> this.togglePermission(user, DisplayConfig::actionBarSettings)))
.commandDescription(richDescription(Messages.COMMAND_TOGGLE_ACTIONBAR_DESCRIPTION.plain()))
.handler(this::toggleActionBar));

this.commands.register(toggle.literal("bossbar")
.permission(PredicatePermission.of(user -> this.togglePermission(user, DisplayConfig::bossBarSettings)))
.senderType(User.TYPE)
.permission(PredicatePermission.of(user -> this.togglePermission(user, DisplayConfig::bossBarSettings)))
.commandDescription(richDescription(Messages.COMMAND_TOGGLE_BOSSBAR_DESCRIPTION.plain()))
.handler(this::toggleBossBar));
}

private boolean togglePermission(final @NonNull Commander sender, final @NonNull Function<DisplayConfig, DisplayConfig.DisplaySettings> function) {
if (!(sender instanceof User<?>)) {
return false;
}
return this.tabTPS.findDisplayConfig((User<?>) sender)
private boolean togglePermission(final @NonNull User<?> sender, final @NonNull Function<DisplayConfig, DisplayConfig.DisplaySettings> function) {
return this.tabTPS.findDisplayConfig(sender)
.map(config -> function.apply(config).allow())
.orElse(false);
}
Expand Down
2 changes: 1 addition & 1 deletion fabric/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ dependencies {
}

indra {
javaVersions().target(17)
javaVersions().target(21)
}

tasks {
Expand Down
4 changes: 2 additions & 2 deletions fabric/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
"tabtps-fabric.mixins.json"
],
"depends": {
"fabricloader": ">=0.15.3",
"fabricloader": ">=0.15.10",
"fabric": "*",
"fabric-permissions-api-v0": "*",
"minecraft": "~1.20.4"
"minecraft": "~1.20.6"
}
}
2 changes: 1 addition & 1 deletion gradle/build-logic/src/main/kotlin/ext.kt
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@ val bukkitVersions = listOf(
"1.17.1",
"1.18.2",
"1.19.4",
"1.20.4",
"1.20.6",
)
2 changes: 1 addition & 1 deletion gradle/build-logic/src/main/kotlin/tabtps.base.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ description = rootProject.description
indra {
javaVersions {
target(8)
minimumToolchain(17)
minimumToolchain(21)
}
github("jpenilla", "TabTPS")
mitLicense()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import me.modmuss50.mpp.ReleaseType

plugins {
id("tabtps.base")
id("com.github.johnrengelman.shadow")
id("io.github.goooler.shadow")
id("me.modmuss50.mod-publish-plugin")
}

Expand Down
24 changes: 12 additions & 12 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
[plugins]
blossom = { id = "net.kyori.blossom", version = "2.1.0" }
localization = { id = "ca.stellardrift.localization", version = "6.1.0" }
runPaper = { id = "xyz.jpenilla.run-paper", version = "2.2.3" }
runPaper = { id = "xyz.jpenilla.run-paper", version = "2.3.0" }
sponge-gradle = { id = "org.spongepowered.gradle.plugin", version = "2.2.0" }

[versions]
adventure = "4.16.0"
adventure = "4.17.0"
adventurePagination = "4.0.0-SNAPSHOT"
adventurePlatform = "4.3.2"
cloud = "2.0.0-beta.4"
cloudMinecraft = "2.0.0-beta.5"
cloudModded = "2.0.0-beta.4"
adventurePlatform = "4.3.3-SNAPSHOT"
cloud = "2.0.0-rc.1"
cloudMinecraft = "2.0.0-beta.7"
cloudModded = "2.0.0-beta.6"
cloudSponge = "2.0.0-SNAPSHOT"
configurate = "4.1.2"
typesafeConfig = "1.4.3"
Expand All @@ -22,15 +22,15 @@ guava = "21.0"
bstats = "3.0.2"
paperApi = "1.16.5-R0.1-SNAPSHOT"
paperLib = "1.0.8"
fabricApi = "0.94.0+1.20.4"
fabricLoader = "0.15.10"
minecraft = "1.20.4"
adventurePlatformFabric = "5.12.0"
fabricApi = "0.98.0+1.20.6"
fabricLoader = "0.15.11"
minecraft = "1.20.6"
adventurePlatformFabric = "5.13.0"
mixin = "0.8.5"

# buildSrc
indra = "3.1.3"
shadow = "8.1.1"
shadow = "8.1.7"
mod-publish-plugin = "0.5.1"
hangarPublishPlugin = "0.1.2"

Expand Down Expand Up @@ -81,7 +81,7 @@ minecraft = { group = "com.mojang", name = "minecraft", version.ref = "minecraft
# buildSrc
build-indraCommon = { group = "net.kyori", name = "indra-common", version.ref = "indra" }
build-indraLicenser = { group = "net.kyori", name = "indra-licenser-spotless", version.ref = "indra" }
build-shadow = { group = "com.github.johnrengelman", name = "shadow", version.ref = "shadow" }
build-shadow = { module = "io.github.goooler.shadow:shadow-gradle-plugin", version.ref = "shadow" }
build-mod-publish-plugin = { module = "me.modmuss50:mod-publish-plugin", version.ref = "mod-publish-plugin" }
build-hangarPublishPlugin = { group = "io.papermc", name = "hangar-publish-plugin", version.ref = "hangarPublishPlugin" }

Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
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-8.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ pluginManagement {
}

plugins {
id("quiet-fabric-loom") version "1.5-SNAPSHOT"
id("quiet-fabric-loom") version "1.6-SNAPSHOT"
id("org.spongepowered.gradle.vanilla") version "0.2.1-SNAPSHOT"
id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0"
}
Expand Down
8 changes: 6 additions & 2 deletions spigot/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ tasks {

shadowJar {
archiveClassifier.set(null as String?)
minimize()
sequenceOf(
"org.slf4j",
"org.incendo.cloud",
Expand All @@ -41,6 +40,9 @@ tasks {
).forEach { pkg ->
relocate(pkg, "${rootProject.group}.${rootProject.name.lowercase()}.lib.$pkg")
}
manifest {
attributes("paperweight-mappings-namespace" to "mojang")
}
}

val mcVer = libs.versions.minecraft.get()
Expand All @@ -67,8 +69,10 @@ tasks {
"1.17.1",
"1.18.2",
"1.19.4",
mcVer,
),
21 to setOf(
mcVer,
)
).forEach { (javaVersion, minecraftVersions) ->
for (version in minecraftVersions) {
createVersionedRun(version, javaVersion)
Expand Down
4 changes: 2 additions & 2 deletions sponge/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ sponge {
}

minecraft {
version("1.20.4")
version("1.20.6")
platform(MinecraftPlatform.JOINED)
}

Expand Down Expand Up @@ -97,7 +97,7 @@ tabTPSPlatform {
publishMods.modrinth {
modLoaders.add("sponge")
minecraftVersions.addAll(
"1.20.4"
"1.20.6"
)
}

Expand Down