修复各种问题
This commit is contained in:
parent
2edca32b89
commit
385b2aa974
@ -1,16 +1,13 @@
|
|||||||
package com.ilummc.tlib.util;
|
package com.ilummc.tlib.util;
|
||||||
|
|
||||||
|
import com.ilummc.tlib.TLib;
|
||||||
import com.ilummc.tlib.util.asm.AsmAnalyser;
|
import com.ilummc.tlib.util.asm.AsmAnalyser;
|
||||||
import org.objectweb.asm.ClassReader;
|
import org.objectweb.asm.ClassReader;
|
||||||
import org.objectweb.asm.ClassWriter;
|
import org.objectweb.asm.ClassWriter;
|
||||||
|
|
||||||
import javax.annotation.concurrent.ThreadSafe;
|
import javax.annotation.concurrent.ThreadSafe;
|
||||||
import java.io.IOException;
|
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.util.Collections;
|
import java.util.*;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@ -36,6 +33,11 @@ public class Ref {
|
|||||||
|
|
||||||
public static List<Field> getDeclaredFields(Class<?> clazz, int excludeModifiers, boolean cache) {
|
public static List<Field> getDeclaredFields(Class<?> clazz, int excludeModifiers, boolean cache) {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
// 特殊判断
|
||||||
|
if (clazz == TLib.class)
|
||||||
|
return Arrays.asList(clazz.getDeclaredFields());
|
||||||
|
|
||||||
Class.forName("org.objectweb.asm.ClassVisitor");
|
Class.forName("org.objectweb.asm.ClassVisitor");
|
||||||
List<Field> fields;
|
List<Field> fields;
|
||||||
if ((fields = cachedFields.get(clazz.getName())) != null) return fields;
|
if ((fields = cachedFields.get(clazz.getName())) != null) return fields;
|
||||||
@ -44,6 +46,7 @@ public class Ref {
|
|||||||
classReader.accept(analyser, ClassReader.SKIP_DEBUG);
|
classReader.accept(analyser, ClassReader.SKIP_DEBUG);
|
||||||
fields = analyser.getFields().stream().map(name -> {
|
fields = analyser.getFields().stream().map(name -> {
|
||||||
try {
|
try {
|
||||||
|
System.out.println(name);
|
||||||
return clazz.getDeclaredField(name);
|
return clazz.getDeclaredField(name);
|
||||||
} catch (Throwable ignored) {
|
} catch (Throwable ignored) {
|
||||||
}
|
}
|
||||||
|
@ -19,5 +19,5 @@ commands:
|
|||||||
aliases: [tlm]
|
aliases: [tlm]
|
||||||
|
|
||||||
depend: [Vault]
|
depend: [Vault]
|
||||||
softdepend: [PlaceholderAPI, Skript, TabooCode]
|
softdepend: [PlaceholderAPI, Skript, TabooCode, MassiveLag]
|
||||||
loadbefore: [Skript]
|
loadbefore: [Skript]
|
Loading…
Reference in New Issue
Block a user