Merge branch 'general-devel' into validateplaceobject
This commit is contained in:
commit
3b32774a0d
7 changed files with 157 additions and 67 deletions
|
|
@ -10,6 +10,7 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin
|
||||||
* Validated tile placement on PlaceObject; clients can no longer place frames, paintings etc with dirt blocks (@bartico6, @ProfessorXZ)
|
* Validated tile placement on PlaceObject; clients can no longer place frames, paintings etc with dirt blocks (@bartico6, @ProfessorXZ)
|
||||||
|
|
||||||
## TShock 4.3.24
|
## TShock 4.3.24
|
||||||
|
* API: Changed `PlayerHooks` permission hook mechanisms to allow negation from hooks (@deadsurgeon42)
|
||||||
* Updated OpenTerraria API to 1.3.5.3 (@DeathCradle)
|
* Updated OpenTerraria API to 1.3.5.3 (@DeathCradle)
|
||||||
* Updated Terraria Server API to 1.3.5.3 (@WhiteXZ, @hakusaro)
|
* Updated Terraria Server API to 1.3.5.3 (@WhiteXZ, @hakusaro)
|
||||||
* Updated TShock core components to 1.3.5.3 (@hakusaro)
|
* Updated TShock core components to 1.3.5.3 (@hakusaro)
|
||||||
|
|
|
||||||
|
|
@ -201,8 +201,9 @@ namespace TShockAPI.DB
|
||||||
if (ply.HasPermission(Permissions.usebanneditem))
|
if (ply.HasPermission(Permissions.usebanneditem))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (PlayerHooks.OnPlayerItembanPermission(ply, this))
|
PermissionHookResult hookResult = PlayerHooks.OnPlayerItembanPermission(ply, this);
|
||||||
return true;
|
if (hookResult != PermissionHookResult.Unhandled)
|
||||||
|
return hookResult == PermissionHookResult.Granted;
|
||||||
|
|
||||||
var cur = ply.Group;
|
var cur = ply.Group;
|
||||||
var traversed = new List<Group>();
|
var traversed = new List<Group>();
|
||||||
|
|
|
||||||
|
|
@ -206,8 +206,9 @@ namespace TShockAPI.DB
|
||||||
if (ply.HasPermission(Permissions.canusebannedprojectiles))
|
if (ply.HasPermission(Permissions.canusebannedprojectiles))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (PlayerHooks.OnPlayerProjbanPermission(ply, this))
|
PermissionHookResult hookResult = PlayerHooks.OnPlayerProjbanPermission(ply, this);
|
||||||
return true;
|
if (hookResult != PermissionHookResult.Unhandled)
|
||||||
|
return hookResult == PermissionHookResult.Granted;
|
||||||
|
|
||||||
var cur = ply.Group;
|
var cur = ply.Group;
|
||||||
var traversed = new List<Group>();
|
var traversed = new List<Group>();
|
||||||
|
|
|
||||||
|
|
@ -206,8 +206,9 @@ namespace TShockAPI.DB
|
||||||
if (ply.HasPermission(Permissions.canusebannedtiles))
|
if (ply.HasPermission(Permissions.canusebannedtiles))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (PlayerHooks.OnPlayerTilebanPermission(ply, this))
|
PermissionHookResult hookResult = PlayerHooks.OnPlayerTilebanPermission(ply, this);
|
||||||
return true;
|
if (hookResult != PermissionHookResult.Unhandled)
|
||||||
|
return hookResult == PermissionHookResult.Granted;
|
||||||
|
|
||||||
var cur = ply.Group;
|
var cur = ply.Group;
|
||||||
var traversed = new List<Group>();
|
var traversed = new List<Group>();
|
||||||
|
|
|
||||||
|
|
@ -143,7 +143,7 @@ namespace TShockAPI.Hooks
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// EventArgs used for the <see cref="PlayerHooks.PlayerPermission"/> event.
|
/// EventArgs used for the <see cref="PlayerHooks.PlayerPermission"/> event.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class PlayerPermissionEventArgs : HandledEventArgs
|
public class PlayerPermissionEventArgs
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The player who fired the event.
|
/// The player who fired the event.
|
||||||
|
|
@ -155,6 +155,11 @@ namespace TShockAPI.Hooks
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Permission { get; set; }
|
public string Permission { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// <see cref="PermissionHookResult"/> of the hook.
|
||||||
|
/// </summary>
|
||||||
|
public PermissionHookResult Result { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the PlayerPermissionEventArgs class.
|
/// Initializes a new instance of the PlayerPermissionEventArgs class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -164,13 +169,14 @@ namespace TShockAPI.Hooks
|
||||||
{
|
{
|
||||||
Player = player;
|
Player = player;
|
||||||
Permission = permission;
|
Permission = permission;
|
||||||
|
Result = PermissionHookResult.Unhandled;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// EventArgs used for the <see cref="PlayerHooks.PlayerItembanPermission"/> event.
|
/// EventArgs used for the <see cref="PlayerHooks.PlayerItembanPermission"/> event.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class PlayerItembanPermissionEventArgs : HandledEventArgs
|
public class PlayerItembanPermissionEventArgs
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The player who fired the event.
|
/// The player who fired the event.
|
||||||
|
|
@ -182,22 +188,28 @@ namespace TShockAPI.Hooks
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ItemBan BannedItem { get; set; }
|
public ItemBan BannedItem { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// <see cref="PermissionHookResult"/> of the hook.
|
||||||
|
/// </summary>
|
||||||
|
public PermissionHookResult Result { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the PlayerItembanPermissionEventArgs class.
|
/// Initializes a new instance of the PlayerItembanPermissionEventArgs class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="player">The player who fired the event.</param>
|
/// <param name="player">The player who fired the event.</param>
|
||||||
/// <param name="permission">The permission being checked.</param>
|
/// <param name="bannedItem">The banned item being checked.</param>
|
||||||
public PlayerItembanPermissionEventArgs(TSPlayer player, ItemBan bannedItem)
|
public PlayerItembanPermissionEventArgs(TSPlayer player, ItemBan bannedItem)
|
||||||
{
|
{
|
||||||
Player = player;
|
Player = player;
|
||||||
BannedItem = bannedItem;
|
BannedItem = bannedItem;
|
||||||
|
Result = PermissionHookResult.Unhandled;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// EventArgs used for the <see cref="PlayerHooks.PlayerProjbanPermission"/> event.
|
/// EventArgs used for the <see cref="PlayerHooks.PlayerProjbanPermission"/> event.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class PlayerProjbanPermissionEventArgs : HandledEventArgs
|
public class PlayerProjbanPermissionEventArgs
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The player who fired the event.
|
/// The player who fired the event.
|
||||||
|
|
@ -209,6 +221,11 @@ namespace TShockAPI.Hooks
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ProjectileBan BannedProjectile { get; set; }
|
public ProjectileBan BannedProjectile { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// <see cref="PermissionHookResult"/> of the hook.
|
||||||
|
/// </summary>
|
||||||
|
public PermissionHookResult Result { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the PlayerProjbanPermissionEventArgs class.
|
/// Initializes a new instance of the PlayerProjbanPermissionEventArgs class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -218,13 +235,14 @@ namespace TShockAPI.Hooks
|
||||||
{
|
{
|
||||||
Player = player;
|
Player = player;
|
||||||
BannedProjectile = checkedProjectile;
|
BannedProjectile = checkedProjectile;
|
||||||
|
Result = PermissionHookResult.Unhandled;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// EventArgs used for the <see cref="PlayerHooks.PlayerTilebanPermission"/> event.
|
/// EventArgs used for the <see cref="PlayerHooks.PlayerTilebanPermission"/> event.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class PlayerTilebanPermissionEventArgs : HandledEventArgs
|
public class PlayerTilebanPermissionEventArgs
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The player who fired the event.
|
/// The player who fired the event.
|
||||||
|
|
@ -236,6 +254,11 @@ namespace TShockAPI.Hooks
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public TileBan BannedTile { get; set; }
|
public TileBan BannedTile { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// <see cref="PermissionHookResult"/> of the hook.
|
||||||
|
/// </summary>
|
||||||
|
public PermissionHookResult Result { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the PlayerTilebanPermissionEventArgs class.
|
/// Initializes a new instance of the PlayerTilebanPermissionEventArgs class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -245,6 +268,7 @@ namespace TShockAPI.Hooks
|
||||||
{
|
{
|
||||||
Player = player;
|
Player = player;
|
||||||
BannedTile = checkedTile;
|
BannedTile = checkedTile;
|
||||||
|
Result = PermissionHookResult.Unhandled;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -439,60 +463,79 @@ namespace TShockAPI.Hooks
|
||||||
/// Fires the <see cref="PlayerPermission"/> event.
|
/// Fires the <see cref="PlayerPermission"/> event.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="player">The player firing the event.</param>
|
/// <param name="player">The player firing the event.</param>
|
||||||
/// <returns>True if the event has been handled.</returns>
|
/// <returns>Event result if the event has been handled, otherwise <see cref="PermissionHookResult.Unhandled"/>.</returns>
|
||||||
public static bool OnPlayerPermission(TSPlayer player, string permission)
|
public static PermissionHookResult OnPlayerPermission(TSPlayer player, string permission)
|
||||||
{
|
{
|
||||||
if (PlayerPermission == null)
|
if (PlayerPermission == null)
|
||||||
return false;
|
return PermissionHookResult.Unhandled;
|
||||||
|
|
||||||
var args = new PlayerPermissionEventArgs(player, permission);
|
var args = new PlayerPermissionEventArgs(player, permission);
|
||||||
PlayerPermission(args);
|
PlayerPermission(args);
|
||||||
return args.Handled;
|
|
||||||
|
return args.Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Fires the <see cref="PlayerItembanPermission"/> event.
|
/// Fires the <see cref="PlayerItembanPermission"/> event.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="player">The player firing the event.</param>
|
/// <param name="player">The player firing the event.</param>
|
||||||
/// <returns>True if the event has been handled.</returns>
|
/// <returns>Event result if the event has been handled, otherwise <see cref="PermissionHookResult.Unhandled"/>.</returns>
|
||||||
public static bool OnPlayerItembanPermission(TSPlayer player, ItemBan bannedItem)
|
public static PermissionHookResult OnPlayerItembanPermission(TSPlayer player, ItemBan bannedItem)
|
||||||
{
|
{
|
||||||
if (PlayerItembanPermission == null)
|
if (PlayerItembanPermission == null)
|
||||||
return false;
|
return PermissionHookResult.Unhandled;
|
||||||
|
|
||||||
var args = new PlayerItembanPermissionEventArgs(player, bannedItem);
|
var args = new PlayerItembanPermissionEventArgs(player, bannedItem);
|
||||||
PlayerItembanPermission(args);
|
PlayerItembanPermission(args);
|
||||||
return args.Handled;
|
|
||||||
|
return args.Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Fires the <see cref="PlayerProjbanPermission"/> event.
|
/// Fires the <see cref="PlayerProjbanPermission"/> event.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="player">The player firing the event.</param>
|
/// <param name="player">The player firing the event.</param>
|
||||||
/// <returns>True if the event has been handled.</returns>
|
/// <returns>Event result if the event has been handled, otherwise <see cref="PermissionHookResult.Unhandled"/>.</returns>
|
||||||
public static bool OnPlayerProjbanPermission(TSPlayer player, ProjectileBan bannedProj)
|
public static PermissionHookResult OnPlayerProjbanPermission(TSPlayer player, ProjectileBan bannedProj)
|
||||||
{
|
{
|
||||||
if (PlayerProjbanPermission == null)
|
if (PlayerProjbanPermission == null)
|
||||||
return false;
|
return PermissionHookResult.Unhandled;
|
||||||
|
|
||||||
var args = new PlayerProjbanPermissionEventArgs(player, bannedProj);
|
var args = new PlayerProjbanPermissionEventArgs(player, bannedProj);
|
||||||
PlayerProjbanPermission(args);
|
PlayerProjbanPermission(args);
|
||||||
return args.Handled;
|
|
||||||
|
return args.Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Fires the <see cref="PlayerTilebanPermission"/> event.
|
/// Fires the <see cref="PlayerTilebanPermission"/> event.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="player">The player firing the event.</param>
|
/// <param name="player">The player firing the event.</param>
|
||||||
/// <returns>True if the event has been handled.</returns>
|
/// <returns>Event result if the event has been handled, otherwise <see cref="PermissionHookResult.Unhandled"/>.</returns>
|
||||||
public static bool OnPlayerTilebanPermission(TSPlayer player, TileBan bannedTile)
|
public static PermissionHookResult OnPlayerTilebanPermission(TSPlayer player, TileBan bannedTile)
|
||||||
{
|
{
|
||||||
if (PlayerTilebanPermission == null)
|
if (PlayerTilebanPermission == null)
|
||||||
return false;
|
return PermissionHookResult.Unhandled;
|
||||||
|
|
||||||
var args = new PlayerTilebanPermissionEventArgs(player, bannedTile);
|
var args = new PlayerTilebanPermissionEventArgs(player, bannedTile);
|
||||||
PlayerTilebanPermission(args);
|
PlayerTilebanPermission(args);
|
||||||
return args.Handled;
|
|
||||||
|
return args.Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Defines the possible outcomes of <see cref="PlayerHooks.PlayerPermission"/> handlers.
|
||||||
|
/// </summary>
|
||||||
|
public enum PermissionHookResult
|
||||||
|
{
|
||||||
|
/// <summary>Hook doesn't return a result on the permission check.</summary>
|
||||||
|
Unhandled,
|
||||||
|
/// <summary>Permission is explicitly denied by a hook.</summary>
|
||||||
|
Denied,
|
||||||
|
/// <summary>Permission is explicitly granted by a hook.</summary>
|
||||||
|
Granted
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,11 +22,13 @@ using System.Threading;
|
||||||
using System.Web;
|
using System.Web;
|
||||||
using TerrariaApi.Server;
|
using TerrariaApi.Server;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
using System.Linq;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using TShockAPI.Extensions;
|
using TShockAPI.Extensions;
|
||||||
|
|
||||||
|
|
||||||
namespace TShockAPI
|
namespace TShockAPI
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -52,10 +54,11 @@ namespace TShockAPI
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool OptOut = false;
|
public bool OptOut = false;
|
||||||
|
|
||||||
|
private PluginItem[] plugins;
|
||||||
|
|
||||||
private long totalMem = 0;
|
private long totalMem = 0;
|
||||||
private string serverId = "";
|
private string serverId = "";
|
||||||
private HttpClient _client;
|
private HttpClient _client;
|
||||||
|
|
||||||
private const string TrackerUrl = "http://stats.tshock.co/submit/{0}";
|
private const string TrackerUrl = "http://stats.tshock.co/submit/{0}";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -103,11 +106,9 @@ namespace TShockAPI
|
||||||
private async Task SendUpdateAsync()
|
private async Task SendUpdateAsync()
|
||||||
{
|
{
|
||||||
JsonData data = PrepareJsonData();
|
JsonData data = PrepareJsonData();
|
||||||
|
|
||||||
var serialized = Newtonsoft.Json.JsonConvert.SerializeObject(data);
|
var serialized = Newtonsoft.Json.JsonConvert.SerializeObject(data);
|
||||||
var encoded = HttpUtility.UrlEncode(serialized);
|
var encoded = HttpUtility.UrlEncode(serialized);
|
||||||
var uri = String.Format(TrackerUrl, encoded);
|
var uri = string.Format(TrackerUrl, encoded);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
HttpResponseMessage msg = await _client.GetAsync(uri);
|
HttpResponseMessage msg = await _client.GetAsync(uri);
|
||||||
|
|
@ -139,50 +140,82 @@ namespace TShockAPI
|
||||||
|
|
||||||
private JsonData PrepareJsonData()
|
private JsonData PrepareJsonData()
|
||||||
{
|
{
|
||||||
if (ServerApi.RunningMono)
|
return new JsonData()
|
||||||
{
|
|
||||||
if (totalMem == 0)
|
|
||||||
{
|
|
||||||
//Only do this if we haven't already cached the total physicaly memory
|
|
||||||
var pc = new PerformanceCounter("Mono Memory", "Total Physical Memory");
|
|
||||||
totalMem = (pc.RawValue / 1024 / 1024 / 1024);
|
|
||||||
}
|
|
||||||
|
|
||||||
return new JsonData
|
|
||||||
{
|
{
|
||||||
port = Terraria.Netplay.ListenPort,
|
port = Terraria.Netplay.ListenPort,
|
||||||
currentPlayers = TShock.Utils.ActivePlayers(),
|
currentPlayers = TShock.Utils.ActivePlayers(),
|
||||||
maxPlayers = TShock.Config.MaxSlots,
|
maxPlayers = TShock.Config.MaxSlots,
|
||||||
systemRam = totalMem,
|
systemRam = GetTotalSystemRam(ServerApi.RunningMono),
|
||||||
version = TShock.VersionNum.ToString(),
|
version = TShock.VersionNum.ToString(),
|
||||||
terrariaVersion = Terraria.Main.versionNumber2,
|
terrariaVersion = Terraria.Main.versionNumber2,
|
||||||
providerId = ProviderToken,
|
providerId = ProviderToken,
|
||||||
serverId = serverId,
|
serverId = serverId,
|
||||||
mono = true
|
mono = ServerApi.RunningMono,
|
||||||
|
ignorePluginVersion = ServerApi.IgnoreVersion,
|
||||||
|
loadedPlugins = GetLoadedPlugins()
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (totalMem == 0)
|
private PluginItem[] GetLoadedPlugins()
|
||||||
|
{
|
||||||
|
if (plugins != null)
|
||||||
|
{
|
||||||
|
return plugins;//Return early
|
||||||
|
}
|
||||||
|
|
||||||
|
plugins = new PluginItem[ServerApi.Plugins.Count];//Initialize with enough room to store the ammount of plugins loaded.
|
||||||
|
for (var i = 0; i < ServerApi.Plugins.Count; i++)
|
||||||
|
{
|
||||||
|
var pluginItem = new PluginItem();
|
||||||
|
var apiAttribute = (ApiVersionAttribute)ServerApi.Plugins[i].Plugin.GetType().GetCustomAttributes(typeof(ApiVersionAttribute), false).FirstOrDefault();
|
||||||
|
//The current implementation of loading plugins doesn't allow for a plugin to be loaded without an ApiVersion, the UNKNOWN is there incase a change is made to allow it
|
||||||
|
pluginItem.apiVersion = apiAttribute?.ApiVersion.ToString() ?? "UNKNOWN";
|
||||||
|
pluginItem.name = ServerApi.Plugins[i].Plugin.Name;
|
||||||
|
pluginItem.version = ServerApi.Plugins[i].Plugin.Version.ToString();
|
||||||
|
plugins[i] = pluginItem;
|
||||||
|
}
|
||||||
|
return plugins;
|
||||||
|
}
|
||||||
|
|
||||||
|
private long GetTotalSystemRam(bool isMono)
|
||||||
|
{
|
||||||
|
if (totalMem != 0)
|
||||||
|
{
|
||||||
|
return totalMem;//Return early
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isMono)//Set totalMem so it can be returned later
|
||||||
|
{
|
||||||
|
var pc = new PerformanceCounter("Mono Memory", "Total Physical Memory");
|
||||||
|
totalMem = (pc.RawValue / 1024 / 1024 / 1024);
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
//Again, only call this if it hasn't previously been cached
|
|
||||||
GetPhysicallyInstalledSystemMemory(out totalMem);
|
GetPhysicallyInstalledSystemMemory(out totalMem);
|
||||||
totalMem = (totalMem / 1024 / 1024); // Super hardcore maths to convert to Gb from Kb
|
totalMem = (totalMem / 1024 / 1024); // Super hardcore maths to convert to Gb from Kb
|
||||||
}
|
}
|
||||||
|
|
||||||
return new JsonData
|
return totalMem;
|
||||||
{
|
|
||||||
port = Terraria.Netplay.ListenPort,
|
|
||||||
currentPlayers = TShock.Utils.ActivePlayers(),
|
|
||||||
maxPlayers = TShock.Config.MaxSlots,
|
|
||||||
systemRam = totalMem,
|
|
||||||
version = TShock.VersionNum.ToString(),
|
|
||||||
terrariaVersion = Terraria.Main.versionNumber2,
|
|
||||||
providerId = ProviderToken,
|
|
||||||
serverId = serverId,
|
|
||||||
mono = false
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Holding information regarding loaded plugins
|
||||||
|
/// </summary>
|
||||||
|
public struct PluginItem
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Plugin name
|
||||||
|
/// </summary>
|
||||||
|
public string name;
|
||||||
|
/// <summary>
|
||||||
|
/// Assembly version
|
||||||
|
/// </summary>
|
||||||
|
public string version;
|
||||||
|
/// <summary>
|
||||||
|
/// Api version or UNKNOWN if attribute is missing, which is currently impossible
|
||||||
|
/// </summary>
|
||||||
|
public string apiVersion;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Contains JSON-Serializable information about a server
|
/// Contains JSON-Serializable information about a server
|
||||||
|
|
@ -210,6 +243,14 @@ namespace TShockAPI
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string version;
|
public string version;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
/// Whether or not server was started with --ignoreversion
|
||||||
|
/// </summary>
|
||||||
|
public bool ignorePluginVersion;
|
||||||
|
/// <summary>
|
||||||
|
/// List of loaded plugins and version name:
|
||||||
|
/// </summary>
|
||||||
|
public PluginItem[] loadedPlugins;
|
||||||
|
/// <summary>
|
||||||
/// The Terraria version supported by the server
|
/// The Terraria version supported by the server
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string terrariaVersion;
|
public string terrariaVersion;
|
||||||
|
|
|
||||||
|
|
@ -1265,8 +1265,10 @@ namespace TShockAPI
|
||||||
/// <returns>True if the player has that permission.</returns>
|
/// <returns>True if the player has that permission.</returns>
|
||||||
public bool HasPermission(string permission)
|
public bool HasPermission(string permission)
|
||||||
{
|
{
|
||||||
if (PlayerHooks.OnPlayerPermission(this, permission))
|
PermissionHookResult hookResult = PlayerHooks.OnPlayerPermission(this, permission);
|
||||||
return true;
|
|
||||||
|
if (hookResult != PermissionHookResult.Unhandled)
|
||||||
|
return hookResult == PermissionHookResult.Granted;
|
||||||
|
|
||||||
if (tempGroup != null)
|
if (tempGroup != null)
|
||||||
return tempGroup.HasPermission(permission);
|
return tempGroup.HasPermission(permission);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue