mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-03 14:38:51 +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
@@ -27,6 +27,8 @@ import github.scarsz.discordsrv.DiscordSRV;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Set;
|
||||
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.events.CarbonEventHandler;
|
||||
import net.draycia.carbon.common.CarbonChatInternal;
|
||||
@@ -103,6 +105,8 @@ public final class CarbonChatPaper extends CarbonChatInternal<CarbonPlayerPaper>
|
||||
void onEnable() {
|
||||
final Metrics metrics = new Metrics(this.plugin, BSTATS_PLUGIN_ID);
|
||||
|
||||
this.loadLibraries();
|
||||
|
||||
this.init();
|
||||
this.packetService();
|
||||
|
||||
@@ -116,6 +120,49 @@ public final class CarbonChatPaper extends CarbonChatInternal<CarbonPlayerPaper>
|
||||
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() {
|
||||
if (Bukkit.getPluginManager().isPluginEnabled("EssentialsDiscord")) {
|
||||
final DiscordMessageListener discordMessageListener = this.injector().getInstance(DiscordMessageListener.class);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* CarbonChat
|
||||
*
|
||||
* Copyright (c) 2021 Josua Parks (Vicarious)
|
||||
* Copyright (c) 2023 Josua Parks (Vicarious)
|
||||
* Contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
Reference in new issue
Block a user