Don't attempt to create a thread pool if there is nothing to do (fix crash)
This commit is contained in:
parent
68e079c115
commit
df80d2a152
75
build.gradle
75
build.gradle
|
@ -15,78 +15,3 @@ dependencies {
|
||||||
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
|
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
|
||||||
modImplementation "com.terraformersmc:modmenu:2.0.0-beta.7"
|
modImplementation "com.terraformersmc:modmenu:2.0.0-beta.7"
|
||||||
}
|
}
|
||||||
|
|
||||||
/*plugins {
|
|
||||||
id 'fabric-loom' version '0.7-SNAPSHOT'
|
|
||||||
id 'maven-publish'
|
|
||||||
id "com.modrinth.minotaur" version "1.1.0"
|
|
||||||
}
|
|
||||||
|
|
||||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
|
||||||
targetCompatibility = JavaVersion.VERSION_1_8
|
|
||||||
|
|
||||||
archivesBaseName = project.archives_base_name
|
|
||||||
version = project.mod_version
|
|
||||||
group = project.maven_group
|
|
||||||
|
|
||||||
repositories {
|
|
||||||
maven { url = "https://maven.terraformersmc.com/"; name = "ModMenu" }
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
minecraft "com.mojang:minecraft:${project.minecraft_version}"
|
|
||||||
mappings "net.fabricmc:yarn:${project.minecraft_version}+${project.yarn_mappings}:v2"
|
|
||||||
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
|
|
||||||
|
|
||||||
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
|
|
||||||
modImplementation "com.terraformersmc:modmenu:1.16.9"
|
|
||||||
}
|
|
||||||
|
|
||||||
processResources {
|
|
||||||
inputs.property "version", project.version
|
|
||||||
|
|
||||||
from(sourceSets.main.resources.srcDirs) {
|
|
||||||
include "fabric.mod.json"
|
|
||||||
expand "version": project.version
|
|
||||||
}
|
|
||||||
|
|
||||||
from(sourceSets.main.resources.srcDirs) {
|
|
||||||
exclude "fabric.mod.json"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ensure that the encoding is set to UTF-8, no matter what the system default is
|
|
||||||
// this fixes some edge cases with special characters not displaying correctly
|
|
||||||
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
|
|
||||||
tasks.withType(JavaCompile) {
|
|
||||||
options.encoding = "UTF-8"
|
|
||||||
}
|
|
||||||
|
|
||||||
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
|
|
||||||
// if it is present.
|
|
||||||
// If you remove this task, sources will not be generated.
|
|
||||||
task sourcesJar(type: Jar, dependsOn: classes) {
|
|
||||||
classifier = "sources"
|
|
||||||
from sourceSets.main.allSource
|
|
||||||
}
|
|
||||||
|
|
||||||
jar {
|
|
||||||
from "LICENSE"
|
|
||||||
}
|
|
||||||
|
|
||||||
import com.modrinth.minotaur.TaskModrinthUpload
|
|
||||||
|
|
||||||
task publishModrinth (type: TaskModrinthUpload){
|
|
||||||
token = System.getenv("MODRINTH_API_TOKEN") // Use an environment property!
|
|
||||||
projectId = 'kVAQyCLX'
|
|
||||||
versionNumber = "${project.mod_version}"
|
|
||||||
uploadFile = remapJar // This is the java jar task
|
|
||||||
addGameVersion("${project.minecraft_version}")
|
|
||||||
addLoader('fabric')
|
|
||||||
versionName = "[${project.minecraft_version}] ${project.mod_version}"
|
|
||||||
afterEvaluate {
|
|
||||||
tasks.publishModrinth.dependsOn(remapJar)
|
|
||||||
tasks.publishModrinth.dependsOn(sourcesJar)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
|
@ -95,13 +95,18 @@ public class Resclone implements ModInitializer, RescloneApi {
|
||||||
public void reload() {
|
public void reload() {
|
||||||
Set<PackMetaLoaded> metas = new LinkedHashSet<>();
|
Set<PackMetaLoaded> metas = new LinkedHashSet<>();
|
||||||
try {
|
try {
|
||||||
ExecutorService pool = Executors.newFixedThreadPool(conf.size());
|
if (conf.isEmpty()) {
|
||||||
for (PackMetaUnloaded s : conf) {
|
LOGGER.info("No resclone pack was specified, add one");
|
||||||
pool.submit(generateTask(s, metas));
|
|
||||||
}
|
}
|
||||||
pool.shutdown();
|
else {
|
||||||
if (!pool.awaitTermination(Long.MAX_VALUE, TimeUnit.MILLISECONDS)) {
|
ExecutorService pool = Executors.newFixedThreadPool(conf.size());
|
||||||
LOGGER.error("Download timed out. This shouldn't be possible");
|
for (PackMetaUnloaded s : conf) {
|
||||||
|
pool.submit(generateTask(s, metas));
|
||||||
|
}
|
||||||
|
pool.shutdown();
|
||||||
|
if (!pool.awaitTermination(Long.MAX_VALUE, TimeUnit.MILLISECONDS)) {
|
||||||
|
LOGGER.error("Download timed out. This shouldn't be possible");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
Loading…
Reference in New Issue