mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-02 14:38:49 +00:00
Cleanup/fix library loading for paper
This commit is contained in:
1 parent
493f4cfec3
commit
10e0270407
4 files changed
+49
-48
No files matched your search
@@ -55,12 +55,13 @@ fun ShadowJar.configureShadowJar() {
|
||||
dependencies {
|
||||
// not needed at runtime
|
||||
exclude(dependency("com.google.code.findbugs:jsr305"))
|
||||
exclude(dependency("org.checkerframework:checker-qual"))
|
||||
exclude(dependency("com.google.errorprone:error_prone_annotations"))
|
||||
exclude(dependency("com.google.guava:guava"))
|
||||
exclude(dependency("com.google.j2objc:j2objc-annotations"))
|
||||
exclude(dependency("io.netty:netty-all"))
|
||||
exclude(dependency("io.netty:netty-buffer"))
|
||||
exclude(dependency("it.unimi.dsi:fastutil"))
|
||||
exclude(dependency("org.checkerframework:checker-qual"))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ dependencies {
|
||||
}
|
||||
|
||||
// Other
|
||||
api(libs.guice){
|
||||
api(libs.guice) {
|
||||
exclude("com.google.guava")
|
||||
}
|
||||
api(libs.assistedInject)
|
||||
|
||||
@@ -27,8 +27,6 @@ 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;
|
||||
@@ -105,8 +103,6 @@ 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();
|
||||
|
||||
@@ -120,48 +116,6 @@ 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")
|
||||
.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.21.12")
|
||||
.relocate("com.google.protobuf", "net.draycia.carbon.libs.com.google.protobuf")
|
||||
.build();
|
||||
|
||||
libraryManager.loadLibrary(protobuf);
|
||||
|
||||
final Library mysqlConnector = Library.builder()
|
||||
.groupId("com.mysql")
|
||||
.artifactId("mysql-connector-j")
|
||||
.version("8.0.31")
|
||||
//.relocate("mysql-connector-j", "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);
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
package net.draycia.carbon.paper;
|
||||
|
||||
import com.google.inject.Guice;
|
||||
import net.byteflux.libby.BukkitLibraryManager;
|
||||
import net.byteflux.libby.Library;
|
||||
import net.draycia.carbon.api.CarbonChatProvider;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
||||
@@ -33,6 +35,8 @@ public final class CarbonPaperBootstrap extends JavaPlugin {
|
||||
|
||||
@Override
|
||||
public void onLoad() {
|
||||
this.loadLibraries();
|
||||
|
||||
this.carbonChat = Guice.createInjector(new CarbonChatPaperModule(this))
|
||||
.getInstance(CarbonChatPaper.class);
|
||||
CarbonChatProvider.register(this.carbonChat);
|
||||
@@ -52,4 +56,46 @@ public final class CarbonPaperBootstrap extends JavaPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
private void loadLibraries() {
|
||||
final BukkitLibraryManager libraryManager = new BukkitLibraryManager(this);
|
||||
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")
|
||||
.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.21.12")
|
||||
.relocate("com.google.protobuf", "net.draycia.carbon.libs.com.google.protobuf")
|
||||
.build();
|
||||
|
||||
libraryManager.loadLibrary(protobuf);
|
||||
|
||||
final Library mysqlConnector = Library.builder()
|
||||
.groupId("com.mysql")
|
||||
.artifactId("mysql-connector-j")
|
||||
.version("8.0.31")
|
||||
//.relocate("mysql-connector-j", "net.draycia.carbon.libs.mysql")
|
||||
.build();
|
||||
|
||||
libraryManager.loadLibrary(mysqlConnector);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user