C# Class fCraft.IPBanList

Show file Open project: GlennMR/800craft Class Usage Examples

Public Methods

Method Description
Add ( [ ban, bool raiseEvent ) : bool

Adds a new IP Ban.

BanAll ( [ targetAddress, [ player, [ reason, bool announce, bool raiseEvents ) : void

Bans given IP address and all accounts on that IP. All players from IP are kicked. Throws PlayerOpException on problems.

BanIP ( [ targetAddress, [ player, [ reason, bool announce, bool raiseEvents ) : void

Bans given IP address. All players from IP are kicked. If an associated PlayerInfo is known, use a different overload of this method instead. Throws PlayerOpException on problems.

Contains ( [ address ) : bool

Checks whether the given address is banned.

Remove ( [ address, bool raiseEvents ) : bool

Removes a given IP address from the ban list (if present).

UnbanAll ( [ targetAddress, [ player, [ reason, bool announce, bool raiseEvents ) : void

Unbans given IP address and all accounts on that IP. Throws PlayerOpException on problems.

UnbanIP ( [ targetAddress, [ player, [ reason, bool announce, bool raiseEvents ) : void

Unbans an IP address. If an associated PlayerInfo is known, use a different overload of this method instead. Throws PlayerOpException on problems.

Private Methods

Method Description
Get ( [ address ) : IPBanInfo
Load ( ) : void
ParseHeader ( [ header ) : int
RaiseAddedIPBanEvent ( [ info ) : void
RaiseAddingIPBanEvent ( [ info ) : bool
RaiseRemovedIPBanEvent ( [ info ) : void
RaiseRemovingIPBanEvent ( [ info ) : bool
Save ( ) : void

Method Details

Add() public static method

Adds a new IP Ban.
public static Add ( [ ban, bool raiseEvent ) : bool
ban [ Ban information
raiseEvent bool Whether AddingIPBan and AddedIPBan events should be raised.
return bool

BanAll() public static method

Bans given IP address and all accounts on that IP. All players from IP are kicked. Throws PlayerOpException on problems.
public static BanAll ( [ targetAddress, [ player, [ reason, bool announce, bool raiseEvents ) : void
targetAddress [ IP address that is being banned.
player [ Player who is banning.
reason [ Reason for ban. May be empty, if permitted by server configuration.
announce bool Whether ban should be publicly announced on the server.
raiseEvents bool Whether AddingIPBan, AddedIPBan, BanChanging, and BanChanged events should be raised.
return void

BanIP() public static method

Bans given IP address. All players from IP are kicked. If an associated PlayerInfo is known, use a different overload of this method instead. Throws PlayerOpException on problems.
public static BanIP ( [ targetAddress, [ player, [ reason, bool announce, bool raiseEvents ) : void
targetAddress [ IP address that is being banned.
player [ Player who is banning.
reason [ Reason for ban. May be empty, if permitted by server configuration.
announce bool Whether ban should be publicly announced on the server.
raiseEvents bool Whether AddingIPBan and AddedIPBan events should be raised.
return void

Contains() public static method

Checks whether the given address is banned.
public static Contains ( [ address ) : bool
address [ Address to look for.
return bool

Remove() public static method

Removes a given IP address from the ban list (if present).
public static Remove ( [ address, bool raiseEvents ) : bool
address [ Address to unban.
raiseEvents bool Whether to raise RemovingIPBan and RemovedIPBan events.
return bool

UnbanAll() public static method

Unbans given IP address and all accounts on that IP. Throws PlayerOpException on problems.
public static UnbanAll ( [ targetAddress, [ player, [ reason, bool announce, bool raiseEvents ) : void
targetAddress [ IP address that is being unbanned.
player [ Player who is unbanning.
reason [ Reason for unban. May be null or empty, if permitted by server configuration.
announce bool Whether unban should be publicly announced on the server.
raiseEvents bool Whether RemovingIPBan, RemovedIPBan, BanChanging, and BanChanged events should be raised.
return void

UnbanIP() public static method

Unbans an IP address. If an associated PlayerInfo is known, use a different overload of this method instead. Throws PlayerOpException on problems.
public static UnbanIP ( [ targetAddress, [ player, [ reason, bool announce, bool raiseEvents ) : void
targetAddress [ IP address that is being unbanned.
player [ Player who is unbanning.
reason [ Reason for unban. May be empty, if permitted by server configuration.
announce bool Whether unban should be publicly announced on the server.
raiseEvents bool Whether RemovingIPBan and RemovedIPBan events should be raised.
return void