Fix signs

This commit is contained in:
sky
2020-01-17 18:33:47 +08:00
parent 3831158a6b
commit 098970b05d
3 changed files with 11 additions and 10 deletions

View File

@@ -2,6 +2,7 @@ package io.izzel.taboolib.module.lite;
import com.google.common.collect.Maps;
import io.izzel.taboolib.TabooLibAPI;
import io.izzel.taboolib.module.locale.logger.TLogger;
import io.izzel.taboolib.util.Ref;
import java.lang.reflect.Field;
@@ -65,11 +66,11 @@ public class SimpleReflection {
public static void setFieldValue(Class<?> nmsClass, Object instance, String fieldName, Object value) {
Map<String, Field> fields = fieldCached.get(nmsClass.getName());
if (fields == null) {
throw new RuntimeException("Not Found Cache.");
TLogger.getGlobalLogger().error("Field Not Found: " + nmsClass.getName());
}
Field field = fields.get(fieldName);
if (value == null) {
throw new RuntimeException("Not Found Field.");
TLogger.getGlobalLogger().error("Field Not Found: " + nmsClass.getName());
}
try {
field.set(instance, value);
@@ -81,11 +82,11 @@ public class SimpleReflection {
public static Object getFieldValue(Class<?> nmsClass, Object instance, String fieldName) {
Map<String, Field> fields = fieldCached.get(nmsClass.getName());
if (fields == null) {
throw new RuntimeException("Not Found Cache.");
TLogger.getGlobalLogger().error("Field Not Found: " + nmsClass.getName());
}
Field field = fields.get(fieldName);
if (field == null) {
throw new RuntimeException("Not Found Field.");
TLogger.getGlobalLogger().error("Field Not Found: " + nmsClass.getName());
}
try {
return field.get(instance);
@@ -98,11 +99,11 @@ public class SimpleReflection {
public static <T> T getFieldValue(Class<?> nmsClass, Object instance, String fieldName, T def) {
Map<String, Field> fields = fieldCached.get(nmsClass.getName());
if (fields == null) {
throw new RuntimeException("Not Found Cache.");
TLogger.getGlobalLogger().error("Field Not Found: " + nmsClass.getName());
}
Field field = fields.get(fieldName);
if (field == null) {
throw new RuntimeException("Not Found Field.");
TLogger.getGlobalLogger().error("Field Not Found: " + nmsClass.getName());
}
try {
return (T) field.get(instance);