+ fixed typo
This commit is contained in:
parent
9e3862b5f2
commit
cbd893e62e
@ -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<String, Command> 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<String, Command>) SimpleReflection.getFieldValue(SimpleCommandMap.class, commandMap, "knownCommands");
|
||||
try {
|
||||
|
@ -14,15 +14,15 @@ public class SimpleReflection {
|
||||
|
||||
private static Map<String, Map<String, Field>> 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);
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user