Add debug for Faction

This commit is contained in:
Lennart Kampshoff
2018-09-22 23:34:55 +02:00
parent eb4b008b6c
commit e40c78a27f
2 changed files with 2 additions and 13 deletions

View File

@@ -1,6 +1,7 @@
using System; using System;
using System.Linq; using System.Linq;
using GTANetworkAPI; using GTANetworkAPI;
using Microsoft.EntityFrameworkCore;
using reallife_gamemode.Model; using reallife_gamemode.Model;
using reallife_gamemode.Server.Entities; using reallife_gamemode.Server.Entities;
@@ -35,7 +36,7 @@ namespace reallife_gamemode
NAPI.Util.ConsoleOutput(f.Name); 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; Faction f = u.Faction;
NAPI.Util.ConsoleOutput("User: " + u.Name + " | Faction: " + (f == null ? "null" : f.Name)); NAPI.Util.ConsoleOutput("User: " + u.Name + " | Faction: " + (f == null ? "null" : f.Name));

View File

@@ -21,18 +21,6 @@ namespace reallife_gamemode.Server.Commands
{ {
User u = player.GetUser(); 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 + " )) **"; string broadcastMessage = "** " + player.Name + ": " + message + " )) **";
ChatService.BroadcastFaction(broadcastMessage, player.GetFaction()); ChatService.BroadcastFaction(broadcastMessage, player.GetFaction());