Merge branch 'general-devel' into fix_trapdoors
This commit is contained in:
commit
d864acd22f
4 changed files with 40 additions and 5 deletions
|
|
@ -2203,8 +2203,13 @@ namespace TShockAPI
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (TShock.Config.AllowCutTilesAndBreakables && Main.tileCut[Main.tile[tileX, tileY].type])
|
if (TShock.Config.AllowCutTilesAndBreakables && Main.tileCut[tile.type])
|
||||||
{
|
{
|
||||||
|
if (action == EditAction.KillWall)
|
||||||
|
{
|
||||||
|
args.Player.SendTileSquare(tileX, tileY, 1);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,6 @@ using System.ComponentModel;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Reflection.Emit;
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using HttpServer;
|
using HttpServer;
|
||||||
using Rests;
|
using Rests;
|
||||||
|
|
@ -102,12 +101,14 @@ namespace TShockAPI
|
||||||
// Server Commands
|
// Server Commands
|
||||||
if (TShock.Config.EnableTokenEndpointAuthentication)
|
if (TShock.Config.EnableTokenEndpointAuthentication)
|
||||||
{
|
{
|
||||||
|
Rest.Register(new SecureRestCommand("/status", ServerStatusRoot));
|
||||||
Rest.Register(new SecureRestCommand("/v2/server/status", ServerStatusV2));
|
Rest.Register(new SecureRestCommand("/v2/server/status", ServerStatusV2));
|
||||||
Rest.Register(new SecureRestCommand("/v3/server/motd", ServerMotd));
|
Rest.Register(new SecureRestCommand("/v3/server/motd", ServerMotd));
|
||||||
Rest.Register(new SecureRestCommand("/v3/server/rules", ServerRules));
|
Rest.Register(new SecureRestCommand("/v3/server/rules", ServerRules));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Rest.Register(new RestCommand("/status", (a) => this.ServerStatusRoot(new RestRequestArgs(a.Verbs, a.Parameters, a.Request, SecureRest.TokenData.None, a.Context))));
|
||||||
Rest.Register(new RestCommand("/v2/server/status", (a) => this.ServerStatusV2(new RestRequestArgs(a.Verbs, a.Parameters, a.Request, SecureRest.TokenData.None, a.Context))));
|
Rest.Register(new RestCommand("/v2/server/status", (a) => this.ServerStatusV2(new RestRequestArgs(a.Verbs, a.Parameters, a.Request, SecureRest.TokenData.None, a.Context))));
|
||||||
Rest.Register(new RestCommand("/v3/server/motd", (a) => this.ServerMotd(new RestRequestArgs(a.Verbs, a.Parameters, a.Request, SecureRest.TokenData.None, a.Context))));
|
Rest.Register(new RestCommand("/v3/server/motd", (a) => this.ServerMotd(new RestRequestArgs(a.Verbs, a.Parameters, a.Request, SecureRest.TokenData.None, a.Context))));
|
||||||
Rest.Register(new RestCommand("/v3/server/rules", (a) => this.ServerRules(new RestRequestArgs(a.Verbs, a.Parameters, a.Request, SecureRest.TokenData.None, a.Context))));
|
Rest.Register(new RestCommand("/v3/server/rules", (a) => this.ServerRules(new RestRequestArgs(a.Verbs, a.Parameters, a.Request, SecureRest.TokenData.None, a.Context))));
|
||||||
|
|
@ -274,6 +275,16 @@ namespace TShockAPI
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Description("Get a list of information about the current TShock server.")]
|
||||||
|
[Route("/status")]
|
||||||
|
[Token]
|
||||||
|
private object ServerStatusRoot(RestRequestArgs args)
|
||||||
|
{
|
||||||
|
RestObject status = (RestObject)ServerStatusV2(args);
|
||||||
|
status.Add("upgrade", "/v2/server/status");
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
[Description("Get a list of information about the current TShock server.")]
|
[Description("Get a list of information about the current TShock server.")]
|
||||||
[Route("/v2/server/status")]
|
[Route("/v2/server/status")]
|
||||||
[Token]
|
[Token]
|
||||||
|
|
@ -761,10 +772,11 @@ namespace TShockAPI
|
||||||
return new RestObject()
|
return new RestObject()
|
||||||
{
|
{
|
||||||
{"nickname", player.Name},
|
{"nickname", player.Name},
|
||||||
{"username", null == player.User ? "" : player.User.Name},
|
{"username", player.User?.Name},
|
||||||
{"ip", player.IP},
|
{"ip", player.IP},
|
||||||
{"group", player.Group.Name},
|
{"group", player.Group.Name},
|
||||||
{"registered", null == player.User ? "" : player.User.Registered},
|
{"registered", player.User?.Registered},
|
||||||
|
{"muted", player.mute },
|
||||||
{"position", player.TileX + "," + player.TileY},
|
{"position", player.TileX + "," + player.TileY},
|
||||||
{"inventory", string.Join(", ", inventory.Select(p => (p.name + ":" + p.stack)))},
|
{"inventory", string.Join(", ", inventory.Select(p => (p.name + ":" + p.stack)))},
|
||||||
{"armor", string.Join(", ", equipment.Select(p => (p.netID + ":" + p.prefix)))},
|
{"armor", string.Join(", ", equipment.Select(p => (p.netID + ":" + p.prefix)))},
|
||||||
|
|
|
||||||
|
|
@ -822,6 +822,7 @@ namespace TShockAPI
|
||||||
|
|
||||||
/// <summary>AuthToken - The auth token used by the /auth system to grant temporary superadmin access to new admins.</summary>
|
/// <summary>AuthToken - The auth token used by the /auth system to grant temporary superadmin access to new admins.</summary>
|
||||||
public static int AuthToken = -1;
|
public static int AuthToken = -1;
|
||||||
|
private string _cliPassword = null;
|
||||||
|
|
||||||
/// <summary>OnPostInit - Fired when the server loads a map, to perform world specific operations.</summary>
|
/// <summary>OnPostInit - Fired when the server loads a map, to perform world specific operations.</summary>
|
||||||
/// <param name="args">args - The EventArgs object.</param>
|
/// <param name="args">args - The EventArgs object.</param>
|
||||||
|
|
@ -829,6 +830,16 @@ namespace TShockAPI
|
||||||
{
|
{
|
||||||
SetConsoleTitle(false);
|
SetConsoleTitle(false);
|
||||||
|
|
||||||
|
//This is to prevent a bug where a CLI-defined password causes packets to be
|
||||||
|
//sent in an unexpected order, resulting in clients being unable to connect
|
||||||
|
if (!string.IsNullOrEmpty(Netplay.ServerPassword))
|
||||||
|
{
|
||||||
|
//CLI defined password overrides a config password
|
||||||
|
_cliPassword = Netplay.ServerPassword;
|
||||||
|
Netplay.ServerPassword = "";
|
||||||
|
Config.ServerPassword = _cliPassword;
|
||||||
|
}
|
||||||
|
|
||||||
// Disable the auth system if "auth.lck" is present or a superadmin exists
|
// Disable the auth system if "auth.lck" is present or a superadmin exists
|
||||||
if (File.Exists(Path.Combine(SavePath, "auth.lck")) || Users.GetUsers().Exists(u => u.Group == new SuperAdminGroup().Name))
|
if (File.Exists(Path.Combine(SavePath, "auth.lck")) || Users.GetUsers().Exists(u => u.Group == new SuperAdminGroup().Name))
|
||||||
{
|
{
|
||||||
|
|
@ -2172,7 +2183,14 @@ namespace TShockAPI
|
||||||
if (file.MaxSlots > 235)
|
if (file.MaxSlots > 235)
|
||||||
file.MaxSlots = 235;
|
file.MaxSlots = 235;
|
||||||
Main.maxNetPlayers = file.MaxSlots + 20;
|
Main.maxNetPlayers = file.MaxSlots + 20;
|
||||||
|
|
||||||
Netplay.ServerPassword = "";
|
Netplay.ServerPassword = "";
|
||||||
|
if (!string.IsNullOrEmpty(_cliPassword))
|
||||||
|
{
|
||||||
|
//This prevents a config reload from removing/updating a CLI-defined password
|
||||||
|
file.ServerPassword = _cliPassword;
|
||||||
|
}
|
||||||
|
|
||||||
Netplay.spamCheck = false;
|
Netplay.spamCheck = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
Subproject commit 302124e1bcf6a6661d518b84f630384a90dbcbcb
|
Subproject commit ecb3b742b795fb489f9fb6f8ee1c17667f64f85a
|
||||||
Loading…
Add table
Add a link
Reference in a new issue