C# Class fCraft.CommandReader

A text scanner that aids parsing chat commands and their arguments. Breaks up a message into tokens at spaces. Treats quoted strings as whole tokens.
Inheritance: ICloneable
Exibir arquivo Open project: fragmer/fCraft Class Usage Examples

Public Properties

Property Type Description
IsConfirmed bool

Private Properties

Property Type Description
Next string
NextAll string
NextBlock bool
NextInt bool
ToString string

Public Methods

Method Description
Clone ( ) : object

Creates a copy of this command. Use the copy constructor instead of this, if possible.

CommandReader ( [ other ) : System

Creates a copy of an existing command.

NextBlockWithParam ( [ player, bool allowNoneBlock, Block &block, int &param ) : bool

Parses next parameter as a Minecraft block name. Allows an optional integer parameter to follow the block name after a slash, e.g. "BlockName/#" Messages warnings directly to the player in case of problems.

NextOnOff ( bool &param ) : bool

Reads a token and gets an "on" (1) or "off" (0) input from command.

Rewind ( ) : void

Resets the argument offset. After calling Rewind, arguments can be read from the beginning again.

Private Methods

Method Description
Next ( ) : string
NextAll ( ) : string
NextBlock ( [ player, bool allowNoneBlock, Block &block ) : bool
NextInt ( int &number ) : bool
ToString ( ) : string

Method Details

Clone() public method

Creates a copy of this command. Use the copy constructor instead of this, if possible.
public Clone ( ) : object
return object

CommandReader() public method

Creates a copy of an existing command.
public CommandReader ( [ other ) : System
other [
return System

NextBlockWithParam() public method

Parses next parameter as a Minecraft block name. Allows an optional integer parameter to follow the block name after a slash, e.g. "BlockName/#" Messages warnings directly to the player in case of problems.
public NextBlockWithParam ( [ player, bool allowNoneBlock, Block &block, int &param ) : bool
player [ Player to send warnings to (if any come up).
allowNoneBlock bool Whether "none"/"skip" blocktype is allowed.
block Block On success, this is set to the given block type. /// On failure, this is set to Block.None
param int Optional integer parameter. Set to 1 if not given.
return bool

NextOnOff() public method

Reads a token and gets an "on" (1) or "off" (0) input from command.
public NextOnOff ( bool &param ) : bool
param bool if user gave "on" or "1", this is set to true. /// Otherwise (if "off" or "0" is given, if nothing was given, /// or if an unrecognized string was given) this is set to false.
return bool

Rewind() public method

Resets the argument offset. After calling Rewind, arguments can be read from the beginning again.
public Rewind ( ) : void
return void

Property Details

IsConfirmed public_oe property

public bool IsConfirmed
return bool