Skip to content

Commit

Permalink
Phantom command add subs
Browse files Browse the repository at this point in the history
  • Loading branch information
cyberpwnn committed Jan 5, 2018
1 parent f75a244 commit 7e4fe01
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion src/main/java/org/phantomapi/command/CommandPhantom.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@
import org.bukkit.command.CommandSender;

import phantom.command.Command;
import phantom.command.ICommand;
import phantom.command.PhantomCommand;
import phantom.pawn.Name;
import phantom.pawn.Singular;
import phantom.pawn.Start;
import phantom.pawn.Stop;
import phantom.text.C;
import phantom.text.TXT;

Expand All @@ -22,10 +25,34 @@ public CommandPhantom()
addAlias("pha");
}

@Start
public void onStart()
{
activateSubCommand(new CommandTest());
activateSubCommand(new CommandStatus());
}

@Stop
public void onStop()
{
deactivateSubCommands();
}

@Override
public boolean onCommand(CommandSender sender, String[] a)
{
msg(sender, "Oi");
if(a.length == 0)
{
for(ICommand i : getSubCommandsByPriority())
{
msg(sender, C.LIGHT_PURPLE + "/pha " + C.WHITE + i.getCommandName() + C.GRAY + " " + i.getParameterUsage());
}
}

else if(!fireSubCommand(sender, a))
{
msg(sender, "Unknown sub command: " + C.WHITE + a[0]);
}

return true;
}
Expand Down

0 comments on commit 7e4fe01

Please sign in to comment.