From 385b2aa974cd81cd3839beda79bc98394413e72f Mon Sep 17 00:00:00 2001 From: Izzel_Aliz Date: Sat, 21 Apr 2018 14:21:47 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=90=84=E7=A7=8D=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/ilummc/tlib/util/Ref.java | 13 ++++++++----- src/main/resources/plugin.yml | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/ilummc/tlib/util/Ref.java b/src/main/java/com/ilummc/tlib/util/Ref.java index 218fa55..b9d4f1a 100644 --- a/src/main/java/com/ilummc/tlib/util/Ref.java +++ b/src/main/java/com/ilummc/tlib/util/Ref.java @@ -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 getDeclaredFields(Class clazz, int excludeModifiers, boolean cache) { try { + + // 特殊判断 + if (clazz == TLib.class) + return Arrays.asList(clazz.getDeclaredFields()); + Class.forName("org.objectweb.asm.ClassVisitor"); List 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) { } diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index f9437be..712a7ae 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -19,5 +19,5 @@ commands: aliases: [tlm] depend: [Vault] -softdepend: [PlaceholderAPI, Skript, TabooCode] +softdepend: [PlaceholderAPI, Skript, TabooCode, MassiveLag] loadbefore: [Skript] \ No newline at end of file