9
0
mirror of https://github.com/Xiao-MoMi/Custom-Crops.git synced 2025-12-24 17:39:26 +00:00

Added some logs

This commit is contained in:
XiaoMoMi
2024-05-07 22:26:06 +08:00
parent e390976cb7
commit b2949ce99f
3 changed files with 14 additions and 10 deletions

View File

@@ -198,7 +198,6 @@ public enum Dependency {
String extra = classifier == null || classifier.isEmpty()
? ""
: "-" + classifier;
return name + "-" + this.version + extra + ".jar";
}

View File

@@ -27,6 +27,7 @@ package net.momirealms.customcrops.libraries.dependencies;
import com.google.common.collect.ImmutableSet;
import net.momirealms.customcrops.CustomCropsPluginImpl;
import net.momirealms.customcrops.api.util.LogUtils;
import net.momirealms.customcrops.libraries.classpath.ClassPathAppender;
import net.momirealms.customcrops.libraries.dependencies.classloader.IsolatedClassLoader;
import net.momirealms.customcrops.libraries.dependencies.relocation.Relocation;
@@ -64,13 +65,7 @@ public class DependencyManagerImpl implements DependencyManager {
this.registry = new DependencyRegistry();
this.cacheDirectory = setupCacheDirectory(plugin);
this.classPathAppender = classPathAppender;
}
private synchronized RelocationHandler getRelocationHandler() {
if (this.relocationHandler == null) {
this.relocationHandler = new RelocationHandler(this);
}
return this.relocationHandler;
this.relocationHandler = new RelocationHandler(this);
}
@Override
@@ -155,7 +150,7 @@ public class DependencyManagerImpl implements DependencyManager {
}
DependencyDownloadException lastError = null;
String fileName = dependency.getFileName(null);
String forceRepo = dependency.getRepo();
if (forceRepo == null) {
// attempt to download the dependency from each repo in order.
@@ -164,7 +159,9 @@ public class DependencyManagerImpl implements DependencyManager {
continue;
}
try {
LogUtils.info("Downloading dependency(" + fileName + ") from " + repo.getUrl() + dependency.getMavenRepoPath());
repo.download(dependency, file);
LogUtils.info("Successfully downloaded " + fileName);
return file;
} catch (DependencyDownloadException e) {
lastError = e;
@@ -174,7 +171,9 @@ public class DependencyManagerImpl implements DependencyManager {
DependencyRepository repository = DependencyRepository.getByID(forceRepo);
if (repository != null) {
try {
LogUtils.info("Downloading dependency(" + fileName + ") from " + repository.getUrl() + dependency.getMavenRepoPath());
repository.download(dependency, file);
LogUtils.info("Successfully downloaded " + fileName);
return file;
} catch (DependencyDownloadException e) {
lastError = e;
@@ -197,7 +196,9 @@ public class DependencyManagerImpl implements DependencyManager {
return remappedFile;
}
getRelocationHandler().remap(normalFile, remappedFile, rules);
LogUtils.info("Remapping " + dependency.getFileName(null));
relocationHandler.remap(normalFile, remappedFile, rules);
LogUtils.info("Successfully remapped " + dependency.getFileName(null));
return remappedFile;
}

View File

@@ -73,6 +73,10 @@ public enum DependencyRepository {
this.id = id;
}
public String getUrl() {
return url;
}
public static DependencyRepository getByID(String id) {
for (DependencyRepository repository : values()) {
if (id.equals(repository.id)) {