mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-12-23 09:37:54 +01:00
Comment out slimjar related configuration (#2138)
This commit is contained in:
parent
2293760e7f
commit
ebb1108969
@ -8,7 +8,7 @@ buildscript {
|
||||
|
||||
plugins {
|
||||
id "com.github.johnrengelman.shadow" version "7.1.0" apply false
|
||||
id "io.github.slimjar" version "1.3.0" apply false
|
||||
// id "io.github.slimjar" version "1.3.0" apply false
|
||||
id "java"
|
||||
id "jacoco"
|
||||
id "checkstyle"
|
||||
@ -49,7 +49,7 @@ logger.lifecycle("Building artifact for version $fullVersion")
|
||||
subprojects {
|
||||
// Build plugins
|
||||
apply plugin: "com.github.johnrengelman.shadow"
|
||||
apply plugin: "io.github.slimjar"
|
||||
// apply plugin: "io.github.slimjar"
|
||||
apply plugin: "java"
|
||||
apply plugin: "maven-publish"
|
||||
|
||||
@ -104,7 +104,7 @@ subprojects {
|
||||
|
||||
dependencies {
|
||||
// Dependency Injection used across the project
|
||||
implementation "io.github.slimjar:slimjar:1.2.6" // Runtime dependency injection
|
||||
// implementation "io.github.slimjar:slimjar:1.2.6" // Runtime dependency injection
|
||||
implementation "com.google.dagger:dagger:$daggerVersion"
|
||||
annotationProcessor "com.google.dagger:dagger-compiler:$daggerCompilerVersion"
|
||||
testAnnotationProcessor "com.google.dagger:dagger-compiler:$daggerCompilerVersion"
|
||||
|
@ -25,8 +25,6 @@ import com.djrapitops.plan.gathering.ServerShutdownSave;
|
||||
import com.djrapitops.plan.settings.locale.Locale;
|
||||
import com.djrapitops.plan.settings.locale.lang.PluginLang;
|
||||
import com.djrapitops.plan.settings.theme.PlanColorScheme;
|
||||
import io.github.slimjar.app.builder.ApplicationBuilder;
|
||||
import io.github.slimjar.resolver.data.Repository;
|
||||
import net.playeranalytics.plugin.BukkitPlatformLayer;
|
||||
import net.playeranalytics.plugin.PlatformAbstractionLayer;
|
||||
import net.playeranalytics.plugin.scheduling.RunnableFactory;
|
||||
@ -36,12 +34,6 @@ import org.bukkit.command.PluginCommand;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
import java.nio.file.Paths;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.Collections;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.Future;
|
||||
@ -70,21 +62,21 @@ public class Plan extends JavaPlugin implements PlanPlugin {
|
||||
pluginLogger = abstractionLayer.getPluginLogger();
|
||||
runnableFactory = abstractionLayer.getRunnableFactory();
|
||||
|
||||
getLogger().log(Level.INFO, "Loading dependencies, this might take a while...");
|
||||
try {
|
||||
ApplicationBuilder.appending("Plan")
|
||||
.logger((message, args) -> getLogger().log(Level.INFO, message, args))
|
||||
// Use paper repository for downloading slimjar dependencies
|
||||
.internalRepositories(Collections.singletonList(new Repository(new URL("https://papermc.io/repo/repository/maven-public/"))))
|
||||
.downloadDirectoryPath(Paths.get(getDataFolder().getAbsolutePath()).resolve("libraries"))
|
||||
.build();
|
||||
} catch (IOException | ReflectiveOperationException | URISyntaxException | NoSuchAlgorithmException e) {
|
||||
String version = abstractionLayer.getPluginInformation().getVersion();
|
||||
getLogger().log(Level.SEVERE, e, () -> this.getClass().getSimpleName() + "-v" + version);
|
||||
getLogger().log(Level.SEVERE, "Plan failed to load its dependencies correctly!");
|
||||
getLogger().log(Level.SEVERE, "This error should be reported at https://github.com/plan-player-analytics/Plan/issues");
|
||||
onDisable();
|
||||
}
|
||||
// getLogger().log(Level.INFO, "Loading dependencies, this might take a while...");
|
||||
// try {
|
||||
// ApplicationBuilder.appending("Plan")
|
||||
// .logger((message, args) -> getLogger().log(Level.INFO, message, args))
|
||||
// // Use paper repository for downloading slimjar dependencies
|
||||
// .internalRepositories(Collections.singletonList(new Repository(new URL("https://papermc.io/repo/repository/maven-public/"))))
|
||||
// .downloadDirectoryPath(Paths.get(getDataFolder().getAbsolutePath()).resolve("libraries"))
|
||||
// .build();
|
||||
// } catch (IOException | ReflectiveOperationException | URISyntaxException | NoSuchAlgorithmException e) {
|
||||
// String version = abstractionLayer.getPluginInformation().getVersion();
|
||||
// getLogger().log(Level.SEVERE, e, () -> this.getClass().getSimpleName() + "-v" + version);
|
||||
// getLogger().log(Level.SEVERE, "Plan failed to load its dependencies correctly!");
|
||||
// getLogger().log(Level.SEVERE, "This error should be reported at https://github.com/plan-player-analytics/Plan/issues");
|
||||
// onDisable();
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -23,21 +23,13 @@ import com.djrapitops.plan.exceptions.EnableException;
|
||||
import com.djrapitops.plan.settings.locale.Locale;
|
||||
import com.djrapitops.plan.settings.locale.lang.PluginLang;
|
||||
import com.djrapitops.plan.settings.theme.PlanColorScheme;
|
||||
import io.github.slimjar.app.builder.ApplicationBuilder;
|
||||
import io.github.slimjar.resolver.data.Repository;
|
||||
import net.md_5.bungee.api.plugin.Plugin;
|
||||
import net.playeranalytics.plugin.BungeePlatformLayer;
|
||||
import net.playeranalytics.plugin.PlatformAbstractionLayer;
|
||||
import net.playeranalytics.plugin.scheduling.RunnableFactory;
|
||||
import net.playeranalytics.plugin.server.PluginLogger;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
import java.nio.file.Paths;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.Collections;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
@ -61,21 +53,21 @@ public class PlanBungee extends Plugin implements PlanPlugin {
|
||||
logger = abstractionLayer.getPluginLogger();
|
||||
runnableFactory = abstractionLayer.getRunnableFactory();
|
||||
|
||||
getLogger().log(Level.INFO, "Loading dependencies, this might take a while...");
|
||||
try {
|
||||
ApplicationBuilder.appending("Plan")
|
||||
.logger((message, args) -> getLogger().log(Level.INFO, message, args))
|
||||
// Use paper repository for downloading slimjar dependencies
|
||||
.internalRepositories(Collections.singletonList(new Repository(new URL("https://papermc.io/repo/repository/maven-public/"))))
|
||||
.downloadDirectoryPath(Paths.get(getDataFolder().getAbsolutePath()).resolve("libraries"))
|
||||
.build();
|
||||
} catch (IOException | ReflectiveOperationException | URISyntaxException | NoSuchAlgorithmException e) {
|
||||
String version = abstractionLayer.getPluginInformation().getVersion();
|
||||
getLogger().log(Level.SEVERE, e, () -> this.getClass().getSimpleName() + "-v" + version);
|
||||
getLogger().log(Level.SEVERE, "Plan failed to load its dependencies correctly!");
|
||||
getLogger().log(Level.SEVERE, "This error should be reported at https://github.com/plan-player-analytics/Plan/issues");
|
||||
onDisable();
|
||||
}
|
||||
// getLogger().log(Level.INFO, "Loading dependencies, this might take a while...");
|
||||
// try {
|
||||
// ApplicationBuilder.appending("Plan")
|
||||
// .logger((message, args) -> getLogger().log(Level.INFO, message, args))
|
||||
// // Use paper repository for downloading slimjar dependencies
|
||||
// .internalRepositories(Collections.singletonList(new Repository(new URL("https://papermc.io/repo/repository/maven-public/"))))
|
||||
// .downloadDirectoryPath(Paths.get(getDataFolder().getAbsolutePath()).resolve("libraries"))
|
||||
// .build();
|
||||
// } catch (IOException | ReflectiveOperationException | URISyntaxException | NoSuchAlgorithmException e) {
|
||||
// String version = abstractionLayer.getPluginInformation().getVersion();
|
||||
// getLogger().log(Level.SEVERE, e, () -> this.getClass().getSimpleName() + "-v" + version);
|
||||
// getLogger().log(Level.SEVERE, "Plan failed to load its dependencies correctly!");
|
||||
// getLogger().log(Level.SEVERE, "This error should be reported at https://github.com/plan-player-analytics/Plan/issues");
|
||||
// onDisable();
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -6,14 +6,14 @@ dependencies {
|
||||
implementation "org.apache.commons:commons-text:$commonsTextVersion"
|
||||
implementation "org.apache.commons:commons-compress:$commonsCompressVersion"
|
||||
implementation "com.github.ben-manes.caffeine:caffeine:$caffeineVersion"
|
||||
compileOnly "mysql:mysql-connector-java:$mysqlVersion"
|
||||
compileOnly "org.xerial:sqlite-jdbc:$sqliteVersion"
|
||||
shadow "mysql:mysql-connector-java:$mysqlVersion"
|
||||
shadow "org.xerial:sqlite-jdbc:$sqliteVersion"
|
||||
implementation "com.zaxxer:HikariCP:$hikariVersion"
|
||||
implementation "org.slf4j:slf4j-nop:$slf4jVersion"
|
||||
implementation "org.slf4j:slf4j-api:$slf4jVersion"
|
||||
implementation "com.maxmind.geoip2:geoip2:$geoIpVersion"
|
||||
implementation "com.google.code.gson:gson:$gsonVersion"
|
||||
implementation slimjar("1.2.5")
|
||||
// implementation slimjar("1.2.5")
|
||||
|
||||
testImplementation project(":api")
|
||||
testImplementation "com.google.code.gson:gson:$gsonVersion"
|
||||
|
@ -30,8 +30,8 @@ dependencies {
|
||||
|
||||
testImplementation project(path: ":common", configuration: 'testArtifacts')
|
||||
|
||||
slim "mysql:mysql-connector-java:$mysqlVersion"
|
||||
slim "org.xerial:sqlite-jdbc:$sqliteVersion"
|
||||
shadow "mysql:mysql-connector-java:$mysqlVersion"
|
||||
shadow "org.xerial:sqlite-jdbc:$sqliteVersion"
|
||||
}
|
||||
|
||||
compileJava {
|
||||
@ -52,10 +52,10 @@ processResources {
|
||||
from 'build/sources/resources'
|
||||
}
|
||||
|
||||
slimJar {
|
||||
relocate 'com.mysql', 'plan.com.mysql'
|
||||
relocate 'com.google.protobuf', 'plan.com.mysql.cj.x.google.protobuf'
|
||||
}
|
||||
//slimJar {
|
||||
// relocate 'com.mysql', 'plan.com.mysql'
|
||||
// relocate 'com.google.protobuf', 'plan.com.mysql.cj.x.google.protobuf'
|
||||
//}
|
||||
|
||||
shadowJar {
|
||||
configurations = [project.configurations.shadow]
|
||||
@ -70,6 +70,9 @@ shadowJar {
|
||||
// relocate 'org.sqlite', 'plan.org.sqlite'
|
||||
relocate 'javax.inject', 'plan.javax.inject'
|
||||
relocate 'com.github.benmanes', 'plan.com.github.benmanes'
|
||||
|
||||
relocate 'com.mysql', 'plan.com.mysql'
|
||||
relocate 'com.google.protobuf', 'plan.com.mysql.cj.x.google.protobuf'
|
||||
}
|
||||
|
||||
remapJar {
|
||||
|
@ -16,7 +16,6 @@
|
||||
*/
|
||||
package net.playeranalytics.plan;
|
||||
|
||||
import io.github.slimjar.injector.loader.Injectable;
|
||||
import net.fabricmc.loader.launch.common.FabricLauncher;
|
||||
import net.fabricmc.loader.launch.common.FabricLauncherBase;
|
||||
import net.playeranalytics.plugin.server.FabricPluginLogger;
|
||||
@ -28,10 +27,10 @@ import java.net.URL;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
/**
|
||||
* Custom {@link Injectable} implementation for Fabric.
|
||||
* Custom Injectable implementation for Fabric.
|
||||
* Appends dependencies to the classpath via Fabric's own launcher.
|
||||
*/
|
||||
public class FabricInjectable implements Injectable {
|
||||
public class FabricInjectable /*implements Injectable*/ {
|
||||
|
||||
private final FabricLauncher launcher;
|
||||
private final FabricPluginLogger pluginLogger;
|
||||
@ -41,7 +40,7 @@ public class FabricInjectable implements Injectable {
|
||||
this.launcher = FabricLauncherBase.getLauncher();
|
||||
}
|
||||
|
||||
@Override
|
||||
// @Override
|
||||
public void inject(final URL url) throws IOException, InvocationTargetException, IllegalAccessException, URISyntaxException {
|
||||
pluginLogger.info("Proposed " + Paths.get(url.toURI()).getFileName().toString() + " to classpath");
|
||||
launcher.propose(url);
|
||||
|
@ -25,8 +25,6 @@ import com.djrapitops.plan.gathering.ServerShutdownSave;
|
||||
import com.djrapitops.plan.settings.locale.Locale;
|
||||
import com.djrapitops.plan.settings.locale.lang.PluginLang;
|
||||
import com.djrapitops.plan.settings.theme.PlanColorScheme;
|
||||
import io.github.slimjar.app.builder.ApplicationBuilder;
|
||||
import io.github.slimjar.resolver.data.Repository;
|
||||
import net.fabricmc.api.DedicatedServerModInitializer;
|
||||
import net.fabricmc.fabric.api.command.v1.CommandRegistrationCallback;
|
||||
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents;
|
||||
@ -40,13 +38,7 @@ import net.playeranalytics.plugin.scheduling.RunnableFactory;
|
||||
import net.playeranalytics.plugin.server.FabricPluginLogger;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
import java.nio.file.Paths;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.Collections;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.Future;
|
||||
@ -166,21 +158,21 @@ public class PlanFabric implements PlanPlugin, DedicatedServerModInitializer {
|
||||
pluginLogger = (FabricPluginLogger) abstractionLayer.getPluginLogger();
|
||||
runnableFactory = abstractionLayer.getRunnableFactory();
|
||||
|
||||
pluginLogger.info("Loading dependencies, this might take a while...");
|
||||
try {
|
||||
ApplicationBuilder.injecting("Plan", new FabricInjectable(pluginLogger))
|
||||
.logger((message, args) -> pluginLogger.info(message, args))
|
||||
// Use paper repository for downloading slimjar dependencies
|
||||
.internalRepositories(Collections.singletonList(new Repository(new URL("https://papermc.io/repo/repository/maven-public/"))))
|
||||
.downloadDirectoryPath(Paths.get(getDataFolder().getAbsolutePath()).resolve("libraries"))
|
||||
.build();
|
||||
} catch (IOException | ReflectiveOperationException | URISyntaxException | NoSuchAlgorithmException e) {
|
||||
String version = abstractionLayer.getPluginInformation().getVersion();
|
||||
pluginLogger.error(this.getClass().getSimpleName() + "-v" + version, e);
|
||||
pluginLogger.error("Plan failed to load its dependencies correctly!");
|
||||
pluginLogger.error("This error should be reported at https://github.com/plan-player-analytics/Plan/issues");
|
||||
onDisable();
|
||||
}
|
||||
// pluginLogger.info("Loading dependencies, this might take a while...");
|
||||
// try {
|
||||
// ApplicationBuilder.injecting("Plan", new FabricInjectable(pluginLogger))
|
||||
// .logger((message, args) -> pluginLogger.info(message, args))
|
||||
// // Use paper repository for downloading slimjar dependencies
|
||||
// .internalRepositories(Collections.singletonList(new Repository(new URL("https://papermc.io/repo/repository/maven-public/"))))
|
||||
// .downloadDirectoryPath(Paths.get(getDataFolder().getAbsolutePath()).resolve("libraries"))
|
||||
// .build();
|
||||
// } catch (IOException | ReflectiveOperationException | URISyntaxException | NoSuchAlgorithmException e) {
|
||||
// String version = abstractionLayer.getPluginInformation().getVersion();
|
||||
// pluginLogger.error(this.getClass().getSimpleName() + "-v" + version, e);
|
||||
// pluginLogger.error("Plan failed to load its dependencies correctly!");
|
||||
// pluginLogger.error("This error should be reported at https://github.com/plan-player-analytics/Plan/issues");
|
||||
// onDisable();
|
||||
// }
|
||||
|
||||
ServerLifecycleEvents.SERVER_STARTING.register(server -> {
|
||||
this.server = (MinecraftDedicatedServer) server;
|
||||
|
@ -29,19 +29,15 @@ import com.djrapitops.plan.settings.locale.Locale;
|
||||
import com.djrapitops.plan.settings.locale.lang.PluginLang;
|
||||
import com.djrapitops.plan.settings.theme.PlanColorScheme;
|
||||
import com.djrapitops.plan.utilities.logging.ErrorContext;
|
||||
import io.github.slimjar.app.builder.ApplicationBuilder;
|
||||
import io.github.slimjar.resolver.data.Repository;
|
||||
import net.playeranalytics.plugin.NukkitPlatformLayer;
|
||||
import net.playeranalytics.plugin.PlatformAbstractionLayer;
|
||||
import net.playeranalytics.plugin.scheduling.RunnableFactory;
|
||||
import net.playeranalytics.plugin.server.PluginLogger;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
import java.nio.file.Paths;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
@ -71,21 +67,21 @@ public class PlanNukkit extends PluginBase implements PlanPlugin {
|
||||
logger = abstractionLayer.getPluginLogger();
|
||||
runnableFactory = abstractionLayer.getRunnableFactory();
|
||||
|
||||
getLogger().info( "Loading dependencies, this might take a while...");
|
||||
try {
|
||||
ApplicationBuilder.appending("Plan")
|
||||
.logger((message, args) -> Logger.getGlobal().log(Level.INFO, message, args))
|
||||
// Use paper repository for downloading slimjar dependencies
|
||||
.internalRepositories(Collections.singletonList(new Repository(new URL("https://papermc.io/repo/repository/maven-public/"))))
|
||||
.downloadDirectoryPath(Paths.get(getDataFolder().getAbsolutePath()).resolve("libraries"))
|
||||
.build();
|
||||
} catch (IOException | ReflectiveOperationException | URISyntaxException | NoSuchAlgorithmException e) {
|
||||
String version = abstractionLayer.getPluginInformation().getVersion();
|
||||
Logger.getGlobal().log(Level.SEVERE, e, () -> this.getClass().getSimpleName() + "-v" + version);
|
||||
getLogger().error("Plan failed to load its dependencies correctly!");
|
||||
getLogger().error( "This error should be reported at https://github.com/plan-player-analytics/Plan/issues");
|
||||
onDisable();
|
||||
}
|
||||
// getLogger().info( "Loading dependencies, this might take a while...");
|
||||
// try {
|
||||
// ApplicationBuilder.appending("Plan")
|
||||
// .logger((message, args) -> Logger.getGlobal().log(Level.INFO, message, args))
|
||||
// // Use paper repository for downloading slimjar dependencies
|
||||
// .internalRepositories(Collections.singletonList(new Repository(new URL("https://papermc.io/repo/repository/maven-public/"))))
|
||||
// .downloadDirectoryPath(Paths.get(getDataFolder().getAbsolutePath()).resolve("libraries"))
|
||||
// .build();
|
||||
// } catch (IOException | ReflectiveOperationException | URISyntaxException | NoSuchAlgorithmException e) {
|
||||
// String version = abstractionLayer.getPluginInformation().getVersion();
|
||||
// Logger.getGlobal().log(Level.SEVERE, e, () -> this.getClass().getSimpleName() + "-v" + version);
|
||||
// getLogger().error("Plan failed to load its dependencies correctly!");
|
||||
// getLogger().error( "This error should be reported at https://github.com/plan-player-analytics/Plan/issues");
|
||||
// onDisable();
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -12,14 +12,14 @@ dependencies {
|
||||
testImplementation project(path: ":bungeecord", configuration: 'testArtifacts')
|
||||
testImplementation project(path: ":velocity", configuration: 'testArtifacts')
|
||||
|
||||
slim "mysql:mysql-connector-java:$mysqlVersion"
|
||||
slim "org.xerial:sqlite-jdbc:$sqliteVersion"
|
||||
shadow "mysql:mysql-connector-java:$mysqlVersion"
|
||||
shadow "org.xerial:sqlite-jdbc:$sqliteVersion"
|
||||
}
|
||||
|
||||
slimJar {
|
||||
relocate 'com.mysql', 'plan.com.mysql'
|
||||
relocate 'com.google.protobuf', 'plan.com.mysql.cj.x.google.protobuf'
|
||||
}
|
||||
//slimJar {
|
||||
// relocate 'com.mysql', 'plan.com.mysql'
|
||||
// relocate 'com.google.protobuf', 'plan.com.mysql.cj.x.google.protobuf'
|
||||
//}
|
||||
|
||||
shadowJar {
|
||||
relocate('org.apache', 'plan.org.apache') {
|
||||
@ -30,6 +30,8 @@ shadowJar {
|
||||
// relocate 'org.sqlite', 'plan.org.sqlite'
|
||||
relocate 'javax.inject', 'plan.javax.inject'
|
||||
relocate 'com.github.benmanes', 'plan.com.github.benmanes'
|
||||
relocate 'com.mysql', 'plan.com.mysql'
|
||||
relocate 'com.google.protobuf', 'plan.com.mysql.cj.x.google.protobuf'
|
||||
|
||||
destinationDirectory.set(file("$rootDir/builds/"))
|
||||
archiveBaseName.set('Plan')
|
||||
|
@ -24,8 +24,6 @@ import com.djrapitops.plan.gathering.ServerShutdownSave;
|
||||
import com.djrapitops.plan.settings.locale.Locale;
|
||||
import com.djrapitops.plan.settings.locale.lang.PluginLang;
|
||||
import com.djrapitops.plan.settings.theme.PlanColorScheme;
|
||||
import io.github.slimjar.app.builder.ApplicationBuilder;
|
||||
import io.github.slimjar.resolver.data.Repository;
|
||||
import net.playeranalytics.plugin.PlatformAbstractionLayer;
|
||||
import net.playeranalytics.plugin.SpongePlatformLayer;
|
||||
import net.playeranalytics.plugin.scheduling.RunnableFactory;
|
||||
@ -46,13 +44,7 @@ import org.spongepowered.api.plugin.Plugin;
|
||||
import org.spongepowered.api.scheduler.Task;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
import java.nio.file.Paths;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
@ -124,21 +116,21 @@ public class PlanSponge implements PlanPlugin {
|
||||
logger = abstractionLayer.getPluginLogger();
|
||||
runnableFactory = abstractionLayer.getRunnableFactory();
|
||||
|
||||
logger.info("Loading dependencies, this might take a while...");
|
||||
try {
|
||||
ApplicationBuilder.appending("Plan")
|
||||
.logger((message, args) -> java.util.logging.Logger.getGlobal().log(Level.INFO, message, args))
|
||||
// Use paper repository for downloading slimjar dependencies
|
||||
.internalRepositories(Collections.singletonList(new Repository(new URL("https://papermc.io/repo/repository/maven-public/"))))
|
||||
.downloadDirectoryPath(Paths.get(getDataFolder().getAbsolutePath()).resolve("libraries"))
|
||||
.build();
|
||||
} catch (IOException | ReflectiveOperationException | URISyntaxException | NoSuchAlgorithmException e) {
|
||||
String version = abstractionLayer.getPluginInformation().getVersion();
|
||||
java.util.logging.Logger.getGlobal().log(Level.SEVERE, e, () -> this.getClass().getSimpleName() + "-v" + version);
|
||||
logger.error("Plan failed to load its dependencies correctly!");
|
||||
logger.error("This error should be reported at https://github.com/plan-player-analytics/Plan/issues");
|
||||
onDisable();
|
||||
}
|
||||
// logger.info("Loading dependencies, this might take a while...");
|
||||
// try {
|
||||
// ApplicationBuilder.appending("Plan")
|
||||
// .logger((message, args) -> java.util.logging.Logger.getGlobal().log(Level.INFO, message, args))
|
||||
// // Use paper repository for downloading slimjar dependencies
|
||||
// .internalRepositories(Collections.singletonList(new Repository(new URL("https://papermc.io/repo/repository/maven-public/"))))
|
||||
// .downloadDirectoryPath(Paths.get(getDataFolder().getAbsolutePath()).resolve("libraries"))
|
||||
// .build();
|
||||
// } catch (IOException | ReflectiveOperationException | URISyntaxException | NoSuchAlgorithmException e) {
|
||||
// String version = abstractionLayer.getPluginInformation().getVersion();
|
||||
// java.util.logging.Logger.getGlobal().log(Level.SEVERE, e, () -> this.getClass().getSimpleName() + "-v" + version);
|
||||
// logger.error("Plan failed to load its dependencies correctly!");
|
||||
// logger.error("This error should be reported at https://github.com/plan-player-analytics/Plan/issues");
|
||||
// onDisable();
|
||||
// }
|
||||
}
|
||||
|
||||
public void onEnable() {
|
||||
|
@ -31,8 +31,6 @@ import com.velocitypowered.api.plugin.Dependency;
|
||||
import com.velocitypowered.api.plugin.Plugin;
|
||||
import com.velocitypowered.api.plugin.annotation.DataDirectory;
|
||||
import com.velocitypowered.api.proxy.ProxyServer;
|
||||
import io.github.slimjar.app.builder.ApplicationBuilder;
|
||||
import io.github.slimjar.resolver.data.Repository;
|
||||
import net.playeranalytics.plugin.PlatformAbstractionLayer;
|
||||
import net.playeranalytics.plugin.VelocityPlatformLayer;
|
||||
import net.playeranalytics.plugin.scheduling.RunnableFactory;
|
||||
@ -41,14 +39,8 @@ import org.bstats.velocity.Metrics;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.Collections;
|
||||
import java.util.logging.Level;
|
||||
|
||||
/**
|
||||
@ -99,21 +91,21 @@ public class PlanVelocity implements PlanPlugin {
|
||||
logger = abstractionLayer.getPluginLogger();
|
||||
runnableFactory = abstractionLayer.getRunnableFactory();
|
||||
|
||||
logger.info("Loading dependencies, this might take a while...");
|
||||
try {
|
||||
ApplicationBuilder.injecting("Plan", new VelocityInjectable(this, proxy, logger))
|
||||
.logger((message, args) -> slf4jLogger.info(fixMsgParams(message), args))
|
||||
// Use paper repository for downloading slimjar dependencies
|
||||
.internalRepositories(Collections.singletonList(new Repository(new URL("https://papermc.io/repo/repository/maven-public/"))))
|
||||
.downloadDirectoryPath(Paths.get(getDataFolder().getAbsolutePath()).resolve("libraries"))
|
||||
.build();
|
||||
} catch (IOException | ReflectiveOperationException | URISyntaxException | NoSuchAlgorithmException e) {
|
||||
String version = abstractionLayer.getPluginInformation().getVersion();
|
||||
java.util.logging.Logger.getGlobal().log(Level.SEVERE, e, () -> this.getClass().getSimpleName() + "-v" + version);
|
||||
logger.error("Plan failed to load its dependencies correctly!");
|
||||
logger.error("This error should be reported at https://github.com/plan-player-analytics/Plan/issues");
|
||||
onDisable();
|
||||
}
|
||||
// logger.info("Loading dependencies, this might take a while...");
|
||||
// try {
|
||||
// ApplicationBuilder.injecting("Plan", new VelocityInjectable(this, proxy, logger))
|
||||
// .logger((message, args) -> slf4jLogger.info(fixMsgParams(message), args))
|
||||
// // Use paper repository for downloading slimjar dependencies
|
||||
// .internalRepositories(Collections.singletonList(new Repository(new URL("https://papermc.io/repo/repository/maven-public/"))))
|
||||
// .downloadDirectoryPath(Paths.get(getDataFolder().getAbsolutePath()).resolve("libraries"))
|
||||
// .build();
|
||||
// } catch (IOException | ReflectiveOperationException | URISyntaxException | NoSuchAlgorithmException e) {
|
||||
// String version = abstractionLayer.getPluginInformation().getVersion();
|
||||
// java.util.logging.Logger.getGlobal().log(Level.SEVERE, e, () -> this.getClass().getSimpleName() + "-v" + version);
|
||||
// logger.error("Plan failed to load its dependencies correctly!");
|
||||
// logger.error("This error should be reported at https://github.com/plan-player-analytics/Plan/issues");
|
||||
// onDisable();
|
||||
// }
|
||||
|
||||
onEnable();
|
||||
}
|
||||
|
@ -17,7 +17,6 @@
|
||||
package com.djrapitops.plan;
|
||||
|
||||
import com.velocitypowered.api.proxy.ProxyServer;
|
||||
import io.github.slimjar.injector.loader.Injectable;
|
||||
import net.playeranalytics.plugin.server.PluginLogger;
|
||||
|
||||
import java.io.IOException;
|
||||
@ -27,10 +26,10 @@ import java.net.URL;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
/**
|
||||
* Custom {@link Injectable} implementation for Velocity.
|
||||
* Custom Injectable implementation for Velocity.
|
||||
* Appends dependencies to the classpath via Velocity's internal methods.
|
||||
*/
|
||||
public class VelocityInjectable implements Injectable {
|
||||
public class VelocityInjectable /*implements Injectable*/ {
|
||||
|
||||
private final PlanPlugin plugin;
|
||||
private final ProxyServer proxyServer;
|
||||
@ -42,7 +41,7 @@ public class VelocityInjectable implements Injectable {
|
||||
this.logger = logger;
|
||||
}
|
||||
|
||||
@Override
|
||||
// @Override
|
||||
public void inject(URL url) throws IOException, InvocationTargetException, IllegalAccessException, URISyntaxException {
|
||||
logger.info("Proposed " + Paths.get(url.toURI()).getFileName().toString() + " to classpath");
|
||||
proxyServer.getPluginManager().addToClasspath(plugin, Paths.get(url.toURI()));
|
||||
|
Loading…
Reference in New Issue
Block a user