mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-16 12:26:12 +00:00
Plugin-specific registration fix
This commit is contained in:
parent
4555a7e3f2
commit
4561641d2b
@ -82,10 +82,19 @@ public abstract class FreedomCommand implements CommandExecutor, TabCompleter
|
|||||||
public void register()
|
public void register()
|
||||||
{
|
{
|
||||||
FCommand cmd = new FCommand(this.name);
|
FCommand cmd = new FCommand(this.name);
|
||||||
if (this.aliases != null) cmd.setAliases(Arrays.asList(StringUtils.split(this.aliases, ",")));
|
if (this.aliases != null)
|
||||||
if (this.description != null) cmd.setDescription(this.description);
|
{
|
||||||
if (this.usage != null) cmd.setUsage(this.usage);
|
cmd.setAliases(Arrays.asList(StringUtils.split(this.aliases, ",")));
|
||||||
getCommandMap().register("", cmd);
|
}
|
||||||
|
if (this.description != null)
|
||||||
|
{
|
||||||
|
cmd.setDescription(this.description);
|
||||||
|
}
|
||||||
|
if (this.usage != null)
|
||||||
|
{
|
||||||
|
cmd.setUsage(this.usage);
|
||||||
|
}
|
||||||
|
getCommandMap().register("totalfreedommod", cmd);
|
||||||
cmd.setExecutor(this);
|
cmd.setExecutor(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -97,7 +106,7 @@ public abstract class FreedomCommand implements CommandExecutor, TabCompleter
|
|||||||
{
|
{
|
||||||
final Field f = Bukkit.getServer().getPluginManager().getClass().getDeclaredField("commandMap");
|
final Field f = Bukkit.getServer().getPluginManager().getClass().getDeclaredField("commandMap");
|
||||||
f.setAccessible(true);
|
f.setAccessible(true);
|
||||||
commandMap = (CommandMap) f.get(Bukkit.getServer().getPluginManager());
|
commandMap = (CommandMap)f.get(Bukkit.getServer().getPluginManager());
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
@ -110,10 +119,12 @@ public abstract class FreedomCommand implements CommandExecutor, TabCompleter
|
|||||||
private final class FCommand extends Command
|
private final class FCommand extends Command
|
||||||
{
|
{
|
||||||
private FreedomCommand cmd = null;
|
private FreedomCommand cmd = null;
|
||||||
|
|
||||||
private FCommand(String command)
|
private FCommand(String command)
|
||||||
{
|
{
|
||||||
super(command);
|
super(command);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setExecutor(FreedomCommand cmd)
|
public void setExecutor(FreedomCommand cmd)
|
||||||
{
|
{
|
||||||
this.cmd = cmd;
|
this.cmd = cmd;
|
||||||
|
Loading…
Reference in New Issue
Block a user