diff --git a/ReallifeGamemode.Server/Commands/AdminCommands.cs b/ReallifeGamemode.Server/Commands/AdminCommands.cs index 8706a6b4..87a22942 100644 --- a/ReallifeGamemode.Server/Commands/AdminCommands.cs +++ b/ReallifeGamemode.Server/Commands/AdminCommands.cs @@ -240,6 +240,29 @@ namespace ReallifeGamemode.Server.Commands player.SendNotification("~g~[Info]~w~ Connect-Logs werden nun angezeigt."); } break; + case "d": + if (player.HasData("togd")) + { + player.ResetData("togd"); + player.SendNotification("~g~[Info]~w~ D-Chat wird nun ausgeblendet."); + } + else + { + player.SetData("togd", true); + player.SendNotification("~g~[Info]~w~ D-Chat wird nun angezeigt."); + } + case "ga": + if (player.HasData("togga")) + { + player.ResetData("togga"); + player.SendNotification("~g~[Info]~w~ GA-Chat wird nun ausgeblendet."); + } + else + { + player.SetData("togga", true); + player.SendNotification("~g~[Info]~w~ GA-Chat wird nun angezeigt."); + } + break; } } diff --git a/ReallifeGamemode.Server/Commands/FactionCommands.cs b/ReallifeGamemode.Server/Commands/FactionCommands.cs index c3eede29..83ec06b3 100644 --- a/ReallifeGamemode.Server/Commands/FactionCommands.cs +++ b/ReallifeGamemode.Server/Commands/FactionCommands.cs @@ -74,7 +74,7 @@ namespace ReallifeGamemode.Server.Commands User user = player.GetUser(dbContext); Faction f = user?.Faction; - if ((f == null || !f.GangOwned) && !user.IsAdmin(AdminLevel.ADMIN)) + if ((f == null || !f.GangOwned) && !user.IsAdmin(AdminLevel.ADMIN) && !player.HasData("togga")) { ChatService.NotAuthorized(player); return; @@ -105,7 +105,7 @@ namespace ReallifeGamemode.Server.Commands string broadcastMessage = "!{FF0000}** " + rank + " " + player.Name + ": " + message + " **"; using (var context = new DatabaseContext()) { - ChatService.BroadcastFaction(broadcastMessage, context.Factions.ToList().FindAll(c => c.GangOwned), true); + ChatService.BroadcastFaction(broadcastMessage, context.Factions.ToList().FindAll(c => c.GangOwned), true, (admin) => admin.HasData("togga")); } } @@ -154,7 +154,7 @@ namespace ReallifeGamemode.Server.Commands User user = player.GetUser(dbContext); Faction f = user?.Faction; - if ((f == null || !f.StateOwned) && !user.IsAdmin(AdminLevel.ADMIN)) + if ((f == null || !f.StateOwned) && !user.IsAdmin(AdminLevel.ADMIN) && !player.HasData("todg")) { ChatService.NotAuthorized(player); return; @@ -185,7 +185,7 @@ namespace ReallifeGamemode.Server.Commands string broadcastMessage = "!{CC3333}** " + factionName + " " + player.Name + ": " + message + ", over **"; using (var context = new DatabaseContext()) { - ChatService.BroadcastFaction(broadcastMessage, context.Factions.ToList().FindAll(c => c.StateOwned), true); + ChatService.BroadcastFaction(broadcastMessage, context.Factions.ToList().FindAll(c => c.StateOwned), true, (admin) => admin.HasData("togd")); } } diff --git a/ReallifeGamemode.Server/Services/ChatService.cs b/ReallifeGamemode.Server/Services/ChatService.cs index c4584315..fa3b1165 100644 --- a/ReallifeGamemode.Server/Services/ChatService.cs +++ b/ReallifeGamemode.Server/Services/ChatService.cs @@ -53,7 +53,7 @@ namespace ReallifeGamemode.Server.Services /// /// Die Nachricht, die gesendet werden soll /// Die Liste an Fraktionen, die diese Nachricht bekommen sollen - public static void BroadcastFaction(string message, List factions, bool toAdmins = false) + public static void BroadcastFaction(string message, List factions, bool toAdmins = false, Predicate shouldSendToAdmins = null) { foreach (Player c in NAPI.Pools.GetAllPlayers()) { @@ -63,7 +63,7 @@ namespace ReallifeGamemode.Server.Services { ChatService.SendMessage(c, message); } - else if (user.IsAdmin(AdminLevel.ADMIN) && toAdmins) + else if (user.IsAdmin(AdminLevel.ADMIN) && (toAdmins && (shouldSendToAdmins == null || shouldSendToAdmins(c)))) { ChatService.SendMessage(c, message); }