OverHaul Bus and Pilot TEST
This commit is contained in:
@@ -5,6 +5,7 @@ using ReallifeGamemode.Database.Entities;
|
||||
using ReallifeGamemode.Database.Models;
|
||||
using ReallifeGamemode.Server.Services;
|
||||
using ReallifeGamemode.Server.Extensions;
|
||||
using ReallifeGamemode.Server.Managers;
|
||||
|
||||
namespace ReallifeGamemode.Server.Job
|
||||
{
|
||||
@@ -21,12 +22,20 @@ namespace ReallifeGamemode.Server.Job
|
||||
private readonly List<Player> _inJob = new List<Player>();
|
||||
private static readonly List<Player> jobPlayer = new List<Player>();
|
||||
|
||||
public static Dictionary<Player, Vehicle> playerVehiclePair = new Dictionary<Player, Vehicle>();
|
||||
|
||||
public abstract int Id { get; }
|
||||
|
||||
public abstract string Name { get; }
|
||||
|
||||
public abstract bool NeedVehicleToStart { get; }
|
||||
|
||||
public abstract void LastCheckpoint(Player player);
|
||||
|
||||
public abstract void StartJobEndTimer(Player player);
|
||||
|
||||
public abstract bool CheckVehicle(Player player, Vehicle veh);
|
||||
|
||||
public virtual bool Deactivated => false;
|
||||
|
||||
public void StartJob(Player player)
|
||||
@@ -46,18 +55,10 @@ namespace ReallifeGamemode.Server.Job
|
||||
_inJob.Remove(player);
|
||||
jobPlayer.Remove(player);
|
||||
|
||||
User user = player.GetUser();
|
||||
|
||||
using (var dbContext = new DatabaseContext())
|
||||
{
|
||||
user = player.GetUser(dbContext);
|
||||
user.trashcount -= user.trashcount;
|
||||
dbContext.SaveChanges();
|
||||
}
|
||||
|
||||
if (quit)
|
||||
{
|
||||
ChatService.SendMessage(player, $"~y~[Job]~s~ Du hast deinen Job (~o~{this.Name}~s~) beendet.");
|
||||
player.Position = JobManager.playerJobStartPosition[player];
|
||||
}
|
||||
|
||||
JobStop?.Invoke(player);
|
||||
@@ -65,10 +66,8 @@ namespace ReallifeGamemode.Server.Job
|
||||
|
||||
public List<JobVehicle> GetJobVehicles()
|
||||
{
|
||||
using (var dbContext = new DatabaseContext())
|
||||
{
|
||||
return dbContext.JobVehicles.Where(j => j.JobId == Id).ToList();
|
||||
}
|
||||
using var dbContext = new DatabaseContext();
|
||||
return dbContext.JobVehicles.Where(j => j.JobId == Id).ToList();
|
||||
}
|
||||
|
||||
public static List<Player> GetPlayerInJob() => jobPlayer;
|
||||
|
||||
Reference in New Issue
Block a user