修复各种问题

This commit is contained in:
Izzel_Aliz 2018-04-21 14:21:47 +08:00
parent 2edca32b89
commit 385b2aa974
2 changed files with 9 additions and 6 deletions

View File

@ -1,16 +1,13 @@
package com.ilummc.tlib.util;
import com.ilummc.tlib.TLib;
import com.ilummc.tlib.util.asm.AsmAnalyser;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassWriter;
import javax.annotation.concurrent.ThreadSafe;
import java.io.IOException;
import java.lang.reflect.Field;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;
@ -36,6 +33,11 @@ public class Ref {
public static List<Field> getDeclaredFields(Class<?> clazz, int excludeModifiers, boolean cache) {
try {
// 特殊判断
if (clazz == TLib.class)
return Arrays.asList(clazz.getDeclaredFields());
Class.forName("org.objectweb.asm.ClassVisitor");
List<Field> fields;
if ((fields = cachedFields.get(clazz.getName())) != null) return fields;
@ -44,6 +46,7 @@ public class Ref {
classReader.accept(analyser, ClassReader.SKIP_DEBUG);
fields = analyser.getFields().stream().map(name -> {
try {
System.out.println(name);
return clazz.getDeclaredField(name);
} catch (Throwable ignored) {
}

View File

@ -19,5 +19,5 @@ commands:
aliases: [tlm]
depend: [Vault]
softdepend: [PlaceholderAPI, Skript, TabooCode]
softdepend: [PlaceholderAPI, Skript, TabooCode, MassiveLag]
loadbefore: [Skript]