1
0
mirror of https://e.coding.net/circlecloud/YumCore.git synced 2024-11-21 01:38:51 +00:00

fix: 防止注册空命令

Signed-off-by: 502647092 <admin@yumc.pw>
This commit is contained in:
502647092 2016-12-21 18:52:42 +08:00
parent d04e1e47a3
commit 486b77e413

View File

@ -1,5 +1,10 @@
package pw.yumc.YumCore.commands;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.util.Map;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.PluginCommand;
@ -7,14 +12,10 @@ import org.bukkit.command.SimpleCommandMap;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;
import pw.yumc.YumCore.bukkit.Log;
import pw.yumc.YumCore.bukkit.P;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.util.Map;
/**
* 命令工具类
*
@ -98,6 +99,7 @@ public class CommandKit {
}
public static void registerCommand(Plugin plugin, String name, Command cmd) {
if (name.isEmpty()) { return; }
knownCommands.put(name, cmd);
knownCommands.put(plugin.getName().toLowerCase() + ":" + name, cmd);
lookupNames.put(name, plugin);