mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-04 06:28:53 +00:00
Use custom version of Shadow for Record support
This is necessary until jdependency updates, and then shadow pulls that update.
This commit is contained in:
1 parent
7479fdf1fc
commit
93a9194711
8 files changed
+48
-37
No files matched your search
+3
-9
@@ -1,15 +1,9 @@
|
|||||||
import net.kyori.indra.IndraCheckstylePlugin
|
|
||||||
import net.kyori.indra.IndraPlugin
|
|
||||||
import net.kyori.indra.IndraPublishingPlugin
|
|
||||||
import net.kyori.indra.repository.sonatypeSnapshots
|
import net.kyori.indra.repository.sonatypeSnapshots
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id("net.kyori.indra")
|
id("net.kyori.indra")
|
||||||
id("net.kyori.indra.git")
|
id("net.kyori.indra.git")
|
||||||
id("net.kyori.indra.checkstyle")
|
id("net.kyori.indra.checkstyle")
|
||||||
id("net.kyori.indra.publishing") apply false
|
|
||||||
//id("com.github.johnrengelman.shadow") apply false
|
|
||||||
id("org.checkerframework") apply false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
group = "net.draycia"
|
group = "net.draycia"
|
||||||
@@ -18,9 +12,9 @@ val projectVersion: String by project // get from gradle.properties
|
|||||||
version = projectVersion
|
version = projectVersion
|
||||||
|
|
||||||
subprojects {
|
subprojects {
|
||||||
apply<IndraPlugin>()
|
plugins.apply("net.kyori.indra")
|
||||||
apply<IndraCheckstylePlugin>()
|
plugins.apply("net.kyori.indra.checkstyle")
|
||||||
apply<IndraPublishingPlugin>()
|
plugins.apply("net.kyori.indra.publishing")
|
||||||
|
|
||||||
if (projectVersion.endsWith("-SNAPSHOT")) {
|
if (projectVersion.endsWith("-SNAPSHOT")) {
|
||||||
// Add git commit hash to version for platforms, but not for API
|
// Add git commit hash to version for platforms, but not for API
|
||||||
|
|||||||
@@ -4,9 +4,11 @@ plugins {
|
|||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
gradlePluginPortal()
|
gradlePluginPortal()
|
||||||
|
maven("https://repo.jpenilla.xyz/snapshots/") // todo: for shadow to be compatible with Records
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
// sadly can't use the version catalog here (?), need to keep in sync manually
|
// sadly can't use the version catalog here (?), need to keep in sync manually
|
||||||
implementation("gradle.plugin.com.github.jengelman.gradle.plugins", "shadow", "7.0.0")
|
//implementation("gradle.plugin.com.github.jengelman.gradle.plugins", "shadow", "7.0.0") // temporary until shadow bumps jdependency for Record support
|
||||||
|
implementation("com.github.johnrengelman", "shadow", "7.1.0-hexaoxide-SNAPSHOT") // temporary until shadow bumps jdependency for Record support
|
||||||
}
|
}
|
||||||
@@ -14,7 +14,17 @@ public interface BukkitCommander extends Commander, ForwardingAudience.Single {
|
|||||||
return new BukkitCommanderImpl(sender);
|
return new BukkitCommanderImpl(sender);
|
||||||
}
|
}
|
||||||
|
|
||||||
record BukkitCommanderImpl(@NonNull CommandSender commandSender) implements BukkitCommander {
|
final class BukkitCommanderImpl implements BukkitCommander {
|
||||||
|
|
||||||
|
private final CommandSender commandSender;
|
||||||
|
|
||||||
|
private BukkitCommanderImpl(final @NonNull CommandSender commandSender) {
|
||||||
|
this.commandSender = commandSender;
|
||||||
|
}
|
||||||
|
|
||||||
|
public @NonNull CommandSender commandSender() {
|
||||||
|
return this.commandSender;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NonNull Audience audience() {
|
public @NonNull Audience audience() {
|
||||||
|
|||||||
@@ -10,26 +10,24 @@ import org.checkerframework.checker.nullness.qual.NonNull;
|
|||||||
|
|
||||||
import static java.util.Objects.requireNonNull;
|
import static java.util.Objects.requireNonNull;
|
||||||
|
|
||||||
public record BukkitPlayerCommander(CarbonChat carbon,
|
public record BukkitPlayerCommander(
|
||||||
@NonNull Player player) implements PlayerCommander, BukkitCommander {
|
@NonNull CarbonChat carbon,
|
||||||
|
@NonNull Player player
|
||||||
|
) implements PlayerCommander, BukkitCommander {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NonNull
|
public @NonNull CommandSender commandSender() {
|
||||||
CommandSender commandSender() {
|
|
||||||
return this.player;
|
return this.player;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NonNull
|
public @NonNull Audience audience() {
|
||||||
Audience audience() {
|
|
||||||
return this.player;
|
return this.player;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NonNull
|
public @NonNull CarbonPlayer carbonPlayer() {
|
||||||
CarbonPlayer carbonPlayer() {
|
return requireNonNull(this.carbon.userManager().carbonPlayer(this.player.getUniqueId()), "No CarbonPlayer for logged in Player!");
|
||||||
return requireNonNull(this.carbon.userManager().carbonPlayer(this.player.getUniqueId()),
|
|
||||||
"No CarbonPlayer for logged in Player!");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -8,10 +8,9 @@ plugins:
|
|||||||
net.kyori.indra.checkstyle: *indra
|
net.kyori.indra.checkstyle: *indra
|
||||||
net.kyori.indra.publishing: *indra
|
net.kyori.indra.publishing: *indra
|
||||||
net.kyori.indra.git: *indra
|
net.kyori.indra.git: *indra
|
||||||
com.github.johnrengelman.shadow: 7.0.0
|
com.github.johnrengelman.shadow: 7.1.0-hexaoxide-SNAPSHOT # todo: temporary until shadow bumps jdependency for Record support
|
||||||
net.minecrell.plugin-yml.bukkit: 0.4.0
|
net.minecrell.plugin-yml.bukkit: 0.4.0
|
||||||
org.spongepowered.gradle.plugin: 1.0.3
|
org.spongepowered.gradle.plugin: 1.0.3
|
||||||
org.checkerframework: 0.5.20
|
|
||||||
|
|
||||||
versions:
|
versions:
|
||||||
adventure: 4.7.0
|
adventure: 4.7.0
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ pluginManagement {
|
|||||||
repositories {
|
repositories {
|
||||||
gradlePluginPortal()
|
gradlePluginPortal()
|
||||||
maven("https://repo.stellardrift.ca/repository/snapshots/") // todo: polyglot-version-catalogs is not released on the gradle plugin portal yet
|
maven("https://repo.stellardrift.ca/repository/snapshots/") // todo: polyglot-version-catalogs is not released on the gradle plugin portal yet
|
||||||
|
maven("https://repo.jpenilla.xyz/snapshots/") // todo: for shadow to be compatible with Records
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,12 +14,21 @@ public interface SpongeCommander extends Commander, ForwardingAudience.Single {
|
|||||||
return new SpongeCommanderImpl(commandCause);
|
return new SpongeCommanderImpl(commandCause);
|
||||||
}
|
}
|
||||||
|
|
||||||
record SpongeCommanderImpl(
|
final class SpongeCommanderImpl implements SpongeCommander {
|
||||||
@NonNull CommandCause commandCause) implements SpongeCommander {
|
|
||||||
|
private final CommandCause commandCause;
|
||||||
|
|
||||||
|
private SpongeCommanderImpl(final @NonNull CommandCause commandCause) {
|
||||||
|
this.commandCause = commandCause;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NonNull
|
public @NonNull CommandCause commandCause() {
|
||||||
Audience audience() {
|
return this.commandCause;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NonNull Audience audience() {
|
||||||
return this.commandCause.audience();
|
return this.commandCause.audience();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,21 +10,19 @@ import org.spongepowered.api.entity.living.player.server.ServerPlayer;
|
|||||||
|
|
||||||
import static java.util.Objects.requireNonNull;
|
import static java.util.Objects.requireNonNull;
|
||||||
|
|
||||||
public record SpongePlayerCommander(CarbonChat carbon,
|
public record SpongePlayerCommander(
|
||||||
@NonNull ServerPlayer player,
|
@NonNull CarbonChat carbon,
|
||||||
@NonNull CommandCause commandCause)
|
@NonNull ServerPlayer player,
|
||||||
implements PlayerCommander, SpongeCommander {
|
@NonNull CommandCause commandCause
|
||||||
|
) implements PlayerCommander, SpongeCommander {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NonNull
|
public @NonNull CarbonPlayer carbonPlayer() {
|
||||||
CarbonPlayer carbonPlayer() {
|
return requireNonNull(this.carbon.userManager().carbonPlayer(this.player.uniqueId()), "No CarbonPlayer for logged in Player!");
|
||||||
return requireNonNull(this.carbon.userManager().carbonPlayer(this.player.uniqueId()),
|
|
||||||
"No CarbonPlayer for logged in Player!");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NonNull
|
public @NonNull Audience audience() {
|
||||||
Audience audience() {
|
|
||||||
return this.commandCause.audience();
|
return this.commandCause.audience();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user