mirror of
https://github.com/CPTProgrammer/ChatPlus.git
synced 2025-07-02 07:44:06 +08:00
Compare commits
No commits in common. "dev" and "v1.0.0" have entirely different histories.
2
.gitattributes
vendored
2
.gitattributes
vendored
@ -4,7 +4,7 @@
|
||||
# Linux start script should use lf
|
||||
/gradlew text eol=lf
|
||||
|
||||
* text=auto eol=lf
|
||||
* test=auto eol=lf
|
||||
|
||||
# These are Windows script files and should use crlf
|
||||
*.bat text eol=crlf
|
@ -42,7 +42,7 @@ _* Other mods may work without explicit support. Report compatibility requests v
|
||||
| 1.19.3 | 1.19.3 - 1.19.4 |
|
||||
| 1.20 | 1.20 - 1.20.2 |
|
||||
| 1.20.3 | 1.20.3 - 1.20.6 |
|
||||
| 1.21 | 1.21 - 1.21.6 |
|
||||
| 1.21 | 1.21 - 1.21.5 |
|
||||
|
||||
|
||||
|
||||
|
@ -119,8 +119,6 @@ tasks.register("buildAll") {
|
||||
|
||||
logger.lifecycle("Using Java ${javaToolchain.metadata.javaRuntimeVersion} (path=\"${projectJavaHome}\")")
|
||||
|
||||
def failedVersions = new ArrayList<String>()
|
||||
|
||||
project.minecraftVersions.each { version ->
|
||||
logger.lifecycle("================ Building for Minecraft ${version} ================")
|
||||
// TODO: Refactor this (is there a better approach?)
|
||||
@ -133,14 +131,11 @@ tasks.register("buildAll") {
|
||||
def result = execOutput.result.get()
|
||||
def output = execOutput.standardOutput.asText.get()
|
||||
def error = execOutput.standardError.asText.get()
|
||||
logger.lifecycle("[Minecraft ${version}] BUILD ${result.exitValue == 0 ? "SUCCESSFUL" : "FAILED"}. Process exited with code: ${result.exitValue}")
|
||||
logger.lifecycle("[Minecraft ${version}] BUILD ${result.exitValue == 0 ? "SUCCESS" : "FAILED"}. Process exited with code: ${result.exitValue}")
|
||||
if (result.exitValue != 0) {
|
||||
failedVersions.addLast(version as String)
|
||||
logger.lifecycle("[Minecraft ${version}] Error: ${error}")
|
||||
}
|
||||
}
|
||||
|
||||
if (!failedVersions.isEmpty()) throw new GradleException("Build failed for Minecraft versions: ${failedVersions.join(", ")}")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@ org.gradle.parallel=true
|
||||
version_properties_path=./properties
|
||||
|
||||
# Mod Properties
|
||||
mod_version=1.0.1
|
||||
mod_version=1.0.0
|
||||
maven_group=cn.revaria.chatplus
|
||||
archives_base_name=chat-plus
|
||||
|
||||
|
@ -2,14 +2,11 @@ package cn.revaria.chatplus.plugin;
|
||||
|
||||
import cn.revaria.chatplus.plugin.annotation.DisableIfModsLoaded;
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
import org.objectweb.asm.tree.AnnotationNode;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin;
|
||||
import org.spongepowered.asm.mixin.extensibility.IMixinInfo;
|
||||
import org.spongepowered.asm.service.MixinService;
|
||||
import org.spongepowered.asm.util.Annotations;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@ -26,17 +23,14 @@ public class MixinConfigPlugin implements IMixinConfigPlugin {
|
||||
@Override
|
||||
public boolean shouldApplyMixin(String targetClassName, String mixinClassName) {
|
||||
try {
|
||||
ClassNode classNode = MixinService.getService().getBytecodeProvider().getClassNode(mixinClassName);
|
||||
AnnotationNode annotationNode = Annotations.getVisible(classNode, DisableIfModsLoaded.class);
|
||||
|
||||
if (annotationNode == null) {
|
||||
return true;
|
||||
Class<?> mixinClass = Class.forName(mixinClassName);
|
||||
DisableIfModsLoaded annotation = mixinClass.getAnnotation(DisableIfModsLoaded.class);
|
||||
if (annotation != null) {
|
||||
return Arrays.stream(annotation.value()).noneMatch(modId -> FabricLoader.getInstance().isModLoaded(modId));
|
||||
}
|
||||
|
||||
List<String> modIds = Annotations.getValue(annotationNode);
|
||||
return modIds.stream().noneMatch(modId -> FabricLoader.getInstance().isModLoaded(modId));
|
||||
} catch (IOException | ClassNotFoundException e) {
|
||||
return false;
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user