mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-04 14:38:49 +00:00
Download large dependencies at runtime
This commit is contained in:
1 parent
1d0fa05a46
commit
aa2662a694
11 files changed
+71
-111
No files matched your search
@@ -19,13 +19,15 @@ dependencies {
|
|||||||
compileOnlyApi(libs.checkerQual)
|
compileOnlyApi(libs.checkerQual)
|
||||||
|
|
||||||
api(libs.kyoriEventApi)
|
api(libs.kyoriEventApi)
|
||||||
api(libs.kyoriRegistry)
|
api(libs.kyoriRegistry) {
|
||||||
|
exclude("com.google.guava")
|
||||||
|
}
|
||||||
api(libs.kyoriMoonshine)
|
api(libs.kyoriMoonshine)
|
||||||
api(libs.kyoriMoonshineCore)
|
api(libs.kyoriMoonshineCore)
|
||||||
api(libs.kyoriMoonshineStandard)
|
api(libs.kyoriMoonshineStandard)
|
||||||
|
|
||||||
// we shade and relocate a newer version than minecraft provides
|
// we shade and relocate a newer version than minecraft provides
|
||||||
api(libs.guava)
|
compileOnlyApi(libs.guava)
|
||||||
|
|
||||||
// Provided by Minecraft
|
// Provided by Minecraft
|
||||||
compileOnlyApi(libs.gson)
|
compileOnlyApi(libs.gson)
|
||||||
|
|||||||
@@ -11,13 +11,6 @@ fun ShadowJar.relocateDependency(pkg: String) {
|
|||||||
relocate(pkg, "net.draycia.carbon.libs.$pkg")
|
relocate(pkg, "net.draycia.carbon.libs.$pkg")
|
||||||
}
|
}
|
||||||
|
|
||||||
fun ShadowJar.relocateNatives() {
|
|
||||||
relocate("darwin", "natives/darwin")
|
|
||||||
relocate("freebsd", "natives/freebsd")
|
|
||||||
relocate("linux", "natives/linux")
|
|
||||||
relocate("win", "natives/win")
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Relocates dependencies which we bundle and relocate on all platforms.
|
* Relocates dependencies which we bundle and relocate on all platforms.
|
||||||
*/
|
*/
|
||||||
@@ -29,21 +22,13 @@ fun ShadowJar.standardRelocations() {
|
|||||||
relocateDependency("net.kyori.registry")
|
relocateDependency("net.kyori.registry")
|
||||||
relocateDependency("org.spongepowered.configurate")
|
relocateDependency("org.spongepowered.configurate")
|
||||||
relocateDependency("com.typesafe.config")
|
relocateDependency("com.typesafe.config")
|
||||||
relocateDependency("com.google.common")
|
|
||||||
relocateDependency("com.google.thirdparty.publicsuffix")
|
relocateDependency("com.google.thirdparty.publicsuffix")
|
||||||
relocateDependency("com.google.protobuf")
|
|
||||||
relocateDependency("google.protobuf")
|
|
||||||
//relocateDependency("it.unimi.dsi.fastutil")
|
|
||||||
relocateDependency("org.jdbi")
|
relocateDependency("org.jdbi")
|
||||||
relocateDependency("com.github.benmanes")
|
relocateDependency("com.github.benmanes")
|
||||||
relocateDependency("org.mariadb.jdbc")
|
relocateDependency("org.mariadb.jdbc")
|
||||||
relocateDependency("com.mysql")
|
|
||||||
//relocateDependency("org.flywaydb")
|
|
||||||
relocateDependency("com.zaxxer.hikari")
|
relocateDependency("com.zaxxer.hikari")
|
||||||
relocateDependency("org.postgresql")
|
relocateDependency("org.postgresql")
|
||||||
relocateDependency("redis.clients.jedis")
|
relocateDependency("redis.clients.jedis")
|
||||||
//relocateDependency("org.slf4j")
|
|
||||||
//relocateDependency("org.apache")
|
|
||||||
relocateDependency("ninja.egg82.messenger")
|
relocateDependency("ninja.egg82.messenger")
|
||||||
relocateDependency("org.antlr")
|
relocateDependency("org.antlr")
|
||||||
//relocateDependency("com.github.luben")
|
//relocateDependency("com.github.luben")
|
||||||
@@ -51,8 +36,7 @@ fun ShadowJar.standardRelocations() {
|
|||||||
relocateDependency("io.nats")
|
relocateDependency("io.nats")
|
||||||
relocateDependency("com.rabbitmq")
|
relocateDependency("com.rabbitmq")
|
||||||
relocateDependency("com.electronwill")
|
relocateDependency("com.electronwill")
|
||||||
|
relocateDependency("net.byteflux")
|
||||||
relocateNatives();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun ShadowJar.relocateCloud() {
|
fun ShadowJar.relocateCloud() {
|
||||||
|
|||||||
@@ -20,7 +20,9 @@ dependencies {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Other
|
// Other
|
||||||
api(libs.guice)
|
api(libs.guice){
|
||||||
|
exclude("com.google.guava")
|
||||||
|
}
|
||||||
api(libs.assistedInject)
|
api(libs.assistedInject)
|
||||||
compileOnlyApi(libs.luckPermsApi)
|
compileOnlyApi(libs.luckPermsApi)
|
||||||
|
|
||||||
@@ -31,7 +33,9 @@ dependencies {
|
|||||||
api(libs.hikariCP)
|
api(libs.hikariCP)
|
||||||
api(libs.flyway)
|
api(libs.flyway)
|
||||||
api(libs.flywayMysql)
|
api(libs.flywayMysql)
|
||||||
api(libs.mysql)
|
compileOnlyApi(libs.mysql) {
|
||||||
|
exclude ("com.google.protobuf")
|
||||||
|
}
|
||||||
api(libs.postgresql)
|
api(libs.postgresql)
|
||||||
api(libs.caffeine)
|
api(libs.caffeine)
|
||||||
api(libs.mariadb)
|
api(libs.mariadb)
|
||||||
@@ -41,7 +45,7 @@ dependencies {
|
|||||||
api(libs.messengerRabbitmq)
|
api(libs.messengerRabbitmq)
|
||||||
api(libs.messengerRedis)
|
api(libs.messengerRedis)
|
||||||
api(libs.netty)
|
api(libs.netty)
|
||||||
api(libs.zstdjni)
|
compileOnlyApi(libs.zstdjni)
|
||||||
api(libs.jedis)
|
api(libs.jedis)
|
||||||
api(libs.rabbitmq)
|
api(libs.rabbitmq)
|
||||||
api(libs.nats)
|
api(libs.nats)
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ public class FabricChatListener implements Consumer<ChatCallback.Chat> {
|
|||||||
final var renderers = new ArrayList<KeyedRenderer>();
|
final var renderers = new ArrayList<KeyedRenderer>();
|
||||||
renderers.add(keyedRenderer(key("carbon", "default"), channel));
|
renderers.add(keyedRenderer(key("carbon", "default"), channel));
|
||||||
|
|
||||||
final var chatEvent = new CarbonChatEvent(sender, eventMessage, recipients, renderers, channel, false);
|
final var chatEvent = new CarbonChatEvent(sender, eventMessage, recipients, renderers, channel, null);
|
||||||
final var result = this.carbonChatFabric.eventHandler().emit(chatEvent);
|
final var result = this.carbonChatFabric.eventHandler().emit(chatEvent);
|
||||||
|
|
||||||
if (!result.wasSuccessful()) {
|
if (!result.wasSuccessful()) {
|
||||||
|
|||||||
+1
-1
@@ -108,7 +108,7 @@ public class FabricChatPreviewListener implements ChatDecorator {
|
|||||||
final var renderers = new ArrayList<KeyedRenderer>();
|
final var renderers = new ArrayList<KeyedRenderer>();
|
||||||
renderers.add(keyedRenderer(key("carbon", "default"), channel));
|
renderers.add(keyedRenderer(key("carbon", "default"), channel));
|
||||||
|
|
||||||
final var chatEvent = new CarbonChatEvent(sender, message, this.carbonChat.server().players(), renderers, channel, true);
|
final var chatEvent = new CarbonChatEvent(sender, message, this.carbonChat.server().players(), renderers, channel, null);
|
||||||
final var result = this.carbonChat.eventHandler().emit(chatEvent);
|
final var result = this.carbonChat.eventHandler().emit(chatEvent);
|
||||||
|
|
||||||
if (!result.wasSuccessful()) {
|
if (!result.wasSuccessful()) {
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ versions:
|
|||||||
rabbitmq: 5.13.1
|
rabbitmq: 5.13.1
|
||||||
nats: 2.12.0
|
nats: 2.12.0
|
||||||
pluginYml: 0.5.3
|
pluginYml: 0.5.3
|
||||||
|
libby: 1.1.5
|
||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
adventureBom:
|
adventureBom:
|
||||||
@@ -327,4 +328,9 @@ dependencies:
|
|||||||
name: discordsrv
|
name: discordsrv
|
||||||
version: { ref: discordsrv }
|
version: { ref: discordsrv }
|
||||||
|
|
||||||
|
libbyBukkit:
|
||||||
|
group: net.byteflux
|
||||||
|
name: libby-bukkit
|
||||||
|
version: { ref: libby }
|
||||||
|
|
||||||
bundles:
|
bundles:
|
||||||
@@ -20,6 +20,7 @@ dependencies {
|
|||||||
|
|
||||||
// Misc
|
// Misc
|
||||||
implementation(libs.bstatsBukkit)
|
implementation(libs.bstatsBukkit)
|
||||||
|
implementation(libs.libbyBukkit)
|
||||||
|
|
||||||
// Plugins
|
// Plugins
|
||||||
compileOnly("me.clip:placeholderapi:2.10.9") // TODO: move this to libs.versions.yml
|
compileOnly("me.clip:placeholderapi:2.10.9") // TODO: move this to libs.versions.yml
|
||||||
|
|||||||
-86
@@ -1,86 +0,0 @@
|
|||||||
package net.draycia.carbon.paper.internalsaccessor.impl;
|
|
||||||
|
|
||||||
import cloud.commandframework.CommandManager;
|
|
||||||
import cloud.commandframework.arguments.parser.ArgumentParser;
|
|
||||||
import cloud.commandframework.brigadier.argument.WrappedBrigadierParser;
|
|
||||||
import com.google.inject.Inject;
|
|
||||||
import java.lang.reflect.Method;
|
|
||||||
import java.util.function.Consumer;
|
|
||||||
import net.draycia.carbon.common.command.CarbonCommand;
|
|
||||||
import net.draycia.carbon.common.command.CommandSettings;
|
|
||||||
import net.draycia.carbon.common.command.Commander;
|
|
||||||
import net.kyori.adventure.key.Key;
|
|
||||||
import net.minecraft.commands.CommandSigningContext;
|
|
||||||
import net.minecraft.commands.CommandSourceStack;
|
|
||||||
import net.minecraft.commands.arguments.MessageArgument;
|
|
||||||
import net.minecraft.network.chat.ChatType;
|
|
||||||
import net.minecraft.network.chat.Component;
|
|
||||||
import net.minecraft.network.chat.PlayerChatMessage;
|
|
||||||
import net.minecraft.server.players.PlayerList;
|
|
||||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
|
||||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
|
||||||
import org.checkerframework.framework.qual.DefaultQualifier;
|
|
||||||
|
|
||||||
@DefaultQualifier(NonNull.class)
|
|
||||||
public final class SignedArgumentPaper extends CarbonCommand {
|
|
||||||
|
|
||||||
private final CommandManager<Commander> commandManager;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
public SignedArgumentPaper(
|
|
||||||
final CommandManager<Commander> commandManager
|
|
||||||
) {
|
|
||||||
this.commandManager = commandManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void init() {
|
|
||||||
this.commandManager.command(
|
|
||||||
this.commandManager.commandBuilder("test_signed")
|
|
||||||
.argument(this.commandManager.argumentBuilder(MessageArgument.Message.class, "message").withParser(message()))
|
|
||||||
.handler(ctx -> {
|
|
||||||
try {
|
|
||||||
resolveChatMessage(ctx.get("message"), ctx.get(WrappedBrigadierParser.COMMAND_CONTEXT_BRIGADIER_NATIVE_SENDER), "message", msg -> {
|
|
||||||
final CommandSourceStack commandSourceStack = ctx.get(WrappedBrigadierParser.COMMAND_CONTEXT_BRIGADIER_NATIVE_SENDER);
|
|
||||||
PlayerList playerList = commandSourceStack.getServer().getPlayerList();
|
|
||||||
playerList.broadcastChatMessage(msg, commandSourceStack, ChatType.bind(ChatType.SAY_COMMAND, commandSourceStack));
|
|
||||||
});
|
|
||||||
} catch (final Exception ex) {
|
|
||||||
throw new RuntimeException(ex);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected CommandSettings _commandSettings() {
|
|
||||||
return new CommandSettings("signed_test");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Key key() {
|
|
||||||
return Key.key("carbon", "signed_test");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void resolveChatMessage(MessageArgument.Message message, CommandSourceStack commandSourceStack, String string, Consumer<PlayerChatMessage> consumer) throws Exception {
|
|
||||||
final Method resolveComponent = message.getClass().getDeclaredMethod("resolveComponent", CommandSourceStack.class);
|
|
||||||
resolveComponent.setAccessible(true);
|
|
||||||
Component component = (Component) resolveComponent.invoke(message, commandSourceStack);
|
|
||||||
CommandSigningContext commandSigningContext = commandSourceStack.getSigningContext();
|
|
||||||
@Nullable PlayerChatMessage playerChatMessage = commandSigningContext.getArgument(string);
|
|
||||||
if (playerChatMessage != null) {
|
|
||||||
final Method resolveSignedMessage = MessageArgument.class.getDeclaredMethod("resolveSignedMessage", Consumer.class, CommandSourceStack.class, PlayerChatMessage.class);
|
|
||||||
resolveSignedMessage.setAccessible(true);
|
|
||||||
resolveSignedMessage.invoke(null, consumer, commandSourceStack, playerChatMessage.withUnsignedContent(component));
|
|
||||||
} else {
|
|
||||||
final Method resolveDisguisedMessage = MessageArgument.class.getDeclaredMethod("resolveDisguisedMessage", Consumer.class, CommandSourceStack.class, PlayerChatMessage.class);
|
|
||||||
resolveDisguisedMessage.setAccessible(true);
|
|
||||||
resolveDisguisedMessage.invoke(null, consumer, commandSourceStack, PlayerChatMessage.system(message.getText()).withUnsignedContent(component));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static <C> @NonNull ArgumentParser<C, MessageArgument.Message> message() {
|
|
||||||
return new WrappedBrigadierParser<>(MessageArgument::message);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -27,6 +27,8 @@ import github.scarsz.discordsrv.DiscordSRV;
|
|||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
|
import net.byteflux.libby.BukkitLibraryManager;
|
||||||
|
import net.byteflux.libby.Library;
|
||||||
import net.draycia.carbon.api.CarbonServer;
|
import net.draycia.carbon.api.CarbonServer;
|
||||||
import net.draycia.carbon.api.events.CarbonEventHandler;
|
import net.draycia.carbon.api.events.CarbonEventHandler;
|
||||||
import net.draycia.carbon.common.CarbonChatInternal;
|
import net.draycia.carbon.common.CarbonChatInternal;
|
||||||
@@ -103,6 +105,8 @@ public final class CarbonChatPaper extends CarbonChatInternal<CarbonPlayerPaper>
|
|||||||
void onEnable() {
|
void onEnable() {
|
||||||
final Metrics metrics = new Metrics(this.plugin, BSTATS_PLUGIN_ID);
|
final Metrics metrics = new Metrics(this.plugin, BSTATS_PLUGIN_ID);
|
||||||
|
|
||||||
|
this.loadLibraries();
|
||||||
|
|
||||||
this.init();
|
this.init();
|
||||||
this.packetService();
|
this.packetService();
|
||||||
|
|
||||||
@@ -116,6 +120,49 @@ public final class CarbonChatPaper extends CarbonChatInternal<CarbonPlayerPaper>
|
|||||||
this.discoverDiscordHooks();
|
this.discoverDiscordHooks();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void loadLibraries() {
|
||||||
|
final BukkitLibraryManager libraryManager = new BukkitLibraryManager(this.plugin);
|
||||||
|
libraryManager.addMavenCentral();
|
||||||
|
libraryManager.addSonatype();
|
||||||
|
|
||||||
|
// TODO: move this into common, supply library manager
|
||||||
|
final Library messenger = Library.builder()
|
||||||
|
.groupId("com.github.luben")
|
||||||
|
.artifactId("zstd-jni")
|
||||||
|
.version("1.5.1-1")
|
||||||
|
.relocate("com.github.luben", "net.draycia.carbon.libs.com.github.luben")
|
||||||
|
.build();
|
||||||
|
|
||||||
|
libraryManager.loadLibrary(messenger);
|
||||||
|
|
||||||
|
final Library guava = Library.builder()
|
||||||
|
.groupId("com.google.guava")
|
||||||
|
.artifactId("guava")
|
||||||
|
.version("30.1-jre")
|
||||||
|
.relocate("com.google.common", "net.draycia.carbon.libs.com.google.common")
|
||||||
|
.build();
|
||||||
|
|
||||||
|
libraryManager.loadLibrary(guava);
|
||||||
|
|
||||||
|
final Library protobuf = Library.builder()
|
||||||
|
.groupId("com.google.protobuf")
|
||||||
|
.artifactId("protobuf-java")
|
||||||
|
.version("3.19.4")
|
||||||
|
.relocate("com.google.protobuf", "net.draycia.carbon.libs.com.google.protobuf")
|
||||||
|
.build();
|
||||||
|
|
||||||
|
libraryManager.loadLibrary(protobuf);
|
||||||
|
|
||||||
|
final Library mysqlConnector = Library.builder()
|
||||||
|
.groupId("mysql")
|
||||||
|
.artifactId("mysql-connector-java")
|
||||||
|
.version("8.0.31")
|
||||||
|
.relocate("mysql-connector-java", "net.draycia.carbon.libs.mysql")
|
||||||
|
.build();
|
||||||
|
|
||||||
|
libraryManager.loadLibrary(mysqlConnector);
|
||||||
|
}
|
||||||
|
|
||||||
private void discoverDiscordHooks() {
|
private void discoverDiscordHooks() {
|
||||||
if (Bukkit.getPluginManager().isPluginEnabled("EssentialsDiscord")) {
|
if (Bukkit.getPluginManager().isPluginEnabled("EssentialsDiscord")) {
|
||||||
final DiscordMessageListener discordMessageListener = this.injector().getInstance(DiscordMessageListener.class);
|
final DiscordMessageListener discordMessageListener = this.injector().getInstance(DiscordMessageListener.class);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* CarbonChat
|
* CarbonChat
|
||||||
*
|
*
|
||||||
* Copyright (c) 2021 Josua Parks (Vicarious)
|
* Copyright (c) 2023 Josua Parks (Vicarious)
|
||||||
* Contributors
|
* Contributors
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
|||||||
@@ -55,6 +55,8 @@ dependencyResolutionManagement {
|
|||||||
// DiscordSRV
|
// DiscordSRV
|
||||||
maven("https://m2.dv8tion.net/releases")
|
maven("https://m2.dv8tion.net/releases")
|
||||||
maven("https://nexus.scarsz.me/content/groups/public/")
|
maven("https://nexus.scarsz.me/content/groups/public/")
|
||||||
|
// Libby (AlessioDP's fork)
|
||||||
|
maven("https://repo.alessiodp.com/releases/")
|
||||||
}
|
}
|
||||||
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
|
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user