From e40c78a27fe129d0150246a7feae3860906dc937 Mon Sep 17 00:00:00 2001 From: Lennart Kampshoff Date: Sat, 22 Sep 2018 23:34:55 +0200 Subject: [PATCH] Add debug for Faction --- Main.cs | 3 ++- Server/Commands/Faction.cs | 12 ------------ 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/Main.cs b/Main.cs index 71388759..8018ab39 100644 --- a/Main.cs +++ b/Main.cs @@ -1,6 +1,7 @@ using System; using System.Linq; using GTANetworkAPI; +using Microsoft.EntityFrameworkCore; using reallife_gamemode.Model; using reallife_gamemode.Server.Entities; @@ -35,7 +36,7 @@ namespace reallife_gamemode NAPI.Util.ConsoleOutput(f.Name); } - foreach(User u in context.Users) + foreach(User u in context.Users.Include(x => x.Faction)) { Faction f = u.Faction; NAPI.Util.ConsoleOutput("User: " + u.Name + " | Faction: " + (f == null ? "null" : f.Name)); diff --git a/Server/Commands/Faction.cs b/Server/Commands/Faction.cs index 91e46210..1804baa5 100644 --- a/Server/Commands/Faction.cs +++ b/Server/Commands/Faction.cs @@ -21,18 +21,6 @@ namespace reallife_gamemode.Server.Commands { User u = player.GetUser(); - if(u == null) - { - NAPI.Util.ConsoleOutput("u is null"); - return; - } - Entities.Faction f = u.Faction; - if(f == null) - { - NAPI.Util.ConsoleOutput("f is null"); - return; - } - string broadcastMessage = "** " + player.Name + ": " + message + " )) **"; ChatService.BroadcastFaction(broadcastMessage, player.GetFaction());