diff --git a/Build/TerrariaServer.XML b/Build/TerrariaServer.XML deleted file mode 100644 index 1b7deea8..00000000 --- a/Build/TerrariaServer.XML +++ /dev/null @@ -1,90 +0,0 @@ - - - - TerrariaServer - - - - - Hooks interface - - - - - List of players - - - - - See generic HandlerList - - - - - Works like an event. Allows for registering delegates with a higher or lower priority. - - - - - - Register a handler - - Delegate to be called - Priority of the delegate - Should the handler receive a call even if it has been handled - - - - Attempts to damage the player. - - int - how much damage to give - - - - Sends message to specified player - - string - text to send - Color - color for the text - - - - Meant to only be used by TServer. - - - - - The character name of the player. - - - - - Return a list of interfaces this plugin exposes. - - - - - - Called before initialize passing all the interfaces gathered from plugins - - - - - - Gets the T interface from the collection. Returns null if its not found. - - - - - - - - Called when the player first connects. They are not fully in the game yet, for that see Greet. - - - - - Called when the player is actually loaded into the game. - - - - diff --git a/CONTRIBUTING b/CONTRIBUTING deleted file mode 100644 index 095ad8ea..00000000 --- a/CONTRIBUTING +++ /dev/null @@ -1,36 +0,0 @@ -### Issue Guidelines -Please follow these simple requirements before posting an issue: - -1. TShock version number -2. Any stack traces that may have happened when the issue occurred -3. How to reproduce the issue - -### Pull Request Dev Guidelines - -These guidelines are for contributors. If you do not follow these guidelines your commits will be reverted. - -Required: -- Follow the code style. We generally use microsofts except for m_ infront of private variables. -- Do not push unfinished features to the master branch, instead create a remote branch and push to that. -- Do not push untested code to the master branch, instead push to the test branch. -- Document all compatibility issues in the COMPATIBILITY file. (IE file formats changing) -- DO NOT MASS COMMIT. Commit changes as you go (without pushing). That way when you push we don't get a thousand changes with a 1-3 line commit message. - -Optional: -- Build Version Increment (http://autobuildversion.codeplex.com/). - ----- - -### Dev Team Guidelines - -These guidelines are to be followed by all developers with commit level access to this repository: - -- Do not, for any reason, submit code to the master branch before it hits the development branch first. If the development branch is far ahead, and a new bug fix is going out, branch master, then merge with master and remove your branch. - - If you are found to do this, you will be the person merging and rebasing your code to fit general-devel. -- Prior to posting any version on the website, you must tick the version in AssemblyInfo.cs. This is the versioning formula: - - Major.Minor.Revision.BuildDate (tick Revision if you're fixing prior to an actual planned release) -- Do not release any development builds on the forums without consulting another developer first. -- __Document code prior to marking it done in JIRA__ -- Move any un-tested code to the "Needs Validation" section on JIRA prior to marking it as done. -- Do not push changes to any branch without a proper issue being assigned in JIRA. If a feature isn't planned for this release, __it shouldn't be in the repo about to be released__. -- Submit all pull requests to the general-devel branch prior to the master branch, or you will be ignored. \ No newline at end of file diff --git a/TShockAPI/BackupManager.cs b/TShockAPI/BackupManager.cs index 13f94587..1882d0bb 100644 --- a/TShockAPI/BackupManager.cs +++ b/TShockAPI/BackupManager.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/TShockAPI/Commands.cs b/TShockAPI/Commands.cs index 6c9aeb38..b2162eab 100755 --- a/TShockAPI/Commands.cs +++ b/TShockAPI/Commands.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -878,7 +878,6 @@ namespace TShockAPI args.Player.SendSuccessMessage("Account \"{0}\" has been registered.", user.Name); args.Player.SendSuccessMessage("Your password is {0}.", user.Password); TShock.Users.AddUser(user); - TShock.CharacterDB.SeedInitialData(TShock.Users.GetUser(user)); Log.ConsoleInfo("{0} registered an account: \"{1}\".", args.Player.Name, user.Name); } else @@ -910,28 +909,35 @@ namespace TShockAPI { var user = new User(); - try + if (args.Parameters.Count == 4) { - if (args.Parameters.Count == 4) + user.Name = args.Parameters[1]; + user.Password = args.Parameters[2]; + user.Group = args.Parameters[3]; + + try { - user.Name = args.Parameters[1]; - user.Password = args.Parameters[2]; - user.Group = args.Parameters[3]; - - args.Player.SendSuccessMessage("Account " + user.Name + " has been added to group " + user.Group + "!"); TShock.Users.AddUser(user); - TShock.CharacterDB.SeedInitialData(TShock.Users.GetUser(user)); + args.Player.SendSuccessMessage("Account " + user.Name + " has been added to group " + user.Group + "!"); Log.ConsoleInfo(args.Player.Name + " added Account " + user.Name + " to group " + user.Group); } - else + catch (GroupNotExistsException e) { - args.Player.SendErrorMessage("Invalid syntax. Try /user help."); + args.Player.SendErrorMessage("Group " + user.Group + " does not exist!"); + } + catch (UserExistsException e) + { + args.Player.SendErrorMessage("User " + user.Name + " already exists!"); + } + catch (UserManagerException e) + { + args.Player.SendErrorMessage("User " + user.Name + " could not be added, check console for details."); + Log.ConsoleError(e.ToString()); } } - catch (UserManagerException ex) + else { - args.Player.SendErrorMessage(ex.Message); - Log.ConsoleError(ex.ToString()); + args.Player.SendErrorMessage("Invalid syntax. Try /user help."); } } // User deletion requires a username @@ -946,60 +952,77 @@ namespace TShockAPI args.Player.SendSuccessMessage("Account removed successfully."); Log.ConsoleInfo(args.Player.Name + " successfully deleted account: " + args.Parameters[1] + "."); } + catch (UserNotExistException e) + { + args.Player.SendErrorMessage("The user " + user.Name + " does not exist! Deleted nobody!"); + } catch (UserManagerException ex) { args.Player.SendMessage(ex.Message, Color.Red); Log.ConsoleError(ex.ToString()); } } - // Password changing requires a username, and a new password to set + + // Password changing requires a username, and a new password to set else if (subcmd == "password") { var user = new User(); user.Name = args.Parameters[1]; - try + if (args.Parameters.Count == 3) { - if (args.Parameters.Count == 3) + try { - args.Player.SendSuccessMessage("Password change succeeded for " + user.Name + "."); TShock.Users.SetUserPassword(user, args.Parameters[2]); Log.ConsoleInfo(args.Player.Name + " changed the password of account " + user.Name); + args.Player.SendSuccessMessage("Password change succeeded for " + user.Name + "."); } - else + catch (UserNotExistException e) { - args.Player.SendErrorMessage("Invalid user password syntax. Try /user help."); + args.Player.SendErrorMessage("User " + user.Name + " does not exist!"); + } + catch (UserManagerException e) + { + args.Player.SendErrorMessage("Password change for " + user.Name + " failed! Check console!"); + Log.ConsoleError(e.ToString()); } } - catch (UserManagerException ex) + else { - args.Player.SendErrorMessage(ex.Message); - Log.ConsoleError(ex.ToString()); + args.Player.SendErrorMessage("Invalid user password syntax. Try /user help."); } } - // Group changing requires a username or IP address, and a new group to set + // Group changing requires a username or IP address, and a new group to set else if (subcmd == "group") { - var user = new User(); - user.Name = args.Parameters[1]; + var user = new User(); + user.Name = args.Parameters[1]; - try + if (args.Parameters.Count == 3) { - if (args.Parameters.Count == 3) + try { - args.Player.SendSuccessMessage("Account " + user.Name + " has been changed to group " + args.Parameters[2] + "!"); TShock.Users.SetUserGroup(user, args.Parameters[2]); Log.ConsoleInfo(args.Player.Name + " changed account " + user.Name + " to group " + args.Parameters[2] + "."); + args.Player.SendSuccessMessage("Account " + user.Name + " has been changed to group " + args.Parameters[2] + "!"); } - else + catch (GroupNotExistsException e) { - args.Player.SendErrorMessage("Invalid user group syntax. Try /user help."); + args.Player.SendErrorMessage("That group does not exist!"); } + catch (UserNotExistException e) + { + args.Player.SendErrorMessage("User " + user.Name + " does not exist!"); + } + catch (UserManagerException e) + { + args.Player.SendErrorMessage("User " + user.Name + " could not be added. Check console for details."); + } + } - catch (UserManagerException ex) + else { - args.Player.SendMessage(ex.Message, Color.Green); - Log.ConsoleError(ex.ToString()); + args.Player.SendErrorMessage("Invalid user group syntax. Try /user help."); } } else if (subcmd == "help") diff --git a/TShockAPI/ConfigFile.cs b/TShockAPI/ConfigFile.cs index e1eb1014..2b4726d8 100755 --- a/TShockAPI/ConfigFile.cs +++ b/TShockAPI/ConfigFile.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/TShockAPI/DB/BanManager.cs b/TShockAPI/DB/BanManager.cs old mode 100644 new mode 100755 index 4e38bd3f..3fa732dd --- a/TShockAPI/DB/BanManager.cs +++ b/TShockAPI/DB/BanManager.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -46,7 +46,7 @@ namespace TShockAPI.DB : new MysqlQueryCreator()); try { - creator.EnsureExists(table); + creator.EnsureTableStructure(table); } catch (DllNotFoundException) { diff --git a/TShockAPI/DB/CharacterManager.cs b/TShockAPI/DB/CharacterManager.cs index 7df75c29..df9f75a1 100755 --- a/TShockAPI/DB/CharacterManager.cs +++ b/TShockAPI/DB/CharacterManager.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -57,7 +57,7 @@ namespace TShockAPI.DB db.GetSqlType() == SqlType.Sqlite ? (IQueryBuilder) new SqliteQueryCreator() : new MysqlQueryCreator()); - creator.EnsureExists(table); + creator.EnsureTableStructure(table); } public PlayerData GetPlayerData(TSPlayer player, int acctid) @@ -104,7 +104,7 @@ namespace TShockAPI.DB public bool SeedInitialData(User user) { var inventory = new StringBuilder(); - for (int i = 0; i < Terraria.Main.maxInventory; i++) + for (int i = 0; i < NetItem.maxNetInventory; i++) { if (i > 0) { diff --git a/TShockAPI/DB/GroupManager.cs b/TShockAPI/DB/GroupManager.cs old mode 100644 new mode 100755 index cf0e8006..2021ff25 --- a/TShockAPI/DB/GroupManager.cs +++ b/TShockAPI/DB/GroupManager.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -47,34 +47,35 @@ namespace TShockAPI.DB db.GetSqlType() == SqlType.Sqlite ? (IQueryBuilder) new SqliteQueryCreator() : new MysqlQueryCreator()); - creator.EnsureExists(table); + if (creator.EnsureTableStructure(table)) + { + // Add default groups if they don't exist + AddDefaultGroup("guest", "", + string.Join(",", Permissions.canbuild, Permissions.canregister, Permissions.canlogin, Permissions.canpartychat, + Permissions.cantalkinthird, Permissions.canchat)); + + AddDefaultGroup("default", "guest", + string.Join(",", Permissions.warp, Permissions.canchangepassword)); + + AddDefaultGroup("newadmin", "default", + string.Join(",", Permissions.kick, Permissions.editspawn, Permissions.reservedslot)); + + AddDefaultGroup("admin", "newadmin", + string.Join(",", Permissions.ban, Permissions.whitelist, "tshock.world.time.*", Permissions.spawnboss, + Permissions.spawnmob, Permissions.managewarp, Permissions.time, Permissions.tp, Permissions.slap, + Permissions.kill, Permissions.logs, + Permissions.immunetokick, Permissions.tpothers)); + + AddDefaultGroup("trustedadmin", "admin", + string.Join(",", Permissions.maintenance, "tshock.cfg.*", "tshock.world.*", Permissions.butcher, Permissions.item, + Permissions.heal, Permissions.immunetoban, Permissions.usebanneditem)); + + AddDefaultGroup("vip", "default", string.Join(",", Permissions.reservedslot)); + } // Load Permissions from the DB LoadPermisions(); - // Add default groups if they don't exist - AddDefaultGroup("guest", "", - string.Join(",", Permissions.canbuild, Permissions.canregister, Permissions.canlogin, Permissions.canpartychat, - Permissions.cantalkinthird, Permissions.canchat)); - - AddDefaultGroup("default", "guest", - string.Join(",", Permissions.warp, Permissions.canchangepassword)); - - AddDefaultGroup("newadmin", "default", - string.Join(",", Permissions.kick, Permissions.editspawn, Permissions.reservedslot)); - - AddDefaultGroup("admin", "newadmin", - string.Join(",", Permissions.ban, Permissions.whitelist, "tshock.world.time.*", Permissions.spawnboss, - Permissions.spawnmob, Permissions.managewarp, Permissions.time, Permissions.tp, Permissions.slap, - Permissions.kill, Permissions.logs, - Permissions.immunetokick, Permissions.tpothers)); - - AddDefaultGroup("trustedadmin", "admin", - string.Join(",", Permissions.maintenance, "tshock.cfg.*", "tshock.world.*", Permissions.butcher, Permissions.item, - Permissions.heal, Permissions.immunetoban, Permissions.usebanneditem)); - - AddDefaultGroup("vip", "default", string.Join(",", Permissions.reservedslot)); - Group.DefaultGroup = GetGroupByName(TShock.Config.DefaultGuestGroupName); } diff --git a/TShockAPI/DB/IQueryBuilder.cs b/TShockAPI/DB/IQueryBuilder.cs index 64988c7c..ac030759 100644 --- a/TShockAPI/DB/IQueryBuilder.cs +++ b/TShockAPI/DB/IQueryBuilder.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/TShockAPI/DB/ItemManager.cs b/TShockAPI/DB/ItemManager.cs old mode 100644 new mode 100755 index 9ef62d47..51f793b1 --- a/TShockAPI/DB/ItemManager.cs +++ b/TShockAPI/DB/ItemManager.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -41,7 +41,7 @@ namespace TShockAPI.DB db.GetSqlType() == SqlType.Sqlite ? (IQueryBuilder) new SqliteQueryCreator() : new MysqlQueryCreator()); - creator.EnsureExists(table); + creator.EnsureTableStructure(table); UpdateItemBans(); } diff --git a/TShockAPI/DB/ProjectileManager.cs b/TShockAPI/DB/ProjectileManager.cs old mode 100644 new mode 100755 index bba1d15b..f2ceed1c --- a/TShockAPI/DB/ProjectileManager.cs +++ b/TShockAPI/DB/ProjectileManager.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -41,7 +41,7 @@ namespace TShockAPI.DB db.GetSqlType() == SqlType.Sqlite ? (IQueryBuilder) new SqliteQueryCreator() : new MysqlQueryCreator()); - creator.EnsureExists(table); + creator.EnsureTableStructure(table); UpdateBans(); } diff --git a/TShockAPI/DB/RegionManager.cs b/TShockAPI/DB/RegionManager.cs old mode 100644 new mode 100755 index dd66c20d..1128a3ae --- a/TShockAPI/DB/RegionManager.cs +++ b/TShockAPI/DB/RegionManager.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -55,7 +55,7 @@ namespace TShockAPI.DB db.GetSqlType() == SqlType.Sqlite ? (IQueryBuilder) new SqliteQueryCreator() : new MysqlQueryCreator()); - creator.EnsureExists(table); + creator.EnsureTableStructure(table); } /// diff --git a/TShockAPI/DB/RememberedPosManager.cs b/TShockAPI/DB/RememberedPosManager.cs old mode 100644 new mode 100755 index 86943784..48003e4b --- a/TShockAPI/DB/RememberedPosManager.cs +++ b/TShockAPI/DB/RememberedPosManager.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -42,7 +42,7 @@ namespace TShockAPI.DB db.GetSqlType() == SqlType.Sqlite ? (IQueryBuilder) new SqliteQueryCreator() : new MysqlQueryCreator()); - creator.EnsureExists(table); + creator.EnsureTableStructure(table); } public Vector2 CheckLeavePos(string name) diff --git a/TShockAPI/DB/SqlColumn.cs b/TShockAPI/DB/SqlColumn.cs index e72297a6..8fd72d88 100644 --- a/TShockAPI/DB/SqlColumn.cs +++ b/TShockAPI/DB/SqlColumn.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/TShockAPI/DB/SqlTable.cs b/TShockAPI/DB/SqlTable.cs old mode 100644 new mode 100755 index 0f8fd974..5245e04c --- a/TShockAPI/DB/SqlTable.cs +++ b/TShockAPI/DB/SqlTable.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -52,7 +52,8 @@ namespace TShockAPI.DB creator = provider; } - public void EnsureExists(SqlTable table) + // Returns true if the table was created; false if it was not. + public bool EnsureTableStructure(SqlTable table) { var columns = GetColumns(table); if (columns.Count > 0) @@ -66,7 +67,19 @@ namespace TShockAPI.DB else { database.Query(creator.CreateTable(table)); + return true; } + return false; + } + + /// + /// Ensures a table exists and that its structure is correct + /// + /// The table name + [Obsolete("This method will be replaced by EnsureTableExists.")] + public void EnsureExists(SqlTable table) + { + EnsureTableStructure(table); } public List GetColumns(SqlTable table) diff --git a/TShockAPI/DB/SqlValue.cs b/TShockAPI/DB/SqlValue.cs index e7c393b7..9edb13e0 100644 --- a/TShockAPI/DB/SqlValue.cs +++ b/TShockAPI/DB/SqlValue.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/TShockAPI/DB/TileManager.cs b/TShockAPI/DB/TileManager.cs old mode 100644 new mode 100755 index dc73f2c3..9144d34d --- a/TShockAPI/DB/TileManager.cs +++ b/TShockAPI/DB/TileManager.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -41,7 +41,7 @@ namespace TShockAPI.DB db.GetSqlType() == SqlType.Sqlite ? (IQueryBuilder)new SqliteQueryCreator() : new MysqlQueryCreator()); - creator.EnsureExists(table); + creator.EnsureTableStructure(table); UpdateBans(); } diff --git a/TShockAPI/DB/UserManager.cs b/TShockAPI/DB/UserManager.cs old mode 100644 new mode 100755 index 38dc8745..7a5f07c7 --- a/TShockAPI/DB/UserManager.cs +++ b/TShockAPI/DB/UserManager.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -48,7 +48,7 @@ namespace TShockAPI.DB db.GetSqlType() == SqlType.Sqlite ? (IQueryBuilder) new SqliteQueryCreator() : new MysqlQueryCreator()); - creator.EnsureExists(table); + creator.EnsureTableStructure(table); } /// @@ -76,6 +76,8 @@ namespace TShockAPI.DB if (1 > ret) throw new UserExistsException(user.Name); + + Hooks.AccountHooks.OnAccountCreate(user); } /// @@ -86,10 +88,13 @@ namespace TShockAPI.DB { try { + var tempuser = GetUser(user); int affected = database.Query("DELETE FROM Users WHERE Username=@0", user.Name); if (affected < 1) throw new UserNotExistException(user.Name); + + Hooks.AccountHooks.OnAccountDelete(tempuser); } catch (Exception ex) { diff --git a/TShockAPI/DB/WarpsManager.cs b/TShockAPI/DB/WarpsManager.cs old mode 100644 new mode 100755 index 709298f2..88c97e9b --- a/TShockAPI/DB/WarpsManager.cs +++ b/TShockAPI/DB/WarpsManager.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -51,7 +51,7 @@ namespace TShockAPI.DB db.GetSqlType() == SqlType.Sqlite ? (IQueryBuilder) new SqliteQueryCreator() : new MysqlQueryCreator()); - creator.EnsureExists(table); + creator.EnsureTableStructure(table); } /// diff --git a/TShockAPI/Extensions/DbExt.cs b/TShockAPI/Extensions/DbExt.cs index d11309ef..5dd6e0e6 100644 --- a/TShockAPI/Extensions/DbExt.cs +++ b/TShockAPI/Extensions/DbExt.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/TShockAPI/Extensions/LinqExt.cs b/TShockAPI/Extensions/LinqExt.cs index 99448df1..e1885bbd 100644 --- a/TShockAPI/Extensions/LinqExt.cs +++ b/TShockAPI/Extensions/LinqExt.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/TShockAPI/Extensions/RandomExt.cs b/TShockAPI/Extensions/RandomExt.cs index 68fc37a5..42abce9a 100644 --- a/TShockAPI/Extensions/RandomExt.cs +++ b/TShockAPI/Extensions/RandomExt.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/TShockAPI/Extensions/StringExt.cs b/TShockAPI/Extensions/StringExt.cs index 57d4cf1d..fe6dcfa2 100644 --- a/TShockAPI/Extensions/StringExt.cs +++ b/TShockAPI/Extensions/StringExt.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/TShockAPI/FileTools.cs b/TShockAPI/FileTools.cs index fe7a6040..071da3fc 100644 --- a/TShockAPI/FileTools.cs +++ b/TShockAPI/FileTools.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/TShockAPI/GeoIPCountry.cs b/TShockAPI/GeoIPCountry.cs index 2131fd17..764a69a2 100644 --- a/TShockAPI/GeoIPCountry.cs +++ b/TShockAPI/GeoIPCountry.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs index e3beae8f..2680ac10 100755 --- a/TShockAPI/GetDataHandlers.cs +++ b/TShockAPI/GetDataHandlers.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/TShockAPI/Group.cs b/TShockAPI/Group.cs index ddd3c029..7efcb07a 100644 --- a/TShockAPI/Group.cs +++ b/TShockAPI/Group.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/TShockAPI/HandlerList.cs b/TShockAPI/HandlerList.cs index 9524c79e..07b9d548 100644 --- a/TShockAPI/HandlerList.cs +++ b/TShockAPI/HandlerList.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/TShockAPI/Hooks/AccountHooks.cs b/TShockAPI/Hooks/AccountHooks.cs new file mode 100755 index 00000000..e9bf76d2 --- /dev/null +++ b/TShockAPI/Hooks/AccountHooks.cs @@ -0,0 +1,66 @@ +/* +TShock, a server mod for Terraria +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ + +using TShockAPI.DB; +namespace TShockAPI.Hooks +{ + public class AccountDeleteEventArgs + { + public User User { get; set; } + + public AccountDeleteEventArgs(User user) + { + this.User = user; + } + } + + public class AccountCreateEventArgs + { + public User User { get; set; } + + public AccountCreateEventArgs(User user) + { + this.User = user; + } + } + + public class AccountHooks + { + public delegate void AccountCreateD(AccountCreateEventArgs e); + public static event AccountCreateD AccountCreate; + + public static void OnAccountCreate(User u) + { + if (AccountCreate == null) + return; + + AccountCreate(new AccountCreateEventArgs(u)); + } + + public delegate void AccountDeleteD(AccountDeleteEventArgs e); + public static event AccountDeleteD AccountDelete; + + public static void OnAccountDelete(User u) + { + if (AccountDelete == null) + return; + + AccountDelete(new AccountDeleteEventArgs(u)); + } + } +} diff --git a/TShockAPI/Hooks/GeneralHooks.cs b/TShockAPI/Hooks/GeneralHooks.cs index 8e6168d6..d07c4f4f 100644 --- a/TShockAPI/Hooks/GeneralHooks.cs +++ b/TShockAPI/Hooks/GeneralHooks.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/TShockAPI/Hooks/PlayerHooks.cs b/TShockAPI/Hooks/PlayerHooks.cs index 6e69e19d..73e862a8 100644 --- a/TShockAPI/Hooks/PlayerHooks.cs +++ b/TShockAPI/Hooks/PlayerHooks.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/TShockAPI/IPackable.cs b/TShockAPI/IPackable.cs index ffef9e42..7dbb2d93 100644 --- a/TShockAPI/IPackable.cs +++ b/TShockAPI/IPackable.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/TShockAPI/Log.cs b/TShockAPI/Log.cs index 9b239ce9..b2bb540f 100644 --- a/TShockAPI/Log.cs +++ b/TShockAPI/Log.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/TShockAPI/Net/BaseMsg.cs b/TShockAPI/Net/BaseMsg.cs index 02d4c201..c6f3de54 100644 --- a/TShockAPI/Net/BaseMsg.cs +++ b/TShockAPI/Net/BaseMsg.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/TShockAPI/Net/DisconnectMsg.cs b/TShockAPI/Net/DisconnectMsg.cs index 5ca32855..9e5789b4 100644 --- a/TShockAPI/Net/DisconnectMsg.cs +++ b/TShockAPI/Net/DisconnectMsg.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/TShockAPI/Net/NetTile.cs b/TShockAPI/Net/NetTile.cs index bd8249a6..c3ee7d6f 100644 --- a/TShockAPI/Net/NetTile.cs +++ b/TShockAPI/Net/NetTile.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/TShockAPI/Net/ProjectileRemoveMsg.cs b/TShockAPI/Net/ProjectileRemoveMsg.cs index 4d68305e..a576e5bd 100644 --- a/TShockAPI/Net/ProjectileRemoveMsg.cs +++ b/TShockAPI/Net/ProjectileRemoveMsg.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/TShockAPI/Net/SpawnMsg.cs b/TShockAPI/Net/SpawnMsg.cs index bb5d7fed..2fa15e59 100644 --- a/TShockAPI/Net/SpawnMsg.cs +++ b/TShockAPI/Net/SpawnMsg.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/TShockAPI/Net/WorldInfoMsg.cs b/TShockAPI/Net/WorldInfoMsg.cs index a2e4fc1e..e4763bb6 100644 --- a/TShockAPI/Net/WorldInfoMsg.cs +++ b/TShockAPI/Net/WorldInfoMsg.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/TShockAPI/PacketBufferer.cs b/TShockAPI/PacketBufferer.cs index b624d394..051a9531 100644 --- a/TShockAPI/PacketBufferer.cs +++ b/TShockAPI/PacketBufferer.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/TShockAPI/PaginationTools.cs b/TShockAPI/PaginationTools.cs index eb208ae7..e3161a3c 100644 --- a/TShockAPI/PaginationTools.cs +++ b/TShockAPI/PaginationTools.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/TShockAPI/Permissions.cs b/TShockAPI/Permissions.cs index 85847bfc..d970182a 100644 --- a/TShockAPI/Permissions.cs +++ b/TShockAPI/Permissions.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/TShockAPI/Properties/AssemblyInfo.cs b/TShockAPI/Properties/AssemblyInfo.cs old mode 100644 new mode 100755 index ba209b94..3333497b --- a/TShockAPI/Properties/AssemblyInfo.cs +++ b/TShockAPI/Properties/AssemblyInfo.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -28,7 +28,7 @@ using System.Runtime.InteropServices; [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Nyx Studios & TShock Contributors")] [assembly: AssemblyProduct("TShockAPI")] -[assembly: AssemblyCopyright("Copyright © Nyx Studios 2011-2014")] +[assembly: AssemblyCopyright("Copyright © Nyx Studios 2011-2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -47,7 +47,11 @@ using System.Runtime.InteropServices; // Major Version // Minor Version // Build Number -// MMdd of the build +// Starting in version 4.2.5, we are no longer including the fourth decimal +// location, which previously held the date and time. -[assembly: AssemblyVersion("4.2.3.0909")] -[assembly: AssemblyFileVersion("4.2.3.0909")] +// Also, be sure to release on github with the exact assembly version tag as below +// so that the update manager works correctly (via the Github releases api and mimic) + +[assembly: AssemblyVersion("4.2.6")] +[assembly: AssemblyFileVersion("4.2.6")] diff --git a/TShockAPI/RconHandler.cs b/TShockAPI/RconHandler.cs index cdd76d3e..39f32fa2 100644 --- a/TShockAPI/RconHandler.cs +++ b/TShockAPI/RconHandler.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/TShockAPI/Rest/Rest.cs b/TShockAPI/Rest/Rest.cs index 740f9bde..17c032cd 100644 --- a/TShockAPI/Rest/Rest.cs +++ b/TShockAPI/Rest/Rest.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -155,9 +155,10 @@ namespace Rests str = string.Format("{0}({1});", jsonp, str); } e.Response.Connection.Type = ConnectionType.Close; - e.Response.ContentType = new ContentTypeHeader("application/json"); + e.Response.ContentType = new ContentTypeHeader("application/json; charset=utf-8"); e.Response.Add(serverHeader); - e.Response.Body.Write(Encoding.ASCII.GetBytes(str), 0, str.Length); + var bytes = Encoding.UTF8.GetBytes(str); + e.Response.Body.Write(bytes, 0, bytes.Length); e.Response.Status = HttpStatusCode.OK; } diff --git a/TShockAPI/Rest/RestCommand.cs b/TShockAPI/Rest/RestCommand.cs index d08616cb..681d7cbf 100644 --- a/TShockAPI/Rest/RestCommand.cs +++ b/TShockAPI/Rest/RestCommand.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/TShockAPI/Rest/RestManager.cs b/TShockAPI/Rest/RestManager.cs index e34177ff..93d81eee 100644 --- a/TShockAPI/Rest/RestManager.cs +++ b/TShockAPI/Rest/RestManager.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/TShockAPI/Rest/RestObject.cs b/TShockAPI/Rest/RestObject.cs index 890c33c7..65503bec 100644 --- a/TShockAPI/Rest/RestObject.cs +++ b/TShockAPI/Rest/RestObject.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/TShockAPI/Rest/RestPermissions.cs b/TShockAPI/Rest/RestPermissions.cs index 18851ac9..5b8c765d 100644 --- a/TShockAPI/Rest/RestPermissions.cs +++ b/TShockAPI/Rest/RestPermissions.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/TShockAPI/Rest/RestVerbs.cs b/TShockAPI/Rest/RestVerbs.cs index 02e5d056..ab8c1500 100644 --- a/TShockAPI/Rest/RestVerbs.cs +++ b/TShockAPI/Rest/RestVerbs.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/TShockAPI/Rest/SecureRest.cs b/TShockAPI/Rest/SecureRest.cs index 9845bc08..ee9eac2f 100644 --- a/TShockAPI/Rest/SecureRest.cs +++ b/TShockAPI/Rest/SecureRest.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/TShockAPI/SaveManager.cs b/TShockAPI/SaveManager.cs index 725637ff..0557183d 100644 --- a/TShockAPI/SaveManager.cs +++ b/TShockAPI/SaveManager.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/TShockAPI/ServerSideCharacters/ServerSideConfig.cs b/TShockAPI/ServerSideCharacters/ServerSideConfig.cs index fbec579f..ea4cc931 100644 --- a/TShockAPI/ServerSideCharacters/ServerSideConfig.cs +++ b/TShockAPI/ServerSideCharacters/ServerSideConfig.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.ComponentModel; /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/TShockAPI/TSPlayer.cs b/TShockAPI/TSPlayer.cs index 158dc5d7..3c711431 100755 --- a/TShockAPI/TSPlayer.cs +++ b/TShockAPI/TSPlayer.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index c298e091..1346113a 100755 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -76,7 +76,6 @@ namespace TShockAPI public static SecureRest RestApi; public static RestManager RestManager; public static Utils Utils = Utils.Instance; - public static StatTracker StatTracker = new StatTracker(); public static UpdateManager UpdateManager; /// /// Used for implementing REST Tokens prior to the REST system starting up. @@ -266,8 +265,10 @@ namespace TShockAPI ServerApi.Hooks.WorldChristmasCheck.Register(this, OnXmasCheck); ServerApi.Hooks.WorldHalloweenCheck.Register(this, OnHalloweenCheck); ServerApi.Hooks.NetNameCollision.Register(this, NetHooks_NameCollision); - TShockAPI.Hooks.PlayerHooks.PlayerPreLogin += OnPlayerPreLogin; - TShockAPI.Hooks.PlayerHooks.PlayerPostLogin += OnPlayerLogin; + Hooks.PlayerHooks.PlayerPreLogin += OnPlayerPreLogin; + Hooks.PlayerHooks.PlayerPostLogin += OnPlayerLogin; + Hooks.AccountHooks.AccountDelete += OnAccountDelete; + Hooks.AccountHooks.AccountCreate += OnAccountCreate; GetDataHandlers.InitGetDataHandler(); Commands.InitCommands(); @@ -380,6 +381,16 @@ namespace TShockAPI Users.UpdateLogin(u); } + private void OnAccountDelete(Hooks.AccountDeleteEventArgs args) + { + CharacterDB.RemovePlayer(args.User.ID); + } + + private void OnAccountCreate(Hooks.AccountCreateEventArgs args) + { + CharacterDB.SeedInitialData(Users.GetUser(args.User)); + } + private void OnPlayerPreLogin(Hooks.PlayerPreLoginEventArgs args) { if (args.Player.IsLoggedIn) @@ -613,7 +624,6 @@ namespace TShockAPI ComputeMaxStyles(); FixChestStacks(); - StatTracker.Initialize(); UpdateManager = new UpdateManager(); } diff --git a/TShockAPI/TShockAPI.csproj b/TShockAPI/TShockAPI.csproj index 75ef9782..4072b8ed 100644 --- a/TShockAPI/TShockAPI.csproj +++ b/TShockAPI/TShockAPI.csproj @@ -75,6 +75,7 @@ + @@ -181,7 +182,7 @@ - +