Change enum names for clarity
This commit is contained in:
parent
3764527d3d
commit
685d9964f0
5 changed files with 38 additions and 38 deletions
|
|
@ -201,9 +201,9 @@ namespace TShockAPI.DB
|
||||||
if (ply.HasPermission(Permissions.usebanneditem))
|
if (ply.HasPermission(Permissions.usebanneditem))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
PermissionResult hookResult = PlayerHooks.OnPlayerItembanPermission(ply, this);
|
PermissionHookResult hookResult = PlayerHooks.OnPlayerItembanPermission(ply, this);
|
||||||
if (hookResult != PermissionResult.Inconclusive)
|
if (hookResult != PermissionHookResult.Unhandled)
|
||||||
return hookResult == PermissionResult.Granted;
|
return hookResult == PermissionHookResult.Granted;
|
||||||
|
|
||||||
var cur = ply.Group;
|
var cur = ply.Group;
|
||||||
var traversed = new List<Group>();
|
var traversed = new List<Group>();
|
||||||
|
|
|
||||||
|
|
@ -206,9 +206,9 @@ namespace TShockAPI.DB
|
||||||
if (ply.HasPermission(Permissions.canusebannedprojectiles))
|
if (ply.HasPermission(Permissions.canusebannedprojectiles))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
PermissionResult hookResult = PlayerHooks.OnPlayerProjbanPermission(ply, this);
|
PermissionHookResult hookResult = PlayerHooks.OnPlayerProjbanPermission(ply, this);
|
||||||
if (hookResult != PermissionResult.Inconclusive)
|
if (hookResult != PermissionHookResult.Unhandled)
|
||||||
return hookResult == PermissionResult.Granted;
|
return hookResult == PermissionHookResult.Granted;
|
||||||
|
|
||||||
var cur = ply.Group;
|
var cur = ply.Group;
|
||||||
var traversed = new List<Group>();
|
var traversed = new List<Group>();
|
||||||
|
|
|
||||||
|
|
@ -206,9 +206,9 @@ namespace TShockAPI.DB
|
||||||
if (ply.HasPermission(Permissions.canusebannedtiles))
|
if (ply.HasPermission(Permissions.canusebannedtiles))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
PermissionResult hookResult = PlayerHooks.OnPlayerTilebanPermission(ply, this);
|
PermissionHookResult hookResult = PlayerHooks.OnPlayerTilebanPermission(ply, this);
|
||||||
if (hookResult != PermissionResult.Inconclusive)
|
if (hookResult != PermissionHookResult.Unhandled)
|
||||||
return hookResult == PermissionResult.Granted;
|
return hookResult == PermissionHookResult.Granted;
|
||||||
|
|
||||||
var cur = ply.Group;
|
var cur = ply.Group;
|
||||||
var traversed = new List<Group>();
|
var traversed = new List<Group>();
|
||||||
|
|
|
||||||
|
|
@ -156,9 +156,9 @@ namespace TShockAPI.Hooks
|
||||||
public string Permission { get; set; }
|
public string Permission { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// <see cref="PermissionResult"/> of the hook.
|
/// <see cref="PermissionHookResult"/> of the hook.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public PermissionResult Result { get; set; }
|
public PermissionHookResult Result { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the PlayerPermissionEventArgs class.
|
/// Initializes a new instance of the PlayerPermissionEventArgs class.
|
||||||
|
|
@ -169,7 +169,7 @@ namespace TShockAPI.Hooks
|
||||||
{
|
{
|
||||||
Player = player;
|
Player = player;
|
||||||
Permission = permission;
|
Permission = permission;
|
||||||
Result = PermissionResult.Inconclusive;
|
Result = PermissionHookResult.Unhandled;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -189,9 +189,9 @@ namespace TShockAPI.Hooks
|
||||||
public ItemBan BannedItem { get; set; }
|
public ItemBan BannedItem { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// <see cref="PermissionResult"/> of the hook.
|
/// <see cref="PermissionHookResult"/> of the hook.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public PermissionResult Result { get; set; }
|
public PermissionHookResult Result { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the PlayerItembanPermissionEventArgs class.
|
/// Initializes a new instance of the PlayerItembanPermissionEventArgs class.
|
||||||
|
|
@ -202,7 +202,7 @@ namespace TShockAPI.Hooks
|
||||||
{
|
{
|
||||||
Player = player;
|
Player = player;
|
||||||
BannedItem = bannedItem;
|
BannedItem = bannedItem;
|
||||||
Result = PermissionResult.Inconclusive;
|
Result = PermissionHookResult.Unhandled;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -222,9 +222,9 @@ namespace TShockAPI.Hooks
|
||||||
public ProjectileBan BannedProjectile { get; set; }
|
public ProjectileBan BannedProjectile { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// <see cref="PermissionResult"/> of the hook.
|
/// <see cref="PermissionHookResult"/> of the hook.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public PermissionResult Result { get; set; }
|
public PermissionHookResult Result { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the PlayerProjbanPermissionEventArgs class.
|
/// Initializes a new instance of the PlayerProjbanPermissionEventArgs class.
|
||||||
|
|
@ -235,7 +235,7 @@ namespace TShockAPI.Hooks
|
||||||
{
|
{
|
||||||
Player = player;
|
Player = player;
|
||||||
BannedProjectile = checkedProjectile;
|
BannedProjectile = checkedProjectile;
|
||||||
Result = PermissionResult.Inconclusive;
|
Result = PermissionHookResult.Unhandled;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -255,9 +255,9 @@ namespace TShockAPI.Hooks
|
||||||
public TileBan BannedTile { get; set; }
|
public TileBan BannedTile { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// <see cref="PermissionResult"/> of the hook.
|
/// <see cref="PermissionHookResult"/> of the hook.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public PermissionResult Result { get; set; }
|
public PermissionHookResult Result { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the PlayerTilebanPermissionEventArgs class.
|
/// Initializes a new instance of the PlayerTilebanPermissionEventArgs class.
|
||||||
|
|
@ -268,7 +268,7 @@ namespace TShockAPI.Hooks
|
||||||
{
|
{
|
||||||
Player = player;
|
Player = player;
|
||||||
BannedTile = checkedTile;
|
BannedTile = checkedTile;
|
||||||
Result = PermissionResult.Inconclusive;
|
Result = PermissionHookResult.Unhandled;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -463,11 +463,11 @@ 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>Event result if the event has been handled, otherwise <see cref="PermissionResult.Inconclusive"/>.</returns>
|
/// <returns>Event result if the event has been handled, otherwise <see cref="PermissionHookResult.Unhandled"/>.</returns>
|
||||||
public static PermissionResult OnPlayerPermission(TSPlayer player, string permission)
|
public static PermissionHookResult OnPlayerPermission(TSPlayer player, string permission)
|
||||||
{
|
{
|
||||||
if (PlayerPermission == null)
|
if (PlayerPermission == null)
|
||||||
return PermissionResult.Inconclusive;
|
return PermissionHookResult.Unhandled;
|
||||||
|
|
||||||
var args = new PlayerPermissionEventArgs(player, permission);
|
var args = new PlayerPermissionEventArgs(player, permission);
|
||||||
PlayerPermission(args);
|
PlayerPermission(args);
|
||||||
|
|
@ -479,11 +479,11 @@ namespace TShockAPI.Hooks
|
||||||
/// 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>Event result if the event has been handled, otherwise <see cref="PermissionResult.Inconclusive"/>.</returns>
|
/// <returns>Event result if the event has been handled, otherwise <see cref="PermissionHookResult.Unhandled"/>.</returns>
|
||||||
public static PermissionResult OnPlayerItembanPermission(TSPlayer player, ItemBan bannedItem)
|
public static PermissionHookResult OnPlayerItembanPermission(TSPlayer player, ItemBan bannedItem)
|
||||||
{
|
{
|
||||||
if (PlayerItembanPermission == null)
|
if (PlayerItembanPermission == null)
|
||||||
return PermissionResult.Inconclusive;
|
return PermissionHookResult.Unhandled;
|
||||||
|
|
||||||
var args = new PlayerItembanPermissionEventArgs(player, bannedItem);
|
var args = new PlayerItembanPermissionEventArgs(player, bannedItem);
|
||||||
PlayerItembanPermission(args);
|
PlayerItembanPermission(args);
|
||||||
|
|
@ -495,11 +495,11 @@ namespace TShockAPI.Hooks
|
||||||
/// 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>Event result if the event has been handled, otherwise <see cref="PermissionResult.Inconclusive"/>.</returns>
|
/// <returns>Event result if the event has been handled, otherwise <see cref="PermissionHookResult.Unhandled"/>.</returns>
|
||||||
public static PermissionResult OnPlayerProjbanPermission(TSPlayer player, ProjectileBan bannedProj)
|
public static PermissionHookResult OnPlayerProjbanPermission(TSPlayer player, ProjectileBan bannedProj)
|
||||||
{
|
{
|
||||||
if (PlayerProjbanPermission == null)
|
if (PlayerProjbanPermission == null)
|
||||||
return PermissionResult.Inconclusive;
|
return PermissionHookResult.Unhandled;
|
||||||
|
|
||||||
var args = new PlayerProjbanPermissionEventArgs(player, bannedProj);
|
var args = new PlayerProjbanPermissionEventArgs(player, bannedProj);
|
||||||
PlayerProjbanPermission(args);
|
PlayerProjbanPermission(args);
|
||||||
|
|
@ -511,11 +511,11 @@ namespace TShockAPI.Hooks
|
||||||
/// 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>Event result if the event has been handled, otherwise <see cref="PermissionResult.Inconclusive"/>.</returns>
|
/// <returns>Event result if the event has been handled, otherwise <see cref="PermissionHookResult.Unhandled"/>.</returns>
|
||||||
public static PermissionResult OnPlayerTilebanPermission(TSPlayer player, TileBan bannedTile)
|
public static PermissionHookResult OnPlayerTilebanPermission(TSPlayer player, TileBan bannedTile)
|
||||||
{
|
{
|
||||||
if (PlayerTilebanPermission == null)
|
if (PlayerTilebanPermission == null)
|
||||||
return PermissionResult.Inconclusive;
|
return PermissionHookResult.Unhandled;
|
||||||
|
|
||||||
var args = new PlayerTilebanPermissionEventArgs(player, bannedTile);
|
var args = new PlayerTilebanPermissionEventArgs(player, bannedTile);
|
||||||
PlayerTilebanPermission(args);
|
PlayerTilebanPermission(args);
|
||||||
|
|
@ -528,10 +528,10 @@ namespace TShockAPI.Hooks
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Defines the possible outcomes of <see cref="PlayerHooks.PlayerPermission"/> handlers.
|
/// Defines the possible outcomes of <see cref="PlayerHooks.PlayerPermission"/> handlers.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public enum PermissionResult
|
public enum PermissionHookResult
|
||||||
{
|
{
|
||||||
/// <summary>Hook doesn't return a result on the permission check.</summary>
|
/// <summary>Hook doesn't return a result on the permission check.</summary>
|
||||||
Inconclusive,
|
Unhandled,
|
||||||
/// <summary>Permission is explicitly denied by a hook.</summary>
|
/// <summary>Permission is explicitly denied by a hook.</summary>
|
||||||
Denied,
|
Denied,
|
||||||
/// <summary>Permission is explicitly granted by a hook.</summary>
|
/// <summary>Permission is explicitly granted by a hook.</summary>
|
||||||
|
|
|
||||||
|
|
@ -1265,10 +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)
|
||||||
{
|
{
|
||||||
PermissionResult hookResult = PlayerHooks.OnPlayerPermission(this, permission);
|
PermissionHookResult hookResult = PlayerHooks.OnPlayerPermission(this, permission);
|
||||||
|
|
||||||
if (hookResult != PermissionResult.Inconclusive)
|
if (hookResult != PermissionHookResult.Unhandled)
|
||||||
return hookResult == PermissionResult.Granted;
|
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