C# Class TShockAPI.DB.RegionManager

Datei anzeigen Open project: NyxStudios/TShock

Public Properties

Property Type Description
Regions List

Public Methods

Method Description
AddNewUser ( string regionName, string userName ) : bool

Adds a user to a region's allowed user list

AddRegion ( int tx, int ty, int width, int height, string regionname, string owner, string worldid, int z ) : bool

Adds a region to the database.

AllowGroup ( string regionName, string groupName ) : bool

Allows a group to use a region

CanBuild ( int x, int y, TSPlayer ply ) : bool

Checks if a given player can build in a region at the given (x, y) coordinate

ChangeOwner ( string regionName, string newOwner ) : bool

Changes the owner of the region with the given name

DeleteRegion ( int id ) : bool

Delets the region from this world with a given ID.

DeleteRegion ( string name ) : bool

Deletes the region from this world with a given name.

GetRegionByID ( int id ) : Region

Returns a region with the given ID

GetRegionByName ( String name ) : Region

Returns a region with the given name

GetTopRegion ( IEnumerable regions ) : Region

Returns the Region with the highest Z index of the given list

InArea ( int x, int y ) : bool

Checks if any regions exist at the given (x, y) coordinate

InAreaRegion ( int x, int y ) : IEnumerable

Checks if any regions exist at the given (x, y) coordinate and returns an IEnumerable containing their Region objects

InAreaRegionID ( int x, int y ) : IEnumerable

Checks if any regions exist at the given (x, y) coordinate and returns an IEnumerable containing their IDs

InAreaRegionName ( int x, int y ) : IEnumerable

Checks if any regions exist at the given (x, y) coordinate and returns an IEnumerable containing their names

ListAllRegions ( string worldid ) : List

Gets all the regions names from world

PositionRegion ( string regionName, int x, int y, int width, int height ) : bool

Sets the position of a region.

Reload ( ) : void

Reloads all regions.

RemoveGroup ( string regionName, string group ) : bool

Removes a group's access to a region

RemoveUser ( string regionName, string userName ) : bool

Removes an allowed user from a region

ResizeRegion ( string regionName, int addAmount, int direction ) : bool

Changes the size of a given region

SetRegionState ( int id, bool state ) : bool

Sets the protected state of the region with a given ID.

SetRegionState ( string name, bool state ) : bool

Sets the protected state of the region with a given name.

SetZ ( string name, int z ) : bool

Sets the Z index of a given region

Private Methods

Method Description
ListIDs ( string MergedIDs ) : List
RegionManager ( IDbConnection db ) : System

Method Details

AddNewUser() public method

Adds a user to a region's allowed user list
public AddNewUser ( string regionName, string userName ) : bool
regionName string Name of the region to modify
userName string Username to add
return bool

AddRegion() public method

Adds a region to the database.
public AddRegion ( int tx, int ty, int width, int height, string regionname, string owner, string worldid, int z ) : bool
tx int TileX of the top left corner.
ty int TileY of the top left corner.
width int Width of the region in tiles.
height int Height of the region in tiles.
regionname string The name of the region.
owner string The User Account Name of the person who created this region.
worldid string The world id that this region is in.
z int The Z index of the region.
return bool

AllowGroup() public method

Allows a group to use a region
public AllowGroup ( string regionName, string groupName ) : bool
regionName string Region name
groupName string Group's name
return bool

CanBuild() public method

Checks if a given player can build in a region at the given (x, y) coordinate
public CanBuild ( int x, int y, TSPlayer ply ) : bool
x int X coordinate
y int Y coordinate
ply TSPlayer Player to check permissions with
return bool

ChangeOwner() public method

Changes the owner of the region with the given name
public ChangeOwner ( string regionName, string newOwner ) : bool
regionName string Region name
newOwner string New owner's username
return bool

DeleteRegion() public method

Delets the region from this world with a given ID.
public DeleteRegion ( int id ) : bool
id int The ID of the region to delete.
return bool

DeleteRegion() public method

Deletes the region from this world with a given name.
public DeleteRegion ( string name ) : bool
name string The name of the region to delete.
return bool

GetRegionByID() public method

Returns a region with the given ID
public GetRegionByID ( int id ) : Region
id int Region ID
return Region

GetRegionByName() public method

Returns a region with the given name
public GetRegionByName ( String name ) : Region
name String Region name
return Region

GetTopRegion() public method

Returns the Region with the highest Z index of the given list
public GetTopRegion ( IEnumerable regions ) : Region
regions IEnumerable List of Regions to compare
return Region

InArea() public method

Checks if any regions exist at the given (x, y) coordinate
public InArea ( int x, int y ) : bool
x int X coordinate
y int Y coordinate
return bool

InAreaRegion() public method

Checks if any regions exist at the given (x, y) coordinate and returns an IEnumerable containing their Region objects
public InAreaRegion ( int x, int y ) : IEnumerable
x int X coordinate
y int Y coordinate
return IEnumerable

InAreaRegionID() public method

Checks if any regions exist at the given (x, y) coordinate and returns an IEnumerable containing their IDs
public InAreaRegionID ( int x, int y ) : IEnumerable
x int X coordinate
y int Y coordinate
return IEnumerable

InAreaRegionName() public method

Checks if any regions exist at the given (x, y) coordinate and returns an IEnumerable containing their names
public InAreaRegionName ( int x, int y ) : IEnumerable
x int X coordinate
y int Y coordinate
return IEnumerable

ListAllRegions() public method

Gets all the regions names from world
public ListAllRegions ( string worldid ) : List
worldid string World name to get regions from
return List

PositionRegion() public method

Sets the position of a region.
public PositionRegion ( string regionName, int x, int y, int width, int height ) : bool
regionName string The region name.
x int The X position.
y int The Y position.
width int The width.
height int The height.
return bool

Reload() public method

Reloads all regions.
public Reload ( ) : void
return void

RemoveGroup() public method

Removes a group's access to a region
public RemoveGroup ( string regionName, string group ) : bool
regionName string Region name
group string Group name
return bool

RemoveUser() public method

Removes an allowed user from a region
public RemoveUser ( string regionName, string userName ) : bool
regionName string Name of the region to modify
userName string Username to remove
return bool

ResizeRegion() public method

Changes the size of a given region
public ResizeRegion ( string regionName, int addAmount, int direction ) : bool
regionName string Name of the region to resize
addAmount int Amount to resize
direction int Direction to resize in: /// 0 = resize height and Y. /// 1 = resize width. /// 2 = resize height. /// 3 = resize width and X.
return bool

SetRegionState() public method

Sets the protected state of the region with a given ID.
public SetRegionState ( int id, bool state ) : bool
id int The ID of the region to change.
state bool New protected state of the region.
return bool

SetRegionState() public method

Sets the protected state of the region with a given name.
public SetRegionState ( string name, bool state ) : bool
name string The name of the region to change.
state bool New protected state of the region.
return bool

SetZ() public method

Sets the Z index of a given region
public SetZ ( string name, int z ) : bool
name string Region name
z int New Z index
return bool

Property Details

Regions public_oe property

The list of regions.
public List Regions
return List