diff --git a/EXILED/Exiled.CustomItems/Commands/Give.cs b/EXILED/Exiled.CustomItems/Commands/Give.cs index cf228ca56..0f02dace3 100644 --- a/EXILED/Exiled.CustomItems/Commands/Give.cs +++ b/EXILED/Exiled.CustomItems/Commands/Give.cs @@ -18,6 +18,8 @@ namespace Exiled.CustomItems.Commands using Exiled.Permissions.Extensions; using RemoteAdmin; + using UnityStandardAssets.Effects; + using Utils; /// /// The command to give a player an item. @@ -97,22 +99,27 @@ public bool Execute(ArraySegment arguments, ICommandSender sender, out s response = $"Custom item {item?.Name} given to all players who can receive them ({eligiblePlayers.Count} players)"; return true; default: - if (Player.Get(identifier) is not { } player) - { - response = $"Unable to find player: {identifier}."; - return false; - } + break; + } - if (!CheckEligible(player)) - { - response = "Player cannot receive custom items!"; - return false; - } + IEnumerable list = Player.GetProcessedData(arguments, 1); + + if (list.IsEmpty()) + { + response = "Cannot find player! Try using the player ID!"; + return false; + } + foreach (Player player in list) + { + if (CheckEligible(player)) + { item?.Give(player); - response = $"{item?.Name} given to {player.Nickname} ({player.UserId})"; - return true; + } } + + response = $"{item?.Name} given to {list.Count()} players!"; + return true; } /// @@ -120,4 +127,4 @@ public bool Execute(ArraySegment arguments, ICommandSender sender, out s /// private bool CheckEligible(Player player) => player.IsAlive && !player.IsCuffed && (player.Items.Count < 8); } -} \ No newline at end of file +} diff --git a/EXILED/Exiled.CustomRoles/Commands/Give.cs b/EXILED/Exiled.CustomRoles/Commands/Give.cs index f69ab08ad..b61e6d56a 100644 --- a/EXILED/Exiled.CustomRoles/Commands/Give.cs +++ b/EXILED/Exiled.CustomRoles/Commands/Give.cs @@ -19,6 +19,7 @@ namespace Exiled.CustomRoles.Commands using Exiled.Permissions.Extensions; using RemoteAdmin; + using Utils; /// /// The command to give a role to player(s). @@ -96,16 +97,24 @@ public bool Execute(ArraySegment arguments, ICommandSender sender, out s ListPool.Pool.Return(players); return true; default: - if (Player.Get(identifier) is not Player ply) - { - response = $"Unable to find a player: {identifier}"; - return false; - } - - role.AddRole(ply); - response = $"{role.Name} given to {ply.Nickname}."; - return true; + break; + } + + IEnumerable list = Player.GetProcessedData(arguments, 1); + if (list.IsEmpty()) + { + response = "Cannot find player! Try using the player ID!"; + return false; } + + foreach (Player player in list) + { + role.AddRole(player); + } + + response = $"Customrole {role.Name} given to {list.Count()} players!"; + + return true; } catch (Exception e) {