fix /tog command

This commit is contained in:
hydrant
2021-04-11 04:15:12 +02:00
parent 5ebbfb0638
commit f5c0bb4f6b
4 changed files with 36 additions and 5 deletions

View File

@@ -94,12 +94,25 @@ namespace ReallifeGamemode.Server.Services
/// </summary>
/// <param name="message">Die Nachricht, die gesendet werden soll</param>
/// <param name="minLevel">Das mindest Admin Level, das für das Erhalten dieser Nachricht benötigt wird</param>
public static void BroadcastAdmin(string message, AdminLevel minLevel)
public static void BroadcastAdmin(string message, AdminLevel minLevel, Func<Player, string> getAddInfoMessage = null, Predicate<Player> shouldSendMessage = null)
{
NAPI.Pools.GetAllPlayers().ForEach(p =>
{
if (p.GetUser()?.IsAdmin(minLevel) ?? false)
{
if(shouldSendMessage != null)
{
if(!shouldSendMessage(p))
{
return;
}
}
if(getAddInfoMessage != null)
{
message += getAddInfoMessage(p);
}
ChatService.SendMessage(p, message);
}
});