diff --git a/TShockAPI/Hooks/PlayerHooks.cs b/TShockAPI/Hooks/PlayerHooks.cs index 473d2d6d..b3e6b585 100644 --- a/TShockAPI/Hooks/PlayerHooks.cs +++ b/TShockAPI/Hooks/PlayerHooks.cs @@ -149,13 +149,20 @@ namespace TShockAPI.Hooks /// public TSPlayer Player { get; set; } + /// + /// The permission being checked. + /// + public string Permission { get; set; } + /// /// Initializes a new instance of the PlayerPermissionEventArgs class. /// - /// - public PlayerPermissionEventArgs(TSPlayer player) + /// The player who fired the event. + /// The permission being checked. + public PlayerPermissionEventArgs(TSPlayer player, string permission) { Player = player; + Permission = permission; } } @@ -320,12 +327,12 @@ namespace TShockAPI.Hooks /// /// The player firing the event. /// True if the event has been handled. - public static bool OnPlayerPermission(TSPlayer player) + public static bool OnPlayerPermission(TSPlayer player, string permission) { if (PlayerPermission == null) return false; - var args = new PlayerPermissionEventArgs(player); + var args = new PlayerPermissionEventArgs(player, permission); PlayerPermission(args); return args.Handled; } diff --git a/TShockAPI/TSPlayer.cs b/TShockAPI/TSPlayer.cs index 9baa358d..30e9a591 100755 --- a/TShockAPI/TSPlayer.cs +++ b/TShockAPI/TSPlayer.cs @@ -963,7 +963,7 @@ namespace TShockAPI /// True if the player has that permission. public bool HasPermission(string permission) { - if (PlayerHooks.OnPlayerPermission(this)) + if (PlayerHooks.OnPlayerPermission(this, permission)) return true; return (tempGroup != null && tempGroup.HasPermission(permission)) || Group.HasPermission(permission);