From 685d9964f0be1e36ace592e655f69cf416abaf66 Mon Sep 17 00:00:00 2001 From: Ruby Rose Date: Wed, 12 Jul 2017 08:47:27 +0300 Subject: [PATCH] Change enum names for clarity --- TShockAPI/DB/ItemManager.cs | 6 ++-- TShockAPI/DB/ProjectileManager.cs | 6 ++-- TShockAPI/DB/TileManager.cs | 6 ++-- TShockAPI/Hooks/PlayerHooks.cs | 52 +++++++++++++++---------------- TShockAPI/TSPlayer.cs | 6 ++-- 5 files changed, 38 insertions(+), 38 deletions(-) diff --git a/TShockAPI/DB/ItemManager.cs b/TShockAPI/DB/ItemManager.cs index 54ae8ee5..c3d92840 100644 --- a/TShockAPI/DB/ItemManager.cs +++ b/TShockAPI/DB/ItemManager.cs @@ -201,9 +201,9 @@ namespace TShockAPI.DB if (ply.HasPermission(Permissions.usebanneditem)) return true; - PermissionResult hookResult = PlayerHooks.OnPlayerItembanPermission(ply, this); - if (hookResult != PermissionResult.Inconclusive) - return hookResult == PermissionResult.Granted; + PermissionHookResult hookResult = PlayerHooks.OnPlayerItembanPermission(ply, this); + if (hookResult != PermissionHookResult.Unhandled) + return hookResult == PermissionHookResult.Granted; var cur = ply.Group; var traversed = new List(); diff --git a/TShockAPI/DB/ProjectileManager.cs b/TShockAPI/DB/ProjectileManager.cs index 234d3cca..4214fce6 100644 --- a/TShockAPI/DB/ProjectileManager.cs +++ b/TShockAPI/DB/ProjectileManager.cs @@ -206,9 +206,9 @@ namespace TShockAPI.DB if (ply.HasPermission(Permissions.canusebannedprojectiles)) return true; - PermissionResult hookResult = PlayerHooks.OnPlayerProjbanPermission(ply, this); - if (hookResult != PermissionResult.Inconclusive) - return hookResult == PermissionResult.Granted; + PermissionHookResult hookResult = PlayerHooks.OnPlayerProjbanPermission(ply, this); + if (hookResult != PermissionHookResult.Unhandled) + return hookResult == PermissionHookResult.Granted; var cur = ply.Group; var traversed = new List(); diff --git a/TShockAPI/DB/TileManager.cs b/TShockAPI/DB/TileManager.cs index 83b079ab..c291b21a 100644 --- a/TShockAPI/DB/TileManager.cs +++ b/TShockAPI/DB/TileManager.cs @@ -206,9 +206,9 @@ namespace TShockAPI.DB if (ply.HasPermission(Permissions.canusebannedtiles)) return true; - PermissionResult hookResult = PlayerHooks.OnPlayerTilebanPermission(ply, this); - if (hookResult != PermissionResult.Inconclusive) - return hookResult == PermissionResult.Granted; + PermissionHookResult hookResult = PlayerHooks.OnPlayerTilebanPermission(ply, this); + if (hookResult != PermissionHookResult.Unhandled) + return hookResult == PermissionHookResult.Granted; var cur = ply.Group; var traversed = new List(); diff --git a/TShockAPI/Hooks/PlayerHooks.cs b/TShockAPI/Hooks/PlayerHooks.cs index 6e3db3d5..91f9612c 100644 --- a/TShockAPI/Hooks/PlayerHooks.cs +++ b/TShockAPI/Hooks/PlayerHooks.cs @@ -156,9 +156,9 @@ namespace TShockAPI.Hooks public string Permission { get; set; } /// - /// of the hook. + /// of the hook. /// - public PermissionResult Result { get; set; } + public PermissionHookResult Result { get; set; } /// /// Initializes a new instance of the PlayerPermissionEventArgs class. @@ -169,7 +169,7 @@ namespace TShockAPI.Hooks { Player = player; Permission = permission; - Result = PermissionResult.Inconclusive; + Result = PermissionHookResult.Unhandled; } } @@ -189,9 +189,9 @@ namespace TShockAPI.Hooks public ItemBan BannedItem { get; set; } /// - /// of the hook. + /// of the hook. /// - public PermissionResult Result { get; set; } + public PermissionHookResult Result { get; set; } /// /// Initializes a new instance of the PlayerItembanPermissionEventArgs class. @@ -202,7 +202,7 @@ namespace TShockAPI.Hooks { Player = player; BannedItem = bannedItem; - Result = PermissionResult.Inconclusive; + Result = PermissionHookResult.Unhandled; } } @@ -222,9 +222,9 @@ namespace TShockAPI.Hooks public ProjectileBan BannedProjectile { get; set; } /// - /// of the hook. + /// of the hook. /// - public PermissionResult Result { get; set; } + public PermissionHookResult Result { get; set; } /// /// Initializes a new instance of the PlayerProjbanPermissionEventArgs class. @@ -235,7 +235,7 @@ namespace TShockAPI.Hooks { Player = player; BannedProjectile = checkedProjectile; - Result = PermissionResult.Inconclusive; + Result = PermissionHookResult.Unhandled; } } @@ -255,9 +255,9 @@ namespace TShockAPI.Hooks public TileBan BannedTile { get; set; } /// - /// of the hook. + /// of the hook. /// - public PermissionResult Result { get; set; } + public PermissionHookResult Result { get; set; } /// /// Initializes a new instance of the PlayerTilebanPermissionEventArgs class. @@ -268,7 +268,7 @@ namespace TShockAPI.Hooks { Player = player; BannedTile = checkedTile; - Result = PermissionResult.Inconclusive; + Result = PermissionHookResult.Unhandled; } } @@ -463,11 +463,11 @@ namespace TShockAPI.Hooks /// Fires the event. /// /// The player firing the event. - /// Event result if the event has been handled, otherwise . - public static PermissionResult OnPlayerPermission(TSPlayer player, string permission) + /// Event result if the event has been handled, otherwise . + public static PermissionHookResult OnPlayerPermission(TSPlayer player, string permission) { if (PlayerPermission == null) - return PermissionResult.Inconclusive; + return PermissionHookResult.Unhandled; var args = new PlayerPermissionEventArgs(player, permission); PlayerPermission(args); @@ -479,11 +479,11 @@ namespace TShockAPI.Hooks /// Fires the event. /// /// The player firing the event. - /// Event result if the event has been handled, otherwise . - public static PermissionResult OnPlayerItembanPermission(TSPlayer player, ItemBan bannedItem) + /// Event result if the event has been handled, otherwise . + public static PermissionHookResult OnPlayerItembanPermission(TSPlayer player, ItemBan bannedItem) { if (PlayerItembanPermission == null) - return PermissionResult.Inconclusive; + return PermissionHookResult.Unhandled; var args = new PlayerItembanPermissionEventArgs(player, bannedItem); PlayerItembanPermission(args); @@ -495,11 +495,11 @@ namespace TShockAPI.Hooks /// Fires the event. /// /// The player firing the event. - /// Event result if the event has been handled, otherwise . - public static PermissionResult OnPlayerProjbanPermission(TSPlayer player, ProjectileBan bannedProj) + /// Event result if the event has been handled, otherwise . + public static PermissionHookResult OnPlayerProjbanPermission(TSPlayer player, ProjectileBan bannedProj) { if (PlayerProjbanPermission == null) - return PermissionResult.Inconclusive; + return PermissionHookResult.Unhandled; var args = new PlayerProjbanPermissionEventArgs(player, bannedProj); PlayerProjbanPermission(args); @@ -511,11 +511,11 @@ namespace TShockAPI.Hooks /// Fires the event. /// /// The player firing the event. - /// Event result if the event has been handled, otherwise . - public static PermissionResult OnPlayerTilebanPermission(TSPlayer player, TileBan bannedTile) + /// Event result if the event has been handled, otherwise . + public static PermissionHookResult OnPlayerTilebanPermission(TSPlayer player, TileBan bannedTile) { if (PlayerTilebanPermission == null) - return PermissionResult.Inconclusive; + return PermissionHookResult.Unhandled; var args = new PlayerTilebanPermissionEventArgs(player, bannedTile); PlayerTilebanPermission(args); @@ -528,10 +528,10 @@ namespace TShockAPI.Hooks /// /// Defines the possible outcomes of handlers. /// - public enum PermissionResult + public enum PermissionHookResult { /// Hook doesn't return a result on the permission check. - Inconclusive, + Unhandled, /// Permission is explicitly denied by a hook. Denied, /// Permission is explicitly granted by a hook. diff --git a/TShockAPI/TSPlayer.cs b/TShockAPI/TSPlayer.cs index 930c587b..8f7b831e 100644 --- a/TShockAPI/TSPlayer.cs +++ b/TShockAPI/TSPlayer.cs @@ -1265,10 +1265,10 @@ namespace TShockAPI /// True if the player has that permission. public bool HasPermission(string permission) { - PermissionResult hookResult = PlayerHooks.OnPlayerPermission(this, permission); + PermissionHookResult hookResult = PlayerHooks.OnPlayerPermission(this, permission); - if (hookResult != PermissionResult.Inconclusive) - return hookResult == PermissionResult.Granted; + if (hookResult != PermissionHookResult.Unhandled) + return hookResult == PermissionHookResult.Granted; if (tempGroup != null) return tempGroup.HasPermission(permission);