bissl formattiert
This commit is contained in:
@@ -8,59 +8,59 @@ using ReallifeGamemode.Server.Services;
|
||||
namespace ReallifeGamemode.Server.Job
|
||||
{
|
||||
public abstract class JobBase : Script
|
||||
{
|
||||
public delegate void JobStartHandler(Player player);
|
||||
|
||||
public delegate void JobStopHandler(Player player);
|
||||
|
||||
public event JobStartHandler JobStart;
|
||||
|
||||
public event JobStopHandler JobStop;
|
||||
|
||||
private readonly List<Player> _inJob = new List<Player>();
|
||||
private static readonly List<Player> jobPlayer = new List<Player>();
|
||||
|
||||
public abstract int Id { get; }
|
||||
|
||||
public abstract string Name { get; }
|
||||
|
||||
public abstract bool NeedVehicleToStart { get; }
|
||||
|
||||
public void StartJob(Player player)
|
||||
{
|
||||
public delegate void JobStartHandler(Player player);
|
||||
if (_inJob.Contains(player)) return;
|
||||
_inJob.Add(player);
|
||||
jobPlayer.Add(player);
|
||||
|
||||
public delegate void JobStopHandler(Player player);
|
||||
ChatService.SendMessage(player, $"~y~[JOB]~s~ Du hast deinen Job ~o~{this.Name}~s~ gestartet.");
|
||||
|
||||
public event JobStartHandler JobStart;
|
||||
|
||||
public event JobStopHandler JobStop;
|
||||
|
||||
private readonly List<Player> _inJob = new List<Player>();
|
||||
private static readonly List<Player> jobPlayer = new List<Player>();
|
||||
|
||||
public abstract int Id { get; }
|
||||
|
||||
public abstract string Name { get; }
|
||||
|
||||
public abstract bool NeedVehicleToStart { get; }
|
||||
|
||||
public void StartJob(Player player)
|
||||
{
|
||||
if (_inJob.Contains(player)) return;
|
||||
_inJob.Add(player);
|
||||
jobPlayer.Add(player);
|
||||
|
||||
ChatService.SendMessage(player, $"~y~[JOB]~s~ Du hast deinen Job ~o~{this.Name}~s~ gestartet.");
|
||||
|
||||
JobStart?.Invoke(player);
|
||||
}
|
||||
|
||||
public void StopJob(Player player, bool quit = false)
|
||||
{
|
||||
if (!_inJob.Contains(player)) return;
|
||||
_inJob.Remove(player);
|
||||
jobPlayer.Remove(player);
|
||||
|
||||
if (quit)
|
||||
{
|
||||
ChatService.SendMessage(player, $"~y~[JOB]~s~ Du hast deinen Job ~o~{this.Name}~s~ beendet.");
|
||||
}
|
||||
|
||||
JobStop?.Invoke(player);
|
||||
}
|
||||
|
||||
public List<JobVehicle> GetJobVehicles()
|
||||
{
|
||||
using (var dbContext = new DatabaseContext())
|
||||
{
|
||||
return dbContext.JobVehicles.Where(j => j.JobId == Id).ToList();
|
||||
}
|
||||
}
|
||||
|
||||
public static List<Player> GetPlayerInJob() => jobPlayer;
|
||||
|
||||
public List<Player> GetUsersInJob() => _inJob;
|
||||
JobStart?.Invoke(player);
|
||||
}
|
||||
|
||||
public void StopJob(Player player, bool quit = false)
|
||||
{
|
||||
if (!_inJob.Contains(player)) return;
|
||||
_inJob.Remove(player);
|
||||
jobPlayer.Remove(player);
|
||||
|
||||
if (quit)
|
||||
{
|
||||
ChatService.SendMessage(player, $"~y~[JOB]~s~ Du hast deinen Job ~o~{this.Name}~s~ beendet.");
|
||||
}
|
||||
|
||||
JobStop?.Invoke(player);
|
||||
}
|
||||
|
||||
public List<JobVehicle> GetJobVehicles()
|
||||
{
|
||||
using (var dbContext = new DatabaseContext())
|
||||
{
|
||||
return dbContext.JobVehicles.Where(j => j.JobId == Id).ToList();
|
||||
}
|
||||
}
|
||||
|
||||
public static List<Player> GetPlayerInJob() => jobPlayer;
|
||||
|
||||
public List<Player> GetUsersInJob() => _inJob;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user