Cleand up code, fixed unban

This commit is contained in:
hydrant
2018-09-30 00:46:16 +02:00
parent be028d5aab
commit 9b2a33d819
8 changed files with 193 additions and 235 deletions

View File

@@ -2,6 +2,7 @@
using reallife_gamemode.Model;
using reallife_gamemode.Server.Entities;
using reallife_gamemode.Server.Extensions;
using reallife_gamemode.Server.Util;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -26,8 +27,7 @@ namespace reallife_gamemode.Server.Services
{
player.SendChatMessage("~r~[FEHLER]~s~ Der Spieler wurde nicht gefunden.");
}
<<<<<<< HEAD
public static void PlayerNotLoggedIn(Client player)
{
player.SendChatMessage("~r~[FEHLER]~s~ Du bist nicht eingeloggt.");
@@ -35,20 +35,18 @@ namespace reallife_gamemode.Server.Services
public static void ErrorMsg(Client player)
{
player.SendChatMessage("~r~[FEHLER]~s~ Die Aktion wurde nicht ausgeführt.");
=======
}
public static void BroadcastFaction(string message, List<Faction> factions)
{
using (var dbCon = new DatabaseContext())
foreach (Client c in NAPI.Pools.GetAllPlayers())
{
foreach (Client c in NAPI.Pools.GetAllPlayers())
Faction f = c.GetUser()?.GetFaction();
if (f != null)
{
Faction f = c.GetFaction();
if (f != null)
if (factions.Find(fT => fT.Id == f.Id) != null)
{
if (factions.Find(fT => fT.Id == f.Id) != null)
{
c.SendChatMessage(message);
}
c.SendChatMessage(message);
}
}
}
@@ -57,7 +55,17 @@ namespace reallife_gamemode.Server.Services
public static void BroadcastFaction(string message, Faction faction)
{
BroadcastFaction(message, new List<Faction> { faction });
>>>>>>> feature/faction-system
}
public static void BroadcastAdmin(string message, AdminLevel minLevel)
{
NAPI.Pools.GetAllPlayers().ForEach(p =>
{
if(p.GetUser()?.IsAdmin(minLevel) ?? false)
{
p.SendChatMessage(message);
}
});
}
}
}