Merge branch 'develop' into feature/inventory-system
This commit is contained in:
@@ -3,11 +3,9 @@ using reallife_gamemode.Model;
|
||||
using reallife_gamemode.Server.Extensions;
|
||||
using reallife_gamemode.Server.Util;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
/**
|
||||
* @overview Life of German Reallife - Entities User (User.cs)
|
||||
@@ -59,6 +57,8 @@ namespace reallife_gamemode.Server.Entities
|
||||
public int? FactionRankId { get; set; }
|
||||
public FactionRank FactionRank { get;set; }
|
||||
|
||||
public int? BusinessId { get; set; }
|
||||
|
||||
public Faction GetFaction()
|
||||
{
|
||||
using(var context = new DatabaseContext())
|
||||
@@ -100,14 +100,16 @@ namespace reallife_gamemode.Server.Entities
|
||||
{
|
||||
NAPI.Chat.SendChatMessageToAll("!{#FF4040}[BAN] " + this.Name + " wurde von " + admin.Name + " permanent gebannt. [" + reason + "]");
|
||||
banUser = new Ban { UserId = this.Id, Reason = reason, BannedBy = admin.Name, Applied = unixTimestamp, UntilDateTime = unixTimestamp };
|
||||
//TODO user.Kick();
|
||||
|
||||
GetClient()?.Kick();
|
||||
|
||||
mins--;
|
||||
}
|
||||
else
|
||||
{
|
||||
NAPI.Chat.SendChatMessageToAll("!{#FF4040}[BAN] " + this.Name + " wurde von " + admin.Name + " für " + mins + " Minuten gebannt. [" + reason + "]");
|
||||
banUser = new Ban { UserId = this.Id, Reason = reason, BannedBy = admin.Name, Applied = unixTimestamp, UntilDateTime = unixTimestamp + mins * 60 };
|
||||
//TODO user.Kick();
|
||||
GetClient()?.Kick();
|
||||
}
|
||||
|
||||
banUserContext.Bans.Add(banUser);
|
||||
@@ -119,12 +121,11 @@ namespace reallife_gamemode.Server.Entities
|
||||
}
|
||||
}
|
||||
|
||||
public void UnbanPlayer(Client admin)
|
||||
public void UnbanPlayer()
|
||||
{
|
||||
using (var unbanUser = new DatabaseContext())
|
||||
{
|
||||
User user = admin.GetUser();
|
||||
var targetUser = unbanUser.Users.FirstOrDefault(u => u.Id == user.Id);
|
||||
var targetUser = unbanUser.Users.FirstOrDefault(u => u.Id == this.Id);
|
||||
targetUser.BanId = null;
|
||||
unbanUser.SaveChanges();
|
||||
}
|
||||
@@ -153,5 +154,10 @@ namespace reallife_gamemode.Server.Entities
|
||||
return databaseContext.UserBankAccounts.FirstOrDefault(u => u.UserId == this.Id);
|
||||
}
|
||||
}
|
||||
|
||||
public Client GetClient()
|
||||
{
|
||||
return NAPI.Player.GetPlayerFromName(Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user