mondocommand
Class CallInfo

java.lang.Object
  extended by mondocommand.CallInfo

public class CallInfo
extends Object

Represents all the arguments that go along with a call.

Author:
James Crasta

Constructor Summary
CallInfo(org.bukkit.command.CommandSender sender, org.bukkit.entity.Player player, String baseCommand, SubCommand subCommand, List<String> args, FormatConfig formatter)
          Create a new CallInfo representing one command invocation.
 
Method Summary
 String getArg(int index)
          Get a specific argument.
 List<String> getArgs()
          Get the whole list of command arguments.
 String getBaseCommand()
          Get the base command which was called for this sub-command call.
 int getIntArg(int index)
          Get an argument coerced into an int.
 String getJoinedArgsAfter(int index)
          Get all the arguments after the specified index joined into a single string.
 org.bukkit.entity.Player getPlayer()
          Get the player who invoked this.
 org.bukkit.command.CommandSender getSender()
          Get the CommandSender who invoked this.
 SubCommand getSubCommand()
          Get the SubCommand that invoked this call.
 int numArgs()
          How many arguments we got.
 void reply(boolean prefix, String template, Object... args)
          Re
 void reply(String template, Object... args)
          Respond to the call, interpolating colors and variables.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CallInfo

public CallInfo(org.bukkit.command.CommandSender sender,
                org.bukkit.entity.Player player,
                String baseCommand,
                SubCommand subCommand,
                List<String> args,
                FormatConfig formatter)
Create a new CallInfo representing one command invocation.

Parameters:
sender - The CommandSender who invoked this (can be a console)
player - The Player who invoked this (will be null if a console)
baseCommand - The label of the base command being executed (for reference)
subCommand - The SubCommand we're executing.
args - The command arguments.
formatter - The formatter being used by our MondoCommand.
Method Detail

getPlayer

public org.bukkit.entity.Player getPlayer()
Get the player who invoked this. Can be null if running at the console.

Returns:
a Player, or null if this is a console command

getSender

public org.bukkit.command.CommandSender getSender()
Get the CommandSender who invoked this.

Returns:
a CommandSender.

getArg

public String getArg(int index)
Get a specific argument.

Parameters:
index - The argument number.
Returns:
The specific argument requested.

getArgs

public List<String> getArgs()
Get the whole list of command arguments.

Returns:
List of arguments.

getIntArg

public int getIntArg(int index)
Get an argument coerced into an int.

Parameters:
index - the location in the arguments array.
Returns:
The argumnt

getJoinedArgsAfter

public String getJoinedArgsAfter(int index)
Get all the arguments after the specified index joined into a single string. This is useful if one of your last arguments is a free-form text entry (like for a chat message, or editing a sign/book text)

Parameters:
index - The index to start at (inclusive)
Returns:
A single string containing all the arguments till the end

numArgs

public int numArgs()
How many arguments we got.

Returns:
Number of arguments

getBaseCommand

public String getBaseCommand()
Get the base command which was called for this sub-command call.

Returns:
A base command string.

getSubCommand

public SubCommand getSubCommand()
Get the SubCommand that invoked this call.

Returns:
a SubCommand.

reply

public void reply(String template,
                  Object... args)
Respond to the call, interpolating colors and variables.

Parameters:
template - A string template. See ChatMagic documentation for more info.
args - Zero or more arguments to interpolate the template.
See Also:
ChatMagic.colorize(java.lang.String, java.lang.Object...)

reply

public void reply(boolean prefix,
                  String template,
                  Object... args)
Re

Parameters:
prefix - if True, prefix the message with the formater's prefix.
template - A string template. See ChatMagic documentation for more info.
args - Zero or more arguments to interpolate the template.


Copyright © 2013. All Rights Reserved.