C# Class TShockAPI.TShock

Inheritance: TerrariaPlugin
Show file Open project: NyxStudios/TShock Class Usage Examples

Public Properties

Property Type Description
AuthToken int
Backups BackupManager
Bans BanManager
CharacterDB TShockAPI.DB.CharacterManager
DB IDbConnection
Geo MaxMind.GeoIPCountry
Groups TShockAPI.DB.GroupManager
Itembans ItemManager
Log ILog
OverridePort bool
Players TShockAPI.TSPlayer[]
ProjectileBans ProjectileManagager
RESTStartupTokens SecureRest.TokenData>.Dictionary
Regions RegionManager
RememberedPos TShockAPI.DB.RememberedPosManager
RestApi Rests.SecureRest
RestManager RestManager
SavePath string
ServerSideCharacterConfig ServerSideConfig
ShuttingDown bool
StatTracker StatTracker
TileBans TileManager
UpdateManager TShockAPI.UpdateManager
Users TShockAPI.DB.UserManager
Utils Utils
VersionCodename string
VersionNum System.Version
Warps TShockAPI.DB.WarpManager
instance TerrariaPlugin

Public Methods

Method Description
CheckIgnores ( TShockAPI.TSPlayer player ) : bool

CheckIgnores - Checks a players ignores...?

CheckProjectilePermission ( TShockAPI.TSPlayer player, int index, int type ) : bool

CheckProjectilePermission - Checks if a projectile is banned.

CheckRangePermission ( TShockAPI.TSPlayer player, int x, int y, int range = 32 ) : bool

CheckRangePermission - Checks if a player has permission to modify a tile dependent on range checks.

CheckSpawn ( int x, int y ) : bool

CheckSpawn - Checks to see if a location is inside the spawn protection zone.

CheckTilePermission ( TShockAPI.TSPlayer player, int tileX, int tileY, bool paint = false ) : bool

CheckTilePermission - Checks to see if a player has the ability to modify a tile at a given position.

CheckTilePermission ( TShockAPI.TSPlayer player, int tileX, int tileY, short tileType, GetDataHandlers actionType ) : bool

CheckTilePermission - Checks to see if a player has permission to modify a tile in general.

Distance ( Vector2 value1, Vector2 value2 ) : float

Distance - Determines the distance between two vectors.

HackedInventory ( TShockAPI.TSPlayer player ) : bool

HackedInventory - Checks to see if a user has a hacked inventory. In addition, messages players the result.

HandleCommandLinePostConfigLoad ( string parms ) : void

HandleCommandLinePostConfigLoad - Handles additional command line options after the config file is read.

OnConfigRead ( ConfigFile file ) : void

OnConfigRead - Fired when the config file has been read.

StartInvasion ( int type ) : void

StartInvasion - Starts an invasion on the server.

TShock ( Terraria.Main game ) : System

TShock - The constructor for the TShock plugin.

Protected Methods

Method Description
CrashReporter_HeapshotRequesting ( object sender, EventArgs e ) : void
Dispose ( bool disposing ) : void

Dispose - Called when disposing.

Private Methods

Method Description
ComputeMaxStyles ( ) : void

ComputeMaxStyles - Computes the max styles...

CurrentDomain_UnhandledException ( object sender, UnhandledExceptionEventArgs e ) : void

Handles exceptions that we didn't catch earlier in the code, or in Terraria.

FixChestStacks ( ) : void

FixChestStacks - Verifies that each stack in each chest is valid and not over the max stack count.

HandleCommandLine ( string parms ) : void

HandleCommandLine - Handles the command line parameters passed to the server.

Initialize ( ) : void
NetHooks_NameCollision ( NameCollisionEventArgs args ) : void

NetHooks_NameCollision - Internal hook fired when a name collision happens.

NetHooks_SendData ( Hooks.SendDataEventArgs e ) : void

NetHooks_SendData - Fired when the server sends data.

NpcHooks_OnStrikeNpc ( Hooks.NpcStrikeEventArgs e ) : void

NpcHooks_OnStrikeNpc - Fired when an NPC strike packet happens.

OnAccountCreate ( Hooks args ) : void

OnAccountCreate - Internal hook fired on account creation.

OnAccountDelete ( Hooks args ) : void

OnAccountDelete - Internal hook fired on account delete.

OnChat ( ServerChatEventArgs args ) : void

OnChat - Fired when a player chats. Used for handling chat and commands.

OnConnect ( ConnectEventArgs args ) : void

OnConnect - Fired when a player connects to the server.

OnGetData ( Hooks.GetDataEventArgs e ) : void

OnGetData - Called when the server gets raw data packets.

OnGreetPlayer ( GreetPlayerEventArgs args ) : void

OnGreetPlayer - Fired when a player is greeted by the server. Handles things like the MOTD, join messages, etc.

OnHalloweenCheck ( HalloweenCheckEventArgs args ) : void

OnHalloweenCheck - Internal hook fired when the HalloweenCheck happens.

OnHardUpdate ( HardmodeTileUpdateEventArgs args ) : void

OnHardUpdate - Fired when a hardmode tile update event happens.

OnItemForceIntoChest ( ForceItemIntoChestEventArgs args ) : void

OnItemForceIntoChest - Internal hook fired when a player quick stacks items into a chest.

OnJoin ( JoinEventArgs args ) : void

OnJoin - Internal hook called when a player joins. This is called after OnConnect.

OnLeave ( LeaveEventArgs args ) : void

OnLeave - Called when a player leaves the server.

OnPlayerLogin ( PlayerPostLoginEventArgs args ) : void

OnPlayerLogin - Fires the PlayerLogin hook to listening plugins.

OnPlayerPreLogin ( Hooks args ) : void

OnPlayerPreLogin - Internal hook fired when on player pre login.

OnPostInit ( EventArgs args ) : void

OnPostInit - Fired when the server loads a map, to perform world specific operations.

OnProjectileSetDefaults ( int>.SetDefaultsEventArgs e ) : void

OnProjectileSetDefaults - Called when a projectile sets the default attributes for itself.

OnSecondUpdate ( ) : void

OnSecondUpdate - Called effectively every second for all time based checks.

OnStartHardMode ( HandledEventArgs e ) : void

OnStartHardMode - Fired when hard mode is started.

OnStatueSpawn ( Hooks.StatueSpawnEventArgs args ) : void

OnStatueSpawn - Fired when a statue spawns.

OnUpdate ( EventArgs args ) : void

OnUpdate - Called when ever the server ticks.

OnXmasCheck ( Hooks.ChristmasCheckEventArgs args ) : void

OnXmasCheck - Internal hook fired when the XMasCheck happens.

ServerHooks_OnCommand ( CommandEventArgs args ) : void

Called when a command is issued from the server console.

SetConsoleTitle ( bool empty ) : void

SetConsoleTitle - Updates the console title with some pertinent information.

Method Details

CheckIgnores() public static method

CheckIgnores - Checks a players ignores...?
public static CheckIgnores ( TShockAPI.TSPlayer player ) : bool
player TShockAPI.TSPlayer player - The TSPlayer object.
return bool

CheckProjectilePermission() public static method

CheckProjectilePermission - Checks if a projectile is banned.
public static CheckProjectilePermission ( TShockAPI.TSPlayer player, int index, int type ) : bool
player TShockAPI.TSPlayer player - The TSPlayer object that created the projectile.
index int index - The projectile index.
type int type - The projectile type.
return bool

CheckRangePermission() public static method

CheckRangePermission - Checks if a player has permission to modify a tile dependent on range checks.
public static CheckRangePermission ( TShockAPI.TSPlayer player, int x, int y, int range = 32 ) : bool
player TShockAPI.TSPlayer player - The TSPlayer object.
x int x - The x coordinate of the tile.
y int y - The y coordinate of the tile.
range int range - The range to check for.
return bool

CheckSpawn() public static method

CheckSpawn - Checks to see if a location is inside the spawn protection zone.
public static CheckSpawn ( int x, int y ) : bool
x int x - The x coordinate to check.
y int y - The y coordinate to check.
return bool

CheckTilePermission() public static method

CheckTilePermission - Checks to see if a player has the ability to modify a tile at a given position.
public static CheckTilePermission ( TShockAPI.TSPlayer player, int tileX, int tileY, bool paint = false ) : bool
player TShockAPI.TSPlayer player - The TSPlayer object.
tileX int tileX - The x coordinate of the tile.
tileY int tileY - The y coordinate of the tile.
paint bool paint - Whether or not the tile is paint.
return bool

CheckTilePermission() public static method

CheckTilePermission - Checks to see if a player has permission to modify a tile in general.
public static CheckTilePermission ( TShockAPI.TSPlayer player, int tileX, int tileY, short tileType, GetDataHandlers actionType ) : bool
player TShockAPI.TSPlayer player - The TSPlayer object.
tileX int tileX - The x coordinate of the tile.
tileY int tileY - The y coordinate of the tile.
tileType short tileType - The tile type.
actionType GetDataHandlers actionType - The type of edit that took place.
return bool

CrashReporter_HeapshotRequesting() protected method

protected CrashReporter_HeapshotRequesting ( object sender, EventArgs e ) : void
sender object
e System.EventArgs
return void

Dispose() protected method

Dispose - Called when disposing.
protected Dispose ( bool disposing ) : void
disposing bool disposing - If set, disposes of all hooks and other systems.
return void

Distance() public static method

Distance - Determines the distance between two vectors.
public static Distance ( Vector2 value1, Vector2 value2 ) : float
value1 Vector2 value1 - The first vector location.
value2 Vector2 value2 - The second vector location.
return float

HackedInventory() public static method

HackedInventory - Checks to see if a user has a hacked inventory. In addition, messages players the result.
public static HackedInventory ( TShockAPI.TSPlayer player ) : bool
player TShockAPI.TSPlayer player - The TSPlayer object.
return bool

HandleCommandLinePostConfigLoad() public static method

HandleCommandLinePostConfigLoad - Handles additional command line options after the config file is read.
public static HandleCommandLinePostConfigLoad ( string parms ) : void
parms string parms - The array of arguments passed in through the command line.
return void

OnConfigRead() public method

OnConfigRead - Fired when the config file has been read.
public OnConfigRead ( ConfigFile file ) : void
file ConfigFile file - The config file object.
return void

StartInvasion() public static method

StartInvasion - Starts an invasion on the server.
public static StartInvasion ( int type ) : void
type int type - The invasion type id.
return void

TShock() public method

TShock - The constructor for the TShock plugin.
public TShock ( Terraria.Main game ) : System
game Terraria.Main game - The Terraria main game.
return System

Property Details

AuthToken public static property

AuthToken - The auth token used by the /auth system to grant temporary superadmin access to new admins.
public static int AuthToken
return int

Backups public static property

Backups - Static reference to the backup manager for accessing the backup system.
public static BackupManager,TShockAPI Backups
return BackupManager

Bans public static property

Bans - Static reference to the ban manager for accessing bans & related functions.
public static BanManager Bans
return BanManager

CharacterDB public static property

CharacterDB - Static reference to the SSC character manager.
public static CharacterManager,TShockAPI.DB CharacterDB
return TShockAPI.DB.CharacterManager

DB public static property

DB - Static reference to the database.
public static IDbConnection DB
return IDbConnection

Geo public static property

Geo - Static reference to the GeoIP system which determines the location of an IP address.
public static GeoIPCountry,MaxMind Geo
return MaxMind.GeoIPCountry

Groups public static property

Groups - Static reference to the group manager for accessing the group system.
public static GroupManager,TShockAPI.DB Groups
return TShockAPI.DB.GroupManager

Itembans public static property

Itembans - Static reference to the item ban system.
public static ItemManager Itembans
return ItemManager

Log public static property

Log - Static reference to the log system, which outputs to either SQL or a text file, depending on user config.
public static ILog Log
return ILog

OverridePort public static property

OverridePort - Determines if TShock should override the server port.
public static bool OverridePort
return bool

Players public static property

Players - Contains all TSPlayer objects for accessing TSPlayers currently on the server
public static TSPlayer[],TShockAPI Players
return TShockAPI.TSPlayer[]

ProjectileBans public static property

ProjectileBans - Static reference to the projectile ban system.
public static ProjectileManagager ProjectileBans
return ProjectileManagager

RESTStartupTokens public static property

Used for implementing REST Tokens prior to the REST system starting up.
public static Dictionary RESTStartupTokens
return SecureRest.TokenData>.Dictionary

Regions public static property

Regions - Static reference to the region manager for accessing the region system.
public static RegionManager Regions
return RegionManager

RememberedPos public static property

RememberedPos - Static reference to the remembered position manager.
public static RememberedPosManager,TShockAPI.DB RememberedPos
return TShockAPI.DB.RememberedPosManager

RestApi public static property

RestApi - Static reference to the Rest API authentication manager.
public static SecureRest,Rests RestApi
return Rests.SecureRest

RestManager public static property

RestManager - Static reference to the Rest API manager.
public static RestManager,TShockAPI RestManager
return RestManager

SavePath public static property

SavePath - This is the path TShock saves its data in. This path is relative to the TerrariaServer.exe (not in ServerPlugins).
public static string SavePath
return string

ServerSideCharacterConfig public static property

ServerSideCharacterConfig - Static reference to the server side character config, for accessing values set by users to modify SSC.
public static ServerSideConfig ServerSideCharacterConfig
return ServerSideConfig

ShuttingDown public static property

Will be set to true once Utils.StopServer() is called.
public static bool ShuttingDown
return bool

StatTracker public static property

StatTracker - Static reference to the stat tracker, which is created immediately when declared.
public static StatTracker,TShockAPI StatTracker
return StatTracker

TileBans public static property

TileBans - Static reference to the tile ban system.
public static TileManager TileBans
return TileManager

UpdateManager public static property

UpdateManager - Static reference to the update checker, which checks for updates and notifies server admins of updates.
public static UpdateManager,TShockAPI UpdateManager
return TShockAPI.UpdateManager

Users public static property

Users - Static reference to the user manager for accessing the user database system.
public static UserManager,TShockAPI.DB Users
return TShockAPI.DB.UserManager

Utils public static property

Utils - Static reference to the utilities class, which contains a variety of utility functions.
public static Utils Utils
return Utils

VersionCodename public static property

VersionCodename - The version codename is displayed when the server starts. Inspired by software codenames conventions.
public static string VersionCodename
return string

VersionNum public static property

VersionNum - The version number the TerrariaAPI will return back to the API. We just use the Assembly info.
public static Version,System VersionNum
return System.Version

Warps public static property

Warps - Static reference to the warp manager for accessing the warp system.
public static WarpManager,TShockAPI.DB Warps
return TShockAPI.DB.WarpManager

instance public static property

instance - Static reference to the TerrariaPlugin instance.
public static TerrariaPlugin instance
return TerrariaPlugin