From cbd893e62e9ca408d852155be9d1a72a3f3a19e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=9D=8F=E9=BB=91?= Date: Sat, 10 Nov 2018 13:32:57 +0800 Subject: [PATCH] + fixed typo --- .../skymc/taboolib/commands/internal/TCommandHandler.java | 7 ++----- .../me/skymc/taboolib/common/util/SimpleReflection.java | 6 +++--- .../taboolib/json/tellraw/internal/InternalTellraw.java | 4 ++-- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/main/java/me/skymc/taboolib/commands/internal/TCommandHandler.java b/src/main/java/me/skymc/taboolib/commands/internal/TCommandHandler.java index d6e80e9..d134113 100644 --- a/src/main/java/me/skymc/taboolib/commands/internal/TCommandHandler.java +++ b/src/main/java/me/skymc/taboolib/commands/internal/TCommandHandler.java @@ -3,7 +3,6 @@ package me.skymc.taboolib.commands.internal; import com.ilummc.tlib.inject.TPluginManager; import com.ilummc.tlib.resources.TLocale; import me.skymc.taboolib.TabooLib; -import me.skymc.taboolib.commands.builder.SimpleCommandBuilder; import me.skymc.taboolib.common.util.SimpleReflection; import me.skymc.taboolib.fileutils.FileUtils; import me.skymc.taboolib.listener.TListener; @@ -18,9 +17,7 @@ import org.bukkit.plugin.Plugin; import org.bukkit.plugin.SimplePluginManager; import java.lang.reflect.Constructor; -import java.lang.reflect.Field; import java.util.ArrayList; -import java.util.Collection; import java.util.List; import java.util.Map; import java.util.stream.Collectors; @@ -36,8 +33,8 @@ public class TCommandHandler implements Listener { private static Map knownCommands; public TCommandHandler() { - SimpleReflection.saveFiled(Bukkit.getPluginManager() instanceof TPluginManager ? TPluginManager.class : SimplePluginManager.class, "commandMap"); - SimpleReflection.saveFiled(SimpleCommandMap.class, "knownCommands"); + SimpleReflection.saveField(Bukkit.getPluginManager() instanceof TPluginManager ? TPluginManager.class : SimplePluginManager.class, "commandMap"); + SimpleReflection.saveField(SimpleCommandMap.class, "knownCommands"); commandMap = (SimpleCommandMap) SimpleReflection.getFieldValue(Bukkit.getPluginManager() instanceof TPluginManager ? TPluginManager.class : SimplePluginManager.class, Bukkit.getPluginManager(), "commandMap"); knownCommands = (Map) SimpleReflection.getFieldValue(SimpleCommandMap.class, commandMap, "knownCommands"); try { diff --git a/src/main/java/me/skymc/taboolib/common/util/SimpleReflection.java b/src/main/java/me/skymc/taboolib/common/util/SimpleReflection.java index 5fcba1d..54cd0d7 100644 --- a/src/main/java/me/skymc/taboolib/common/util/SimpleReflection.java +++ b/src/main/java/me/skymc/taboolib/common/util/SimpleReflection.java @@ -14,15 +14,15 @@ public class SimpleReflection { private static Map> fieldCached = Maps.newHashMap(); - public static void saveFiled(Class nmsClass) { + public static void saveField(Class nmsClass) { try { - Arrays.stream(nmsClass.getDeclaredFields()).forEach(declaredField -> saveFiled(nmsClass, declaredField.getName())); + Arrays.stream(nmsClass.getDeclaredFields()).forEach(declaredField -> saveField(nmsClass, declaredField.getName())); } catch (Exception e) { e.printStackTrace(); } } - public static void saveFiled(Class nmsClass, String fieldName) { + public static void saveField(Class nmsClass, String fieldName) { try { Field declaredField = nmsClass.getDeclaredField(fieldName); declaredField.setAccessible(true); diff --git a/src/main/java/me/skymc/taboolib/json/tellraw/internal/InternalTellraw.java b/src/main/java/me/skymc/taboolib/json/tellraw/internal/InternalTellraw.java index 52f6240..0592f45 100644 --- a/src/main/java/me/skymc/taboolib/json/tellraw/internal/InternalTellraw.java +++ b/src/main/java/me/skymc/taboolib/json/tellraw/internal/InternalTellraw.java @@ -24,8 +24,8 @@ public class InternalTellraw implements AbstractTellraw { private int bukkitVersion = TabooLib.getVersionNumber(); public InternalTellraw() { - SimpleReflection.saveFiled(NBTTagCompound.class, "map"); - SimpleReflection.saveFiled(NBTTagList.class, "list"); + SimpleReflection.saveField(NBTTagCompound.class, "map"); + SimpleReflection.saveField(NBTTagList.class, "list"); } @Override