fix wildcard and clean up command executor

This commit is contained in:
Super_
2020-07-01 12:45:09 -04:00
parent 9d7e0cdefc
commit 5421de0c2f
3 changed files with 35 additions and 12 deletions

View File

@ -89,27 +89,22 @@ public abstract class FreedomCommand implements CommandExecutor, TabCompleter
cmd.setExecutor(this);
}
public static final CommandMap getCommandMap()
public static CommandMap getCommandMap()
{
if (commandMap == null)
{
try
{
final Field f = Bukkit.getServer().getClass().getDeclaredField("commandMap");
final Field f = Bukkit.getServer().getPluginManager().getClass().getDeclaredField("commandMap");
f.setAccessible(true);
commandMap = (CommandMap) f.get(Bukkit.getServer());
return getCommandMap();
commandMap = (CommandMap) f.get(Bukkit.getServer().getPluginManager());
}
catch (Exception e)
{
e.printStackTrace();
}
}
else if (commandMap != null)
{
return commandMap;
}
return getCommandMap();
return commandMap;
}
private final class FCommand extends Command