Merge branch 'general-devel' into sql_improve

This commit is contained in:
Ryozuki 2017-12-13 07:24:35 +01:00 committed by GitHub
commit 0842ee5563
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 21 additions and 74 deletions

View file

@ -3,6 +3,7 @@
This is the rolling changelog for TShock for Terraria. Use past tense when adding new entries; sign your name off when you add or change something. This should primarily be things like user changes, not necessarily codebase changes unless it's really relevant or large. This is the rolling changelog for TShock for Terraria. Use past tense when adding new entries; sign your name off when you add or change something. This should primarily be things like user changes, not necessarily codebase changes unless it's really relevant or large.
## Upcoming Changes ## Upcoming Changes
* API: Added return in OnNameCollision if hook has been handled. (@Patrikkk)
* API: Added hooks for item, projectile and tile bans (@deadsurgeon42) * API: Added hooks for item, projectile and tile bans (@deadsurgeon42)
* API: Changed `PlayerHooks` permission hook mechanisms to allow negation from hooks (@deadsurgeon42) * API: Changed `PlayerHooks` permission hook mechanisms to allow negation from hooks (@deadsurgeon42)
* API: New WorldGrassSpread hook which shold allow corruption/crimson/hallow creep config options to work (@DeathCradle) * API: New WorldGrassSpread hook which shold allow corruption/crimson/hallow creep config options to work (@DeathCradle)
@ -27,6 +28,14 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin
* Fixed DumpItems() from trying to dump older versions of certain items (negative item IDs). (@Zaicon) * Fixed DumpItems() from trying to dump older versions of certain items (negative item IDs). (@Zaicon)
* Added the `/dump-reference-data` command, which when run, runs Utils.Dump() and outputs Terraria reference data to the server folder. (@hakusaro) * Added the `/dump-reference-data` command, which when run, runs Utils.Dump() and outputs Terraria reference data to the server folder. (@hakusaro)
* Added DateTime datatype support for both MySQL and SQLite. (@Ryozuki) * Added DateTime datatype support for both MySQL and SQLite. (@Ryozuki)
* Fixed builds to not require a specific version of OTAPI and to not fail when in Release mode (@bartico6)
* Update Assembly Company to Pryaxis (@Ryozuki)
* Removed `/restart` command. (@hakusaro)
* Removed `Permissions.updateplugins` permission. (@hakusaro)
* Removed REST `/v3/server/restart/` route and `/server/restart/` route. (@hakusaro)
## TShock 4.3.25
* Fixed a critical exploit in the Terraria protocol that could cause massive unpreventable world corruption as well as a number of other problems. Thanks to @bartico6 for reporting. Fixed by the efforts of @QuiCM, @hakusaro, and tips in the right directioon from @bartico6.
## TShock 4.3.24 ## TShock 4.3.24
* Updated OpenTerraria API to 1.3.5.3 (@DeathCradle) * Updated OpenTerraria API to 1.3.5.3 (@DeathCradle)

View file

@ -366,10 +366,6 @@ namespace TShockAPI
{ {
HelpText = "Reloads the server configuration file." HelpText = "Reloads the server configuration file."
}); });
add(new Command(Permissions.maintenance, Restart, "restart")
{
HelpText = "Restarts the server."
});
add(new Command(Permissions.cfgpassword, ServerPassword, "serverpassword") add(new Command(Permissions.cfgpassword, ServerPassword, "serverpassword")
{ {
HelpText = "Changes the server password." HelpText = "Changes the server password."
@ -1902,25 +1898,6 @@ namespace TShockAPI
TShock.Utils.StopServer(true, reason); TShock.Utils.StopServer(true, reason);
} }
private static void Restart(CommandArgs args)
{
if (TShock.NoRestart)
{
args.Player.SendErrorMessage("This command has been disabled.");
return;
}
if (ServerApi.RunningMono)
{
TShock.Log.ConsoleInfo("Sorry, this command has not yet been implemented in Mono.");
}
else
{
string reason = ((args.Parameters.Count > 0) ? "Server shutting down: " + String.Join(" ", args.Parameters) : "Server shutting down!");
TShock.Utils.RestartServer(true, reason);
}
}
private static void OffNoSave(CommandArgs args) private static void OffNoSave(CommandArgs args)
{ {
string reason = ((args.Parameters.Count > 0) ? "Server shutting down: " + String.Join(" ", args.Parameters) : "Server shutting down!"); string reason = ((args.Parameters.Count > 0) ? "Server shutting down: " + String.Join(" ", args.Parameters) : "Server shutting down!");

View file

@ -125,9 +125,6 @@ namespace TShockAPI
[Description("User can reload the configurations file.")] [Description("User can reload the configurations file.")]
public static readonly string cfgreload = "tshock.cfg.reload"; public static readonly string cfgreload = "tshock.cfg.reload";
[Description("User can download updates to plugins that are currently running.")]
public static readonly string updateplugins = "tshock.cfg.updateplugins";
[Description("User can create reference files of Terraria IDs and the permission matrix in the server folder.")] [Description("User can create reference files of Terraria IDs and the permission matrix in the server folder.")]
public static readonly string createdumps = "tshock.cfg.createdumps"; public static readonly string createdumps = "tshock.cfg.createdumps";

View file

@ -26,9 +26,9 @@ using System.Runtime.InteropServices;
[assembly: AssemblyTitle("TShock for Terraria")] [assembly: AssemblyTitle("TShock for Terraria")]
[assembly: AssemblyDescription("")] [assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Nyx Studios & TShock Contributors")] [assembly: AssemblyCompany("Pryaxis & TShock Contributors")]
[assembly: AssemblyProduct("TShockAPI")] [assembly: AssemblyProduct("TShockAPI")]
[assembly: AssemblyCopyright("Copyright © Nyx Studios 2011-2017")] [assembly: AssemblyCopyright("Copyright © Pryaxis & TShock Contributors 2011-2017")]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture("")]
@ -53,5 +53,5 @@ using System.Runtime.InteropServices;
// Also, be sure to release on github with the exact assembly version tag as below // 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) // so that the update manager works correctly (via the Github releases api and mimic)
[assembly: AssemblyVersion("4.3.24")] [assembly: AssemblyVersion("4.3.25")]
[assembly: AssemblyFileVersion("4.3.24")] [assembly: AssemblyFileVersion("4.3.25")]

View file

@ -205,7 +205,6 @@ namespace TShockAPI
Rest.RegisterRedirect("/server/broadcast", "/v2/server/broadcast"); Rest.RegisterRedirect("/server/broadcast", "/v2/server/broadcast");
Rest.RegisterRedirect("/server/reload", "/v2/server/reload"); Rest.RegisterRedirect("/server/reload", "/v2/server/reload");
Rest.RegisterRedirect("/server/off", "/v2/server/off"); Rest.RegisterRedirect("/server/off", "/v2/server/off");
Rest.RegisterRedirect("/server/restart", "/v3/server/restart");
Rest.RegisterRedirect("/server/rawcmd", "/v3/server/rawcmd"); Rest.RegisterRedirect("/server/rawcmd", "/v3/server/rawcmd");
//user commands //user commands
@ -247,7 +246,6 @@ namespace TShockAPI
Rest.Register(new SecureRestCommand("/v2/server/broadcast", ServerBroadcast)); Rest.Register(new SecureRestCommand("/v2/server/broadcast", ServerBroadcast));
Rest.Register(new SecureRestCommand("/v3/server/reload", ServerReload, RestPermissions.restcfg)); Rest.Register(new SecureRestCommand("/v3/server/reload", ServerReload, RestPermissions.restcfg));
Rest.Register(new SecureRestCommand("/v2/server/off", ServerOff, RestPermissions.restmaintenance)); Rest.Register(new SecureRestCommand("/v2/server/off", ServerOff, RestPermissions.restmaintenance));
Rest.Register(new SecureRestCommand("/v3/server/restart", ServerRestart, RestPermissions.restmaintenance));
Rest.Register(new SecureRestCommand("/v3/server/rawcmd", ServerCommandV3, RestPermissions.restrawcommand)); Rest.Register(new SecureRestCommand("/v3/server/rawcmd", ServerCommandV3, RestPermissions.restrawcommand));
Rest.Register(new SecureRestCommand("/tokentest", ServerTokenTest)); Rest.Register(new SecureRestCommand("/tokentest", ServerTokenTest));
@ -335,25 +333,6 @@ namespace TShockAPI
return RestResponse("The server is shutting down"); return RestResponse("The server is shutting down");
} }
[Description("Attempt to restart the server.")]
[Route("/v3/server/restart")]
[Permission(RestPermissions.restmaintenance)]
[Noun("confirm", true, "Confirm that you actually want to restart the server", typeof(bool))]
[Noun("message", false, "The shutdown message.", typeof(String))]
[Noun("nosave", false, "Shutdown without saving.", typeof(bool))]
[Token]
private object ServerRestart(RestRequestArgs args)
{
if (!GetBool(args.Parameters["confirm"], false))
return RestInvalidParam("confirm");
// Inform players the server is shutting down
var reason = string.IsNullOrWhiteSpace(args.Parameters["message"]) ? "Server is restarting" : args.Parameters["message"];
TShock.Utils.RestartServer(!GetBool(args.Parameters["nosave"], false), reason);
return RestResponse("The server is shutting down and will attempt to restart");
}
[Description("Reload config files for the server.")] [Description("Reload config files for the server.")]
[Route("/v3/server/reload")] [Route("/v3/server/reload")]
[Permission(RestPermissions.restcfg)] [Permission(RestPermissions.restcfg)]

View file

@ -522,6 +522,11 @@ namespace TShockAPI
/// <param name="args">args - The NameCollisionEventArgs object.</param> /// <param name="args">args - The NameCollisionEventArgs object.</param>
private void NetHooks_NameCollision(NameCollisionEventArgs args) private void NetHooks_NameCollision(NameCollisionEventArgs args)
{ {
if (args.Handled)
{
return;
}
string ip = Utils.GetRealIP(Netplay.Clients[args.Who].Socket.GetRemoteAddress().ToString()); string ip = Utils.GetRealIP(Netplay.Clients[args.Who].Socket.GetRemoteAddress().ToString());
var player = Players.First(p => p != null && p.Name == args.Name && p.Index != args.Who); var player = Players.First(p => p != null && p.Name == args.Name && p.Index != args.Who);

View file

@ -71,11 +71,9 @@
<Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> <Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath> <HintPath>..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference> </Reference>
<Reference Include="OTAPI, Version=1.3.4.4, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="OTAPI=">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath Condition="Exists('..\TerrariaServerAPI\TerrariaServerAPI\bin\Debug\OTAPI.dll')">..\TerrariaServerAPI\TerrariaServerAPI\bin\Debug\OTAPI.dll</HintPath> <HintPath Condition="Exists('..\TerrariaServerAPI\TerrariaServerAPI\bin\$(ConfigurationName)\OTAPI.dll')">..\TerrariaServerAPI\TerrariaServerAPI\bin\$(ConfigurationName)\OTAPI.dll</HintPath>
<HintPath Condition="Exists('..\TerrariaServerAPI\TerrariaServerAPI\bin\Release\OTAPI.dll')">..\TerrariaServerAPI\TerrariaServerAPI\bin\Release\OTAPI.dll</HintPath>
<HintPath Condition="Exists('..\TerrariaServerAPI\TerrariaServerAPI\bin\$(Configuration)\OTAPI.dll')">..\TerrariaServerAPI\TerrariaServerAPI\bin\$(Configuration)\OTAPI.dll</HintPath>
</Reference> </Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Data" /> <Reference Include="System.Data" />

View file

@ -580,24 +580,6 @@ namespace TShockAPI
Netplay.disconnect = true; Netplay.disconnect = true;
} }
/// <summary>
/// Stops the server after kicking all players with a reason message, and optionally saving the world then attempts to
/// restart it.
/// </summary>
/// <param name="save">bool perform a world save before stop (default: true)</param>
/// <param name="reason">string reason (default: "Server shutting down!")</param>
public void RestartServer(bool save = true, string reason = "Server shutting down!")
{
if (Main.ServerSideCharacter)
foreach (TSPlayer player in TShock.Players)
if (player != null && player.IsLoggedIn && !player.IgnoreActionsForClearingTrashCan)
TShock.CharacterDB.InsertPlayerData(player);
StopServer(true, reason);
System.Diagnostics.Process.Start(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase);
Environment.Exit(0);
}
/// <summary> /// <summary>
/// Reloads all configuration settings, groups, regions and raises the reload event. /// Reloads all configuration settings, groups, regions and raises the reload event.
/// </summary> /// </summary>

@ -1 +1 @@
Subproject commit e76b7d18175163cc9375361494ca6283113c4389 Subproject commit 2c25bb68fde0e2c40a32d639ff79d614d3fb1580